mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
remove unnecessary generators (C400, C401)
This commit is contained in:
parent
89210fc275
commit
4e4813099b
@ -315,7 +315,7 @@ class Autosummary(SphinxDirective):
|
||||
try:
|
||||
real_name, obj, parent, modname = self.import_by_name(name, prefixes=prefixes)
|
||||
except ImportExceptionGroup as exc:
|
||||
errors = list(set("* %s: %s" % (type(e).__name__, e) for e in exc.exceptions))
|
||||
errors = list({"* %s: %s" % (type(e).__name__, e) for e in exc.exceptions})
|
||||
logger.warning(__('autosummary: failed to import %s.\nPossible hints:\n%s'),
|
||||
name, '\n'.join(errors), location=self.get_location())
|
||||
continue
|
||||
|
@ -404,7 +404,7 @@ def generate_autosummary_docs(sources: List[str], output_dir: str = None,
|
||||
else:
|
||||
exceptions = exc.exceptions + [exc2]
|
||||
|
||||
errors = list(set("* %s: %s" % (type(e).__name__, e) for e in exceptions))
|
||||
errors = list({"* %s: %s" % (type(e).__name__, e) for e in exceptions})
|
||||
logger.warning(__('[autosummary] failed to import %s.\nPossible hints:\n%s'),
|
||||
entry.name, '\n'.join(errors))
|
||||
continue
|
||||
@ -468,7 +468,7 @@ def find_autosummary_in_docstring(name: str, filename: str = None) -> List[Autos
|
||||
except AttributeError:
|
||||
pass
|
||||
except ImportExceptionGroup as exc:
|
||||
errors = list(set("* %s: %s" % (type(e).__name__, e) for e in exc.exceptions))
|
||||
errors = list({"* %s: %s" % (type(e).__name__, e) for e in exc.exceptions})
|
||||
print('Failed to import %s.\nPossible hints:\n%s' % (name, '\n'.join(errors)))
|
||||
except SystemExit:
|
||||
print("Failed to import '%s'; the module executes module level "
|
||||
|
@ -931,12 +931,12 @@ def _tokenize_type_spec(spec: str) -> List[str]:
|
||||
else:
|
||||
return [item]
|
||||
|
||||
tokens = list(
|
||||
tokens = [
|
||||
item
|
||||
for raw_token in _token_regex.split(spec)
|
||||
for item in postprocess(raw_token)
|
||||
if item
|
||||
)
|
||||
]
|
||||
return tokens
|
||||
|
||||
|
||||
|
@ -424,7 +424,7 @@ def encode_uri(uri: str) -> str:
|
||||
split = list(urlsplit(uri))
|
||||
split[1] = split[1].encode('idna').decode('ascii')
|
||||
split[2] = quote_plus(split[2].encode(), '/')
|
||||
query = list((q, v.encode()) for (q, v) in parse_qsl(split[3]))
|
||||
query = [(q, v.encode()) for (q, v) in parse_qsl(split[3])]
|
||||
split[3] = urlencode(query)
|
||||
return urlunsplit(split)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user