Skip to content

Commit 32dd3c0

Browse files
authored
Remove unnecessary cast in semanal_namedtuple.py (#14875)
Split off from #14860, since this one is a no-brainer. `args[0]` has just been narrowed to be of type `StrExpr` in the lines immediately above, and `args` is the same as `call.args`.
1 parent e45b53e commit 32dd3c0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/semanal_namedtuple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def parse_namedtuple_args(
373373
if not isinstance(args[0], StrExpr):
374374
self.fail(f'"{type_name}()" expects a string literal as the first argument', call)
375375
return None
376-
typename = cast(StrExpr, call.args[0]).value
376+
typename = args[0].value
377377
types: list[Type] = []
378378
tvar_defs = []
379379
if not isinstance(args[1], (ListExpr, TupleExpr)):

0 commit comments

Comments
 (0)