Last active
July 15, 2020 18:34
-
-
Save Carreau/11625cb404956bf16bbc075347b0843f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------- | |
AttributeError Traceback (most recent call last) | |
<ipython-input-42-e8051349cd43> in <module> | |
1 script = """x = np.linspace(-np.pi, 10)""" | |
2 #format_and_infer_types(script) | |
----> 3 jedi.Interpreter(script, [{'np':np}]).infer(1,0) | |
~/dev/jedi/jedi/api/helpers.py in validate_line_column.<locals>.wrapper(self, line, column, *args, **kwargs) | |
483 if not (0 <= column <= line_len): | |
484 raise ValueError('`column` parameter (%d) is not in a valid range ' | |
485 '(0-%d) for line %d (%r).' % ( | |
486 column, line_len, line, line_string)) | |
--> 487 return func(self, line, column, *args, **kwargs) | |
~/dev/jedi/jedi/api/__init__.py in Script.infer(self, line, column, **kwargs) | |
295 """ | |
296 Return the definitions of under the cursor. It is basically a wrapper | |
297 around Jedi's type inference. | |
(...) | |
308 :rtype: list of :class:`.Name` | |
309 """ | |
310 with debug.increase_indent_cm('infer'): | |
--> 311 return self._infer(line, column, **kwargs) | |
~/dev/jedi/jedi/api/__init__.py in Script._infer(self, line, column, only_stubs, prefer_stubs) | |
327 return [] | |
329 context = self._get_module_context().create_context(leaf) | |
--> 331 values = helpers.infer(self._inference_state, context, leaf) | |
332 values = convert_values( | |
333 values, | |
334 only_stubs=only_stubs, | |
335 prefer_stubs=prefer_stubs, | |
336 ) | |
338 defs = [classes.Name(self._inference_state, c.name) for c in values] | |
~/dev/jedi/jedi/api/helpers.py in infer(inference_state, context, leaf) | |
162 def infer(inference_state, context, leaf): | |
163 if leaf.type == 'name': | |
--> 164 return inference_state.infer(context, leaf) | |
166 parent = leaf.parent | |
167 definitions = NO_VALUES | |
~/dev/jedi/jedi/inference/__init__.py in InferenceState.infer(self, context, name) | |
159 is_simple_name = name.parent.type not in ('power', 'trailer') | |
160 if is_simple_name: | |
--> 161 return infer_expr_stmt(context, def_, name) | |
162 if type_ == 'for_stmt': | |
163 container_types = context.infer_node(def_.children[3]) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_expr_stmt(context, stmt, seek_name) | |
382 if pep0484_values: | |
383 return pep0484_values | |
--> 385 return _infer_expr_stmt(context, stmt, seek_name) | |
386 return NO_VALUES | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_expr_stmt(context, stmt, seek_name) | |
415 debug.dbg('infer_expr_stmt %s (%s)', stmt, seek_name) | |
416 rhs = stmt.get_rhs() | |
--> 418 value_set = context.infer_node(rhs) | |
420 if seek_name: | |
421 n = TreeNameDefinition(context, seek_name) | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
202 value_set = _infer_comparison( | |
203 context, | |
204 value_set, | |
205 trailer, | |
206 right | |
207 ) | |
208 break | |
--> 209 value_set = infer_trailer(context, value_set, trailer) | |
211 if had_await: | |
212 return value_set.py__await__().py__stop_iteration_returns() | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_trailer(context, atom_values, trailer) | |
279 assert trailer_op == '(', 'trailer_op is actually %s' % trailer_op | |
280 args = arguments.TreeArguments(context.inference_state, context, node, trailer) | |
--> 281 return atom_values.execute(args) | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.execute(self, arguments) | |
481 def execute(self, arguments): | |
--> 482 return ValueSet.from_sets(c.inference_state.execute(c, arguments) for c in self._set) | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.from_sets(cls, sets) | |
420 """ | |
421 Used to work with an iterable of set. | |
422 """ | |
423 aggregated = set() | |
--> 424 for set_ in sets: | |
425 if isinstance(set_, ValueSet): | |
426 aggregated |= set_._set | |
~/dev/jedi/jedi/inference/base_value.py in <genexpr>(.0) | |
481 def execute(self, arguments): | |
--> 482 return ValueSet.from_sets(c.inference_state.execute(c, arguments) for c in self._set) | |
~/dev/jedi/jedi/plugins/__init__.py in _PluginManager.decorate.<locals>.decorator.<locals>.wrapper(*args, **kwargs) | |
19 @wraps(callback) | |
20 def wrapper(*args, **kwargs): | |
---> 21 return built_functions[public_name](*args, **kwargs) | |
~/dev/jedi/jedi/plugins/stdlib.py in execute.<locals>.wrapper(value, arguments) | |
132 else: | |
133 return func(value, arguments=arguments, callback=call) | |
--> 134 return call() | |
~/dev/jedi/jedi/plugins/stdlib.py in execute.<locals>.wrapper.<locals>.call() | |
106 def call(): | |
--> 107 return callback(value, arguments=arguments) | |
~/dev/jedi/jedi/plugins/pytest.py in execute.<locals>.wrapper(value, arguments) | |
21 if value.py__name__() == 'fixture' \ | |
22 and value.parent_context.py__name__() == '_pytest.fixtures': | |
23 return NO_VALUES | |
---> 25 return callback(value, arguments) | |
~/dev/jedi/jedi/inference/__init__.py in InferenceState.execute(value, arguments) | |
117 debug.dbg('execute: %s %s', value, arguments) | |
118 with debug.increase_indent_cm(): | |
--> 119 value_set = value.py__call__(arguments=arguments) | |
120 debug.dbg('execute result: %s in %s', value_set, value) | |
121 return value_set | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/compiled/mixed.py in MixedObject.py__call__(self, arguments) | |
64 if not values: | |
65 values = self._wrapped_value | |
---> 66 return values.py__call__(arguments) | |
~/dev/jedi/jedi/inference/value/function.py in FunctionMixin.py__call__(self, arguments) | |
116 def py__call__(self, arguments): | |
117 function_execution = self.as_context(arguments) | |
--> 118 return function_execution.infer() | |
~/dev/jedi/jedi/inference/value/function.py in BaseFunctionExecutionContext.infer(self) | |
358 return ValueSet([iterable.Generator(inference_state, self)]) | |
359 else: | |
--> 360 return self.get_return_values() | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/recursion.py in execution_recursion_decorator.<locals>.decorator.<locals>.wrapper(self, **kwargs) | |
85 result = default | |
86 else: | |
---> 87 result = func(self, **kwargs) | |
88 finally: | |
89 detector.pop_execution() | |
~/dev/jedi/jedi/inference/value/function.py in BaseFunctionExecutionContext.get_return_values(self, check_yields) | |
242 value_set |= ValueSet([ctx]) | |
243 else: | |
--> 244 value_set |= self.infer_node(children[1]) | |
245 if check is flow_analysis.REACHABLE: | |
246 debug.dbg('Return reachable: %s', r) | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
195 had_await = True | |
196 first_child = children.pop(0) | |
--> 198 value_set = context.infer_node(first_child) | |
199 for (i, trailer) in enumerate(children): | |
200 if trailer == '**': # has a power operation. | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
183 typ = element.type | |
184 if typ in ('name', 'number', 'string', 'atom', 'strings', 'keyword', 'fstring'): | |
--> 185 return infer_atom(context, element) | |
186 elif typ == 'lambdef': | |
187 return ValueSet([FunctionValue.from_context(context, element)]) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_atom(context, atom) | |
303 if _is_annotation_name(atom): | |
304 # Since Python 3.7 (with from __future__ import annotations), | |
305 # annotations are essentially strings and can reference objects | |
306 # that are defined further down in code. Therefore just set the | |
307 # position to None, so the finder will not try to stop at a certain | |
308 # position in the module. | |
309 position = None | |
--> 310 return context.py__getattribute__(atom, position=position) | |
311 elif atom.type == 'keyword': | |
312 # For False/True/None | |
313 if atom.value in ('False', 'True', 'None'): | |
~/dev/jedi/jedi/inference/context.py in AbstractContext.py__getattribute__(self, name_or_str, name_context, position, analysis_errors) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.from_sets(cls, sets) | |
420 """ | |
421 Used to work with an iterable of set. | |
422 """ | |
423 aggregated = set() | |
--> 424 for set_ in sets: | |
425 if isinstance(set_, ValueSet): | |
426 aggregated |= set_._set | |
~/dev/jedi/jedi/inference/context.py in <genexpr>(.0) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/names.py in TreeNameDefinition.infer(self) | |
276 def infer(self): | |
277 # Refactor this, should probably be here. | |
278 from jedi.inference.syntax_tree import tree_name_to_values | |
--> 279 return tree_name_to_values( | |
280 self.parent_context.inference_state, | |
281 self.parent_context, | |
282 self.tree_name | |
283 ) | |
~/dev/jedi/jedi/plugins/__init__.py in _PluginManager.decorate.<locals>.decorator.<locals>.wrapper(*args, **kwargs) | |
19 @wraps(callback) | |
20 def wrapper(*args, **kwargs): | |
---> 21 return built_functions[public_name](*args, **kwargs) | |
~/dev/jedi/jedi/plugins/stdlib.py in tree_name_to_values.<locals>.wrapper(inference_state, context, tree_name) | |
858 if tree_name.value == 'sep' and context.is_module() and context.py__name__() == 'os.path': | |
859 return ValueSet({ | |
860 compiled.create_simple_object(inference_state, os.path.sep), | |
861 }) | |
--> 862 return func(inference_state, context, tree_name) | |
~/dev/jedi/jedi/plugins/django.py in tree_name_to_values.<locals>.wrapper(inference_state, context, tree_name) | |
175 def wrapper(inference_state, context, tree_name): | |
--> 176 result = func(inference_state, context, tree_name) | |
177 if tree_name.value in _FILTER_LIKE_METHODS: | |
178 # Here we try to overwrite stuff like User.objects.filter. We need | |
179 # this to make sure that keyword param completion works on these | |
180 # kind of methods. | |
181 for v in result: | |
~/dev/jedi/jedi/inference/syntax_tree.py in tree_name_to_values(inference_state, context, tree_name) | |
745 types = check_tuple_assignments(n, for_types) | |
746 elif typ == 'expr_stmt': | |
--> 747 types = infer_expr_stmt(context, node, tree_name) | |
748 elif typ == 'with_stmt': | |
749 value_managers = context.infer_node(node.get_test_node_from_name(tree_name)) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_expr_stmt(context, stmt, seek_name) | |
382 if pep0484_values: | |
383 return pep0484_values | |
--> 385 return _infer_expr_stmt(context, stmt, seek_name) | |
386 return NO_VALUES | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_expr_stmt(context, stmt, seek_name) | |
415 debug.dbg('infer_expr_stmt %s (%s)', stmt, seek_name) | |
416 rhs = stmt.get_rhs() | |
--> 418 value_set = context.infer_node(rhs) | |
420 if seek_name: | |
421 n = TreeNameDefinition(context, seek_name) | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
202 value_set = _infer_comparison( | |
203 context, | |
204 value_set, | |
205 trailer, | |
206 right | |
207 ) | |
208 break | |
--> 209 value_set = infer_trailer(context, value_set, trailer) | |
211 if had_await: | |
212 return value_set.py__await__().py__stop_iteration_returns() | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_trailer(context, atom_values, trailer) | |
279 assert trailer_op == '(', 'trailer_op is actually %s' % trailer_op | |
280 args = arguments.TreeArguments(context.inference_state, context, node, trailer) | |
--> 281 return atom_values.execute(args) | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.execute(self, arguments) | |
481 def execute(self, arguments): | |
--> 482 return ValueSet.from_sets(c.inference_state.execute(c, arguments) for c in self._set) | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.from_sets(cls, sets) | |
420 """ | |
421 Used to work with an iterable of set. | |
422 """ | |
423 aggregated = set() | |
--> 424 for set_ in sets: | |
425 if isinstance(set_, ValueSet): | |
426 aggregated |= set_._set | |
~/dev/jedi/jedi/inference/base_value.py in <genexpr>(.0) | |
481 def execute(self, arguments): | |
--> 482 return ValueSet.from_sets(c.inference_state.execute(c, arguments) for c in self._set) | |
~/dev/jedi/jedi/plugins/__init__.py in _PluginManager.decorate.<locals>.decorator.<locals>.wrapper(*args, **kwargs) | |
19 @wraps(callback) | |
20 def wrapper(*args, **kwargs): | |
---> 21 return built_functions[public_name](*args, **kwargs) | |
~/dev/jedi/jedi/plugins/stdlib.py in execute.<locals>.wrapper(value, arguments) | |
132 else: | |
133 return func(value, arguments=arguments, callback=call) | |
--> 134 return call() | |
~/dev/jedi/jedi/plugins/stdlib.py in execute.<locals>.wrapper.<locals>.call() | |
106 def call(): | |
--> 107 return callback(value, arguments=arguments) | |
~/dev/jedi/jedi/plugins/pytest.py in execute.<locals>.wrapper(value, arguments) | |
21 if value.py__name__() == 'fixture' \ | |
22 and value.parent_context.py__name__() == '_pytest.fixtures': | |
23 return NO_VALUES | |
---> 25 return callback(value, arguments) | |
~/dev/jedi/jedi/inference/__init__.py in InferenceState.execute(value, arguments) | |
117 debug.dbg('execute: %s %s', value, arguments) | |
118 with debug.increase_indent_cm(): | |
--> 119 value_set = value.py__call__(arguments=arguments) | |
120 debug.dbg('execute result: %s in %s', value_set, value) | |
121 return value_set | |
~/dev/jedi/jedi/inference/value/function.py in FunctionMixin.py__call__(self, arguments) | |
116 def py__call__(self, arguments): | |
117 function_execution = self.as_context(arguments) | |
--> 118 return function_execution.infer() | |
~/dev/jedi/jedi/inference/value/function.py in BaseFunctionExecutionContext.infer(self) | |
358 return ValueSet([iterable.Generator(inference_state, self)]) | |
359 else: | |
--> 360 return self.get_return_values() | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/recursion.py in execution_recursion_decorator.<locals>.decorator.<locals>.wrapper(self, **kwargs) | |
85 result = default | |
86 else: | |
---> 87 result = func(self, **kwargs) | |
88 finally: | |
89 detector.pop_execution() | |
~/dev/jedi/jedi/inference/value/function.py in BaseFunctionExecutionContext.get_return_values(self, check_yields) | |
242 value_set |= ValueSet([ctx]) | |
243 else: | |
--> 244 value_set |= self.infer_node(children[1]) | |
245 if check is flow_analysis.REACHABLE: | |
246 debug.dbg('Return reachable: %s', r) | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
183 typ = element.type | |
184 if typ in ('name', 'number', 'string', 'atom', 'strings', 'keyword', 'fstring'): | |
--> 185 return infer_atom(context, element) | |
186 elif typ == 'lambdef': | |
187 return ValueSet([FunctionValue.from_context(context, element)]) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_atom(context, atom) | |
303 if _is_annotation_name(atom): | |
304 # Since Python 3.7 (with from __future__ import annotations), | |
305 # annotations are essentially strings and can reference objects | |
306 # that are defined further down in code. Therefore just set the | |
307 # position to None, so the finder will not try to stop at a certain | |
308 # position in the module. | |
309 position = None | |
--> 310 return context.py__getattribute__(atom, position=position) | |
311 elif atom.type == 'keyword': | |
312 # For False/True/None | |
313 if atom.value in ('False', 'True', 'None'): | |
~/dev/jedi/jedi/inference/context.py in AbstractContext.py__getattribute__(self, name_or_str, name_context, position, analysis_errors) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.from_sets(cls, sets) | |
420 """ | |
421 Used to work with an iterable of set. | |
422 """ | |
423 aggregated = set() | |
--> 424 for set_ in sets: | |
425 if isinstance(set_, ValueSet): | |
426 aggregated |= set_._set | |
~/dev/jedi/jedi/inference/context.py in <genexpr>(.0) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/names.py in TreeNameDefinition.infer(self) | |
276 def infer(self): | |
277 # Refactor this, should probably be here. | |
278 from jedi.inference.syntax_tree import tree_name_to_values | |
--> 279 return tree_name_to_values( | |
280 self.parent_context.inference_state, | |
281 self.parent_context, | |
282 self.tree_name | |
283 ) | |
~/dev/jedi/jedi/plugins/__init__.py in _PluginManager.decorate.<locals>.decorator.<locals>.wrapper(*args, **kwargs) | |
19 @wraps(callback) | |
20 def wrapper(*args, **kwargs): | |
---> 21 return built_functions[public_name](*args, **kwargs) | |
~/dev/jedi/jedi/plugins/stdlib.py in tree_name_to_values.<locals>.wrapper(inference_state, context, tree_name) | |
858 if tree_name.value == 'sep' and context.is_module() and context.py__name__() == 'os.path': | |
859 return ValueSet({ | |
860 compiled.create_simple_object(inference_state, os.path.sep), | |
861 }) | |
--> 862 return func(inference_state, context, tree_name) | |
~/dev/jedi/jedi/plugins/django.py in tree_name_to_values.<locals>.wrapper(inference_state, context, tree_name) | |
175 def wrapper(inference_state, context, tree_name): | |
--> 176 result = func(inference_state, context, tree_name) | |
177 if tree_name.value in _FILTER_LIKE_METHODS: | |
178 # Here we try to overwrite stuff like User.objects.filter. We need | |
179 # this to make sure that keyword param completion works on these | |
180 # kind of methods. | |
181 for v in result: | |
~/dev/jedi/jedi/inference/syntax_tree.py in tree_name_to_values(inference_state, context, tree_name) | |
745 types = check_tuple_assignments(n, for_types) | |
746 elif typ == 'expr_stmt': | |
--> 747 types = infer_expr_stmt(context, node, tree_name) | |
748 elif typ == 'with_stmt': | |
749 value_managers = context.infer_node(node.get_test_node_from_name(tree_name)) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_expr_stmt(context, stmt, seek_name) | |
382 if pep0484_values: | |
383 return pep0484_values | |
--> 385 return _infer_expr_stmt(context, stmt, seek_name) | |
386 return NO_VALUES | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_expr_stmt(context, stmt, seek_name) | |
415 debug.dbg('infer_expr_stmt %s (%s)', stmt, seek_name) | |
416 rhs = stmt.get_rhs() | |
--> 418 value_set = context.infer_node(rhs) | |
420 if seek_name: | |
421 n = TreeNameDefinition(context, seek_name) | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
195 had_await = True | |
196 first_child = children.pop(0) | |
--> 198 value_set = context.infer_node(first_child) | |
199 for (i, trailer) in enumerate(children): | |
200 if trailer == '**': # has a power operation. | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
183 typ = element.type | |
184 if typ in ('name', 'number', 'string', 'atom', 'strings', 'keyword', 'fstring'): | |
--> 185 return infer_atom(context, element) | |
186 elif typ == 'lambdef': | |
187 return ValueSet([FunctionValue.from_context(context, element)]) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_atom(context, atom) | |
303 if _is_annotation_name(atom): | |
304 # Since Python 3.7 (with from __future__ import annotations), | |
305 # annotations are essentially strings and can reference objects | |
306 # that are defined further down in code. Therefore just set the | |
307 # position to None, so the finder will not try to stop at a certain | |
308 # position in the module. | |
309 position = None | |
--> 310 return context.py__getattribute__(atom, position=position) | |
311 elif atom.type == 'keyword': | |
312 # For False/True/None | |
313 if atom.value in ('False', 'True', 'None'): | |
~/dev/jedi/jedi/inference/context.py in AbstractContext.py__getattribute__(self, name_or_str, name_context, position, analysis_errors) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.from_sets(cls, sets) | |
420 """ | |
421 Used to work with an iterable of set. | |
422 """ | |
423 aggregated = set() | |
--> 424 for set_ in sets: | |
425 if isinstance(set_, ValueSet): | |
426 aggregated |= set_._set | |
~/dev/jedi/jedi/inference/context.py in <genexpr>(.0) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/names.py in TreeNameDefinition.infer(self) | |
276 def infer(self): | |
277 # Refactor this, should probably be here. | |
278 from jedi.inference.syntax_tree import tree_name_to_values | |
--> 279 return tree_name_to_values( | |
280 self.parent_context.inference_state, | |
281 self.parent_context, | |
282 self.tree_name | |
283 ) | |
~/dev/jedi/jedi/plugins/__init__.py in _PluginManager.decorate.<locals>.decorator.<locals>.wrapper(*args, **kwargs) | |
19 @wraps(callback) | |
20 def wrapper(*args, **kwargs): | |
---> 21 return built_functions[public_name](*args, **kwargs) | |
~/dev/jedi/jedi/plugins/stdlib.py in tree_name_to_values.<locals>.wrapper(inference_state, context, tree_name) | |
858 if tree_name.value == 'sep' and context.is_module() and context.py__name__() == 'os.path': | |
859 return ValueSet({ | |
860 compiled.create_simple_object(inference_state, os.path.sep), | |
861 }) | |
--> 862 return func(inference_state, context, tree_name) | |
~/dev/jedi/jedi/plugins/django.py in tree_name_to_values.<locals>.wrapper(inference_state, context, tree_name) | |
175 def wrapper(inference_state, context, tree_name): | |
--> 176 result = func(inference_state, context, tree_name) | |
177 if tree_name.value in _FILTER_LIKE_METHODS: | |
178 # Here we try to overwrite stuff like User.objects.filter. We need | |
179 # this to make sure that keyword param completion works on these | |
180 # kind of methods. | |
181 for v in result: | |
~/dev/jedi/jedi/inference/syntax_tree.py in tree_name_to_values(inference_state, context, tree_name) | |
745 types = check_tuple_assignments(n, for_types) | |
746 elif typ == 'expr_stmt': | |
--> 747 types = infer_expr_stmt(context, node, tree_name) | |
748 elif typ == 'with_stmt': | |
749 value_managers = context.infer_node(node.get_test_node_from_name(tree_name)) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_expr_stmt(context, stmt, seek_name) | |
382 if pep0484_values: | |
383 return pep0484_values | |
--> 385 return _infer_expr_stmt(context, stmt, seek_name) | |
386 return NO_VALUES | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_expr_stmt(context, stmt, seek_name) | |
415 debug.dbg('infer_expr_stmt %s (%s)', stmt, seek_name) | |
416 rhs = stmt.get_rhs() | |
--> 418 value_set = context.infer_node(rhs) | |
420 if seek_name: | |
421 n = TreeNameDefinition(context, seek_name) | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
195 had_await = True | |
196 first_child = children.pop(0) | |
--> 198 value_set = context.infer_node(first_child) | |
199 for (i, trailer) in enumerate(children): | |
200 if trailer == '**': # has a power operation. | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
183 typ = element.type | |
184 if typ in ('name', 'number', 'string', 'atom', 'strings', 'keyword', 'fstring'): | |
--> 185 return infer_atom(context, element) | |
186 elif typ == 'lambdef': | |
187 return ValueSet([FunctionValue.from_context(context, element)]) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_atom(context, atom) | |
303 if _is_annotation_name(atom): | |
304 # Since Python 3.7 (with from __future__ import annotations), | |
305 # annotations are essentially strings and can reference objects | |
306 # that are defined further down in code. Therefore just set the | |
307 # position to None, so the finder will not try to stop at a certain | |
308 # position in the module. | |
309 position = None | |
--> 310 return context.py__getattribute__(atom, position=position) | |
311 elif atom.type == 'keyword': | |
312 # For False/True/None | |
313 if atom.value in ('False', 'True', 'None'): | |
~/dev/jedi/jedi/inference/context.py in AbstractContext.py__getattribute__(self, name_or_str, name_context, position, analysis_errors) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.from_sets(cls, sets) | |
420 """ | |
421 Used to work with an iterable of set. | |
422 """ | |
423 aggregated = set() | |
--> 424 for set_ in sets: | |
425 if isinstance(set_, ValueSet): | |
426 aggregated |= set_._set | |
~/dev/jedi/jedi/inference/context.py in <genexpr>(.0) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/names.py in ParamName.infer(self) | |
535 if values: | |
536 return values | |
--> 538 return self.get_executed_param_name().infer() | |
~/dev/jedi/jedi/inference/param.py in ExecutedParamName.infer(self) | |
28 def infer(self): | |
---> 29 return self._lazy_value.infer() | |
~/dev/jedi/jedi/inference/lazy_value.py in LazyTreeValue.infer(self) | |
46 def infer(self): | |
47 with monkeypatch(self.context, 'predefined_names', self._predefined_names): | |
---> 48 return self.context.infer_node(self.data) | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
183 typ = element.type | |
184 if typ in ('name', 'number', 'string', 'atom', 'strings', 'keyword', 'fstring'): | |
--> 185 return infer_atom(context, element) | |
186 elif typ == 'lambdef': | |
187 return ValueSet([FunctionValue.from_context(context, element)]) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_atom(context, atom) | |
303 if _is_annotation_name(atom): | |
304 # Since Python 3.7 (with from __future__ import annotations), | |
305 # annotations are essentially strings and can reference objects | |
306 # that are defined further down in code. Therefore just set the | |
307 # position to None, so the finder will not try to stop at a certain | |
308 # position in the module. | |
309 position = None | |
--> 310 return context.py__getattribute__(atom, position=position) | |
311 elif atom.type == 'keyword': | |
312 # For False/True/None | |
313 if atom.value in ('False', 'True', 'None'): | |
~/dev/jedi/jedi/inference/context.py in AbstractContext.py__getattribute__(self, name_or_str, name_context, position, analysis_errors) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.from_sets(cls, sets) | |
420 """ | |
421 Used to work with an iterable of set. | |
422 """ | |
423 aggregated = set() | |
--> 424 for set_ in sets: | |
425 if isinstance(set_, ValueSet): | |
426 aggregated |= set_._set | |
~/dev/jedi/jedi/inference/context.py in <genexpr>(.0) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/names.py in TreeNameDefinition.infer(self) | |
276 def infer(self): | |
277 # Refactor this, should probably be here. | |
278 from jedi.inference.syntax_tree import tree_name_to_values | |
--> 279 return tree_name_to_values( | |
280 self.parent_context.inference_state, | |
281 self.parent_context, | |
282 self.tree_name | |
283 ) | |
~/dev/jedi/jedi/plugins/__init__.py in _PluginManager.decorate.<locals>.decorator.<locals>.wrapper(*args, **kwargs) | |
19 @wraps(callback) | |
20 def wrapper(*args, **kwargs): | |
---> 21 return built_functions[public_name](*args, **kwargs) | |
~/dev/jedi/jedi/plugins/stdlib.py in tree_name_to_values.<locals>.wrapper(inference_state, context, tree_name) | |
858 if tree_name.value == 'sep' and context.is_module() and context.py__name__() == 'os.path': | |
859 return ValueSet({ | |
860 compiled.create_simple_object(inference_state, os.path.sep), | |
861 }) | |
--> 862 return func(inference_state, context, tree_name) | |
~/dev/jedi/jedi/plugins/django.py in tree_name_to_values.<locals>.wrapper(inference_state, context, tree_name) | |
175 def wrapper(inference_state, context, tree_name): | |
--> 176 result = func(inference_state, context, tree_name) | |
177 if tree_name.value in _FILTER_LIKE_METHODS: | |
178 # Here we try to overwrite stuff like User.objects.filter. We need | |
179 # this to make sure that keyword param completion works on these | |
180 # kind of methods. | |
181 for v in result: | |
~/dev/jedi/jedi/inference/syntax_tree.py in tree_name_to_values(inference_state, context, tree_name) | |
745 types = check_tuple_assignments(n, for_types) | |
746 elif typ == 'expr_stmt': | |
--> 747 types = infer_expr_stmt(context, node, tree_name) | |
748 elif typ == 'with_stmt': | |
749 value_managers = context.infer_node(node.get_test_node_from_name(tree_name)) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_expr_stmt(context, stmt, seek_name) | |
382 if pep0484_values: | |
383 return pep0484_values | |
--> 385 return _infer_expr_stmt(context, stmt, seek_name) | |
386 return NO_VALUES | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_expr_stmt(context, stmt, seek_name) | |
427 if is_annassign or is_setitem: | |
428 # `=` is always the last character in aug assignments -> -1 | |
429 name = stmt.get_defined_names(include_setitem=True)[0].value | |
--> 430 left_values = context.py__getattribute__(name, position=stmt.start_pos) | |
432 if is_setitem: | |
433 def to_mod(v): | |
~/dev/jedi/jedi/inference/context.py in AbstractContext.py__getattribute__(self, name_or_str, name_context, position, analysis_errors) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.from_sets(cls, sets) | |
420 """ | |
421 Used to work with an iterable of set. | |
422 """ | |
423 aggregated = set() | |
--> 424 for set_ in sets: | |
425 if isinstance(set_, ValueSet): | |
426 aggregated |= set_._set | |
~/dev/jedi/jedi/inference/context.py in <genexpr>(.0) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/names.py in TreeNameDefinition.infer(self) | |
276 def infer(self): | |
277 # Refactor this, should probably be here. | |
278 from jedi.inference.syntax_tree import tree_name_to_values | |
--> 279 return tree_name_to_values( | |
280 self.parent_context.inference_state, | |
281 self.parent_context, | |
282 self.tree_name | |
283 ) | |
~/dev/jedi/jedi/plugins/__init__.py in _PluginManager.decorate.<locals>.decorator.<locals>.wrapper(*args, **kwargs) | |
19 @wraps(callback) | |
20 def wrapper(*args, **kwargs): | |
---> 21 return built_functions[public_name](*args, **kwargs) | |
~/dev/jedi/jedi/plugins/stdlib.py in tree_name_to_values.<locals>.wrapper(inference_state, context, tree_name) | |
858 if tree_name.value == 'sep' and context.is_module() and context.py__name__() == 'os.path': | |
859 return ValueSet({ | |
860 compiled.create_simple_object(inference_state, os.path.sep), | |
861 }) | |
--> 862 return func(inference_state, context, tree_name) | |
~/dev/jedi/jedi/plugins/django.py in tree_name_to_values.<locals>.wrapper(inference_state, context, tree_name) | |
175 def wrapper(inference_state, context, tree_name): | |
--> 176 result = func(inference_state, context, tree_name) | |
177 if tree_name.value in _FILTER_LIKE_METHODS: | |
178 # Here we try to overwrite stuff like User.objects.filter. We need | |
179 # this to make sure that keyword param completion works on these | |
180 # kind of methods. | |
181 for v in result: | |
~/dev/jedi/jedi/inference/syntax_tree.py in tree_name_to_values(inference_state, context, tree_name) | |
745 types = check_tuple_assignments(n, for_types) | |
746 elif typ == 'expr_stmt': | |
--> 747 types = infer_expr_stmt(context, node, tree_name) | |
748 elif typ == 'with_stmt': | |
749 value_managers = context.infer_node(node.get_test_node_from_name(tree_name)) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_expr_stmt(context, stmt, seek_name) | |
382 if pep0484_values: | |
383 return pep0484_values | |
--> 385 return _infer_expr_stmt(context, stmt, seek_name) | |
386 return NO_VALUES | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_expr_stmt(context, stmt, seek_name) | |
415 debug.dbg('infer_expr_stmt %s (%s)', stmt, seek_name) | |
416 rhs = stmt.get_rhs() | |
--> 418 value_set = context.infer_node(rhs) | |
420 if seek_name: | |
421 n = TreeNameDefinition(context, seek_name) | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
183 typ = element.type | |
184 if typ in ('name', 'number', 'string', 'atom', 'strings', 'keyword', 'fstring'): | |
--> 185 return infer_atom(context, element) | |
186 elif typ == 'lambdef': | |
187 return ValueSet([FunctionValue.from_context(context, element)]) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_atom(context, atom) | |
303 if _is_annotation_name(atom): | |
304 # Since Python 3.7 (with from __future__ import annotations), | |
305 # annotations are essentially strings and can reference objects | |
306 # that are defined further down in code. Therefore just set the | |
307 # position to None, so the finder will not try to stop at a certain | |
308 # position in the module. | |
309 position = None | |
--> 310 return context.py__getattribute__(atom, position=position) | |
311 elif atom.type == 'keyword': | |
312 # For False/True/None | |
313 if atom.value in ('False', 'True', 'None'): | |
~/dev/jedi/jedi/inference/context.py in AbstractContext.py__getattribute__(self, name_or_str, name_context, position, analysis_errors) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.from_sets(cls, sets) | |
420 """ | |
421 Used to work with an iterable of set. | |
422 """ | |
423 aggregated = set() | |
--> 424 for set_ in sets: | |
425 if isinstance(set_, ValueSet): | |
426 aggregated |= set_._set | |
~/dev/jedi/jedi/inference/context.py in <genexpr>(.0) | |
73 values = found_predefined_types | |
74 else: | |
---> 75 values = ValueSet.from_sets(name.infer() for name in names) | |
77 if not names and not values and analysis_errors: | |
78 if isinstance(name_or_str, Name): | |
~/dev/jedi/jedi/inference/names.py in ParamName.infer(self) | |
535 if values: | |
536 return values | |
--> 538 return self.get_executed_param_name().infer() | |
~/dev/jedi/jedi/inference/param.py in ExecutedParamName.infer(self) | |
28 def infer(self): | |
---> 29 return self._lazy_value.infer() | |
~/dev/jedi/jedi/inference/lazy_value.py in LazyTreeValue.infer(self) | |
46 def infer(self): | |
47 with monkeypatch(self.context, 'predefined_names', self._predefined_names): | |
---> 48 return self.context.infer_node(self.data) | |
~/dev/jedi/jedi/inference/context.py in TreeContextMixin.infer_node(self, node) | |
220 def infer_node(self, node): | |
221 from jedi.inference.syntax_tree import infer_node | |
--> 222 return infer_node(self, node) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_node(context, element) | |
155 return _infer_node(context, element) | |
156 else: | |
--> 157 return _infer_node_if_inferred(context, element) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_if_inferred(context, element) | |
168 if predefined_if_name_dict is not None: | |
169 return _infer_node(context, element) | |
--> 170 return _infer_node_cached(context, element) | |
~/dev/jedi/jedi/inference/cache.py in _memoize_default.<locals>.func.<locals>.wrapper(obj, *args, **kwargs) | |
42 if default is not _NO_DEFAULT: | |
43 memo[key] = default | |
---> 44 rv = function(obj, *args, **kwargs) | |
45 memo[key] = rv | |
46 return rv | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node_cached(context, element) | |
173 @inference_state_method_cache(default=NO_VALUES) | |
174 def _infer_node_cached(context, element): | |
--> 175 return _infer_node(context, element) | |
~/dev/jedi/jedi/debug.py in increase_indent.<locals>.wrapper(*args, **kwargs) | |
80 def wrapper(*args, **kwargs): | |
81 with increase_indent_cm(): | |
---> 82 return func(*args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _limit_value_infers.<locals>.wrapper(context, *args, **kwargs) | |
81 except KeyError: | |
82 inference_state.inferred_element_counts[n] = 1 | |
---> 83 return func(context, *args, **kwargs) | |
~/dev/jedi/jedi/inference/syntax_tree.py in _infer_node(context, element) | |
218 value_set = context.infer_node(element.children[-1]) | |
219 for operator in element.children[:-1]: | |
--> 220 value_set = infer_factor(value_set, operator) | |
221 return value_set | |
222 elif typ == 'test': | |
223 # `x if foo else y` case. | |
~/dev/jedi/jedi/inference/base_value.py in iterator_to_value_set.<locals>.wrapper(*args, **kwargs) | |
550 def wrapper(*args, **kwargs): | |
--> 551 return ValueSet(func(*args, **kwargs)) | |
~/dev/jedi/jedi/inference/base_value.py in ValueSet.__init__(self, iterable) | |
407 def __init__(self, iterable): | |
--> 408 self._set = frozenset(iterable) | |
409 for value in iterable: | |
410 assert not isinstance(value, ValueSet) | |
~/dev/jedi/jedi/inference/syntax_tree.py in infer_factor(value_set, operator) | |
498 if operator == '-': | |
499 if is_number(value): | |
--> 500 yield value.negate() | |
501 elif operator == 'not': | |
502 b = value.py__bool__() | |
~/dev/jedi/jedi/inference/base_value.py in _ValueWrapperBase.__getattr__(self, name) | |
328 def __getattr__(self, name): | |
329 assert name != '_wrapped_value', 'Problem with _get_wrapped_value' | |
--> 330 return getattr(self._wrapped_value, name) | |
AttributeError: 'TreeInstance' object has no attribute 'negate' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment