Merge branch 'master' into typeshed

This commit is contained in:
Dave Halter
2019-02-27 13:13:17 +01:00
15 changed files with 112 additions and 18 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ class MixedObjectFilter(compiled.CompiledObjectFilter):
@evaluator_function_cache()
def _load_module(evaluator, path):
module_node = evaluator.grammar.parse(
module_node = evaluator.parse(
path=path,
cache=True,
diff_cache=settings.fast_parser,
+2 -1
View File
@@ -514,9 +514,10 @@ class SelfAttributeFilter(ClassFilter):
for name in names:
trailer = name.parent
if trailer.type == 'trailer' \
and len(trailer.children) == 2 \
and len(trailer.parent.children) == 2 \
and trailer.children[0] == '.':
if name.is_definition() and self._access_possible(name):
# TODO filter non-self assignments.
yield name
def _convert_names(self, names):
+1 -1
View File
@@ -172,7 +172,7 @@ def get_module_names(module, all_scopes):
# parent_scope. There's None as a parent, because nodes in the module
# node have the parent module and not suite as all the others.
# Therefore it's important to catch that case.
names = [n for n in names if get_parent_scope(n).parent in (module, None)]
names = [n for n in names if get_parent_scope(n) == module]
return names
+4 -1
View File
@@ -572,7 +572,8 @@ def tree_name_to_contexts(evaluator, context, tree_name):
filters = [next(filters)]
return finder.find(filters, attribute_lookup=False)
elif node.type not in ('import_from', 'import_name'):
raise ValueError("Should not happen. type: %s", node.type)
context = evaluator.create_context(context, tree_name)
return eval_atom(context, tree_name)
typ = node.type
if typ == 'for_stmt':
@@ -612,6 +613,8 @@ def tree_name_to_contexts(evaluator, context, tree_name):
# the static analysis report.
exceptions = context.eval_node(tree_name.get_previous_sibling().get_previous_sibling())
types = exceptions.execute_evaluated()
elif node.type == 'param':
types = NO_CONTEXTS
else:
raise ValueError("Should not happen. type: %s" % typ)
return types