Get rid of one more isinstance.

This commit is contained in:
Dave Halter
2017-09-02 13:59:21 +02:00
parent e79c0755eb
commit 7a85409da7

View File

@@ -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