1
0
forked from VimPlug/jedi

Refactor something to use .type instead of isinstance.

This commit is contained in:
Dave Halter
2016-06-30 09:55:21 +02:00
parent 689284c615
commit 6b41db96bf
4 changed files with 12 additions and 3 deletions

View File

@@ -235,7 +235,12 @@ class NameFinder(object):
"""
for n in names:
definition = n.parent
if isinstance(definition, (tree.Function, tree.Class, tree.Module)):
if isinstance(definition, (compiled.CompiledObject,
iterable.BuiltinMethod)):
# TODO this if should really be removed by changing the type of
# those classes.
yield n
elif definition.type in ('funcdef', 'classdef', 'file_input'):
yield self._evaluator.wrap(definition).name
else:
yield n