Skip to content

Commit 4e48130

Browse files
danieleadesAA-Turner
authored andcommitted
remove unnecessary generators (C400, C401)
1 parent 89210fc commit 4e48130

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

sphinx/ext/autosummary/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def get_items(self, names: List[str]) -> List[Tuple[str, str, str, str]]:
315315
try:
316316
real_name, obj, parent, modname = self.import_by_name(name, prefixes=prefixes)
317317
except ImportExceptionGroup as exc:
318-
errors = list(set("* %s: %s" % (type(e).__name__, e) for e in exc.exceptions))
318+
errors = list({"* %s: %s" % (type(e).__name__, e) for e in exc.exceptions})
319319
logger.warning(__('autosummary: failed to import %s.\nPossible hints:\n%s'),
320320
name, '\n'.join(errors), location=self.get_location())
321321
continue

sphinx/ext/autosummary/generate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def generate_autosummary_docs(sources: List[str], output_dir: str = None,
404404
else:
405405
exceptions = exc.exceptions + [exc2]
406406

407-
errors = list(set("* %s: %s" % (type(e).__name__, e) for e in exceptions))
407+
errors = list({"* %s: %s" % (type(e).__name__, e) for e in exceptions})
408408
logger.warning(__('[autosummary] failed to import %s.\nPossible hints:\n%s'),
409409
entry.name, '\n'.join(errors))
410410
continue
@@ -468,7 +468,7 @@ def find_autosummary_in_docstring(name: str, filename: str = None) -> List[Autos
468468
except AttributeError:
469469
pass
470470
except ImportExceptionGroup as exc:
471-
errors = list(set("* %s: %s" % (type(e).__name__, e) for e in exc.exceptions))
471+
errors = list({"* %s: %s" % (type(e).__name__, e) for e in exc.exceptions})
472472
print('Failed to import %s.\nPossible hints:\n%s' % (name, '\n'.join(errors)))
473473
except SystemExit:
474474
print("Failed to import '%s'; the module executes module level "

sphinx/ext/napoleon/docstring.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,12 +931,12 @@ def postprocess(item):
931931
else:
932932
return [item]
933933

934-
tokens = list(
934+
tokens = [
935935
item
936936
for raw_token in _token_regex.split(spec)
937937
for item in postprocess(raw_token)
938938
if item
939-
)
939+
]
940940
return tokens
941941

942942

sphinx/util/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def encode_uri(uri: str) -> str:
424424
split = list(urlsplit(uri))
425425
split[1] = split[1].encode('idna').decode('ascii')
426426
split[2] = quote_plus(split[2].encode(), '/')
427-
query = list((q, v.encode()) for (q, v) in parse_qsl(split[3]))
427+
query = [(q, v.encode()) for (q, v) in parse_qsl(split[3])]
428428
split[3] = urlencode(query)
429429
return urlunsplit(split)
430430

0 commit comments

Comments
 (0)