forked from VimPlug/jedi
Cache the subprocess results
This commit is contained in:
@@ -275,6 +275,18 @@ class AccessHandle(object):
|
|||||||
|
|
||||||
#print >> sys.stderr, name
|
#print >> sys.stderr, name
|
||||||
#print('getattr', name, file=sys.stderr)
|
#print('getattr', name, file=sys.stderr)
|
||||||
def compiled_method(*args, **kwargs):
|
return partial(self._workaround, name)
|
||||||
|
|
||||||
|
def _workaround(self, name, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
TODO Currently we're passing slice objects around. This should not
|
||||||
|
happen. They are also the only unhashable objects that we're passing
|
||||||
|
around.
|
||||||
|
"""
|
||||||
|
if args and isinstance(args[0], slice):
|
||||||
return self._subprocess.get_compiled_method_return(self.id, name, *args, **kwargs)
|
return self._subprocess.get_compiled_method_return(self.id, name, *args, **kwargs)
|
||||||
return compiled_method
|
return self._cached_results(name, *args, **kwargs)
|
||||||
|
|
||||||
|
@memoize_method
|
||||||
|
def _cached_results(self, name, *args, **kwargs):
|
||||||
|
return self._subprocess.get_compiled_method_return(self.id, name, *args, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user