Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 488ee92

Browse filesBrowse files
STY: Apply ruff/Perflint rule PERF403
PERF403 Use `dict.update` instead of a for-loop PERF403 Use a dictionary comprehension instead of a for-loop
1 parent 711008c commit 488ee92
Copy full SHA for 488ee92

File tree

2 files changed

+6
-6
lines changed
Filter options

2 files changed

+6
-6
lines changed

‎numpy/_core/code_generators/genapi.py

Copy file name to clipboardExpand all lines: numpy/_core/code_generators/genapi.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,7 @@ def _key(x):
466466
def merge_api_dicts(dicts):
467467
ret = {}
468468
for d in dicts:
469-
for k, v in d.items():
470-
ret[k] = v
469+
ret.update(dict(d.items()))
471470

472471
return ret
473472

‎numpy/lib/introspect.py

Copy file name to clipboardExpand all lines: numpy/lib/introspect.py
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ def opt_func_info(func_name=None, signature=None):
8181
sig_pattern = re.compile(signature)
8282
matching_sigs = {}
8383
for k, v in matching_funcs.items():
84-
matching_chars = {}
85-
for chars, targets in v.items():
84+
matching_chars = {
85+
chars: targets
86+
for chars, targets in v.items()
8687
if any(
8788
sig_pattern.search(c) or sig_pattern.search(dtype(c).name)
8889
for c in chars
89-
):
90-
matching_chars[chars] = targets
90+
)
91+
}
9192
if matching_chars:
9293
matching_sigs[k] = matching_chars
9394
else:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.