diff options
author | Anthony Sottile <asottile@umich.edu> | 2020-10-02 16:57:42 -0700 |
---|---|---|
committer | Anthony Sottile <asottile@umich.edu> | 2020-10-02 16:57:42 -0700 |
commit | 8c8fc908084a08859c1dc5ba6ca30cfc9e493160 (patch) | |
tree | 4f1486e8d53f7985e3e6dc2be8f6001b817f57e3 | |
parent | 684edfc8833bdb90b0a8ae562fd24d0e1e2fb686 (diff) | |
download | pyflakes-simplify_literal_check.tar.gz |
simplify typing.Literal checksimplify_literal_check
-rw-r--r-- | pyflakes/checker.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/pyflakes/checker.py b/pyflakes/checker.py index a6439d6..d6d057e 100644 --- a/pyflakes/checker.py +++ b/pyflakes/checker.py @@ -862,7 +862,6 @@ class Checker(object): offset = None traceTree = False _in_annotation = AnnotationState.NONE - _in_typing_literal = False _in_deferred = False builtIns = set(builtin_vars).union(_MAGIC_GLOBALS) @@ -1505,11 +1504,8 @@ class Checker(object): def SUBSCRIPT(self, node): if _is_name_or_attr(node.value, 'Literal'): - orig, self._in_typing_literal = self._in_typing_literal, True - try: + with self._enter_annotation(AnnotationState.NONE): self.handleChildren(node) - finally: - self._in_typing_literal = orig elif _is_name_or_attr(node.value, 'Annotated'): self.handleNode(node.value, node) @@ -1794,7 +1790,7 @@ class Checker(object): self.handleChildren(node) def STR(self, node): - if self._in_annotation and not self._in_typing_literal: + if self._in_annotation: fn = functools.partial( self.handleStringAnnotation, node.s, |