Skip to content

Commit 242387c

Browse files
Apply suggestions from code review
Co-authored-by: Adam Turner <[email protected]>
1 parent 1cfdd2d commit 242387c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Lib/annotationlib.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def __repr__(self):
305305
return f"ForwardRef({self.__forward_arg__!r}{''.join(extra)})"
306306

307307

308-
_Template = type(t"{1}")
308+
_Template = type(t"")
309309

310310

311311
class _Stringifier:
@@ -575,7 +575,11 @@ def _template_to_ast(template):
575575
interp = ast.Interpolation(
576576
value=ast.parse(part.expression),
577577
conversion=ord(part.conversion) if part.conversion is not None else -1,
578-
format_spec=ast.Constant(value=part.format_spec) if part.format_spec != "" else None,
578+
format_spec=(
579+
ast.Constant(value=part.format_spec)
580+
if part.format_spec != ""
581+
else None
582+
),
579583
)
580584
values.append(interp)
581585
return ast.TemplateStr(values=values)

Lib/test/.ruff.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ extend-exclude = [
99
"encoded_modules/module_iso_8859_1.py",
1010
"encoded_modules/module_koi8_r.py",
1111
# SyntaxError because of t-strings
12-
"test_tstring.py",
13-
"test_string/test_templatelib.py",
1412
"test_annotationlib.py",
13+
"test_string/test_templatelib.py",
14+
"test_tstring.py",
1515
# New grammar constructions may not yet be recognized by Ruff,
1616
# and tests re-use the same names as only the grammar is being checked.
1717
"test_grammar.py",

0 commit comments

Comments
 (0)