mirror of
https://github.com/davidhalter/parso.git
synced 2026-02-08 10:51:23 +08:00
Get rid of one more isinstance.
This commit is contained in:
@@ -35,6 +35,8 @@ from parso.python.prefix import split_prefix
|
|||||||
_FLOW_CONTAINERS = set(['if_stmt', 'while_stmt', 'for_stmt', 'try_stmt',
|
_FLOW_CONTAINERS = set(['if_stmt', 'while_stmt', 'for_stmt', 'try_stmt',
|
||||||
'with_stmt', 'async_stmt', 'suite'])
|
'with_stmt', 'async_stmt', 'suite'])
|
||||||
_RETURN_STMT_CONTAINERS = set(['suite', 'simple_stmt']) | _FLOW_CONTAINERS
|
_RETURN_STMT_CONTAINERS = set(['suite', 'simple_stmt']) | _FLOW_CONTAINERS
|
||||||
|
_FUNC_CONTAINERS = set(['suite', 'simple_stmt', 'decorated']) | _FLOW_CONTAINERS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DocstringMixin(object):
|
class DocstringMixin(object):
|
||||||
@@ -283,8 +285,7 @@ class Scope(PythonBaseNode, DocstringMixin):
|
|||||||
for element in children:
|
for element in children:
|
||||||
if element.type in names:
|
if element.type in names:
|
||||||
yield element
|
yield element
|
||||||
if element.type in ('suite', 'simple_stmt', 'decorated') \
|
if element.type in _FUNC_CONTAINERS:
|
||||||
or isinstance(element, Flow):
|
|
||||||
for e in scan(element.children):
|
for e in scan(element.children):
|
||||||
yield e
|
yield e
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user