Skip to content

Commit dbb8fc4

Browse files
authored
simplify typing.Literal check (#587)
1 parent 6a5f38b commit dbb8fc4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pyflakes/checker.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,6 @@ class Checker(object):
862862
offset = None
863863
traceTree = False
864864
_in_annotation = AnnotationState.NONE
865-
_in_typing_literal = False
866865
_in_deferred = False
867866

868867
builtIns = set(builtin_vars).union(_MAGIC_GLOBALS)
@@ -1505,11 +1504,8 @@ def ignore(self, node):
15051504

15061505
def SUBSCRIPT(self, node):
15071506
if _is_name_or_attr(node.value, 'Literal'):
1508-
orig, self._in_typing_literal = self._in_typing_literal, True
1509-
try:
1507+
with self._enter_annotation(AnnotationState.NONE):
15101508
self.handleChildren(node)
1511-
finally:
1512-
self._in_typing_literal = orig
15131509
elif _is_name_or_attr(node.value, 'Annotated'):
15141510
self.handleNode(node.value, node)
15151511

@@ -1794,7 +1790,7 @@ def BINOP(self, node):
17941790
self.handleChildren(node)
17951791

17961792
def STR(self, node):
1797-
if self._in_annotation and not self._in_typing_literal:
1793+
if self._in_annotation:
17981794
fn = functools.partial(
17991795
self.handleStringAnnotation,
18001796
node.s,

0 commit comments

Comments
 (0)