Skip to content

Instantly share code, notes, and snippets.

@Carreau
Created February 23, 2017 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Carreau/4ed0987c3671d9cb92cf3b8a29542619 to your computer and use it in GitHub Desktop.
Save Carreau/4ed0987c3671d9cb92cf3b8a29542619 to your computer and use it in GitHub Desktop.
In [12]: jedi.Interpreter('s.dat',[ {'s':s}], line=1, column=5).completions()[0].type
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/Users/bussonniermatthias/dev/jedi/jedi/parser/utils.py in wrapper(self)
37 try:
---> 38 return getattr(self, name)
39 except AttributeError:
AttributeError: 'CompiledName' object has no attribute '_infer'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
/Users/bussonniermatthias/dev/jedi/jedi/evaluate/compiled/__init__.py in wrapper(evaluator, obj, parent_context, module, faked)
554 try:
--> 555 return cache[key][0]
556 except KeyError:
KeyError: (4627923976, 4628903696)
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-12-c2fc8ddc217d> in <module>()
----> 1 jedi.Interpreter('s.dat',[ {'s':s}], line=1, column=5).completions()[0].type
/Users/bussonniermatthias/dev/jedi/jedi/api/classes.py in type(self)
146 for context in self._name.infer():
147 return context.api_type
--> 148 return self._name.api_type
149
150 def _path(self):
/Users/bussonniermatthias/dev/jedi/jedi/evaluate/compiled/__init__.py in api_type(self)
273 @property
274 def api_type(self):
--> 275 return next(iter(self.infer())).api_type
276
277 @underscore_memoization
/Users/bussonniermatthias/dev/jedi/jedi/parser/utils.py in wrapper(self)
38 return getattr(self, name)
39 except AttributeError:
---> 40 result = func(self)
41 if inspect.isgenerator(result):
42 result = list(result)
/Users/bussonniermatthias/dev/jedi/jedi/evaluate/compiled/__init__.py in infer(self)
278 def infer(self):
279 module = self.parent_context.get_root_context()
--> 280 return [_create_from_name(self._evaluator, module, self.parent_context, self.string_name)]
281
282
/Users/bussonniermatthias/dev/jedi/jedi/evaluate/compiled/__init__.py in _create_from_name(evaluator, module, compiled_object, name)
513 # -> just set it to None
514 obj = None
--> 515 return create(evaluator, obj, parent_context=compiled_object, faked=faked)
516
517
/Users/bussonniermatthias/dev/jedi/jedi/evaluate/compiled/__init__.py in wrapper(evaluator, obj, parent_context, module, faked)
556 except KeyError:
557 # TODO this whole decorator is way too ugly
--> 558 result = func(evaluator, obj, parent_context, module, faked)
559 # Need to cache all of them, otherwise the id could be overwritten.
560 cache[key] = result, obj, parent_context, module, faked
/Users/bussonniermatthias/dev/jedi/jedi/evaluate/compiled/__init__.py in create(evaluator, obj, parent_context, module, faked)
580
581 try:
--> 582 faked = fake.get_faked(evaluator, module, obj, parent_context=parent_context)
583 if faked.type == 'funcdef':
584 from jedi.evaluate.representation import FunctionContext
/Users/bussonniermatthias/dev/jedi/jedi/evaluate/compiled/fake.py in get_faked(evaluator, module, obj, name, parent_context)
199 raise FakeDoesNotExist
200
--> 201 faked, fake_module = _get_faked(module and module.obj, obj, name)
202 if module is not None:
203 module.used_names = fake_module.used_names
/Users/bussonniermatthias/dev/jedi/jedi/evaluate/compiled/fake.py in memoizer(*args, **kwargs)
156 key = (obj, args, frozenset(kwargs.items()))
157 try:
--> 158 result = cache[key]
159 except TypeError:
160 return obj(*args, **kwargs)
ValueError: cannot hash writable memoryview object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment