Skip to content

Commit 8868c63

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 9d02634 commit 8868c63

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mypy/fastparse.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,21 @@ def p() -> AST:
155155
return ast3.parse(
156156
source, filename, mode, type_comments=True, feature_version=feature_version
157157
)
158+
158159
p() # Call to assure syntactic validity (will throw an exception otherwise, exiting this function).
159160
if isinstance(source, str):
160161
tokens = tokenize.generate_tokens(io.StringIO(source).readline)
161162
to_find, to_replace = r"#\s*mypy:\s*ignore(?![-_])", "# type: ignore"
162163
source = tokenize.untokenize(
163-
(t, re.sub(to_find, to_replace, s) if t == tokenize.COMMENT else s) for t, s, *_ in tokens
164+
(t, re.sub(to_find, to_replace, s) if t == tokenize.COMMENT else s)
165+
for t, s, *_ in tokens
164166
)
165167
else:
166168
tokens = tokenize.tokenize(io.BytesIO(source).readline)
167169
to_find, to_replace = rb"#\s*mypy:\s*ignore(?![-_])", b"# type: ignore"
168170
source = tokenize.untokenize(
169-
(t, re.sub(to_find, to_replace, s) if t == tokenize.COMMENT else s) for t, s, *_ in tokens
171+
(t, re.sub(to_find, to_replace, s) if t == tokenize.COMMENT else s)
172+
for t, s, *_ in tokens
170173
)
171174
return p()
172175

0 commit comments

Comments
 (0)