1
0
forked from VimPlug/jedi

infer_state -> inference_state

This commit is contained in:
Dave Halter
2019-08-16 11:44:30 +02:00
parent fffb39227e
commit 03920502c4
60 changed files with 727 additions and 727 deletions

View File

@@ -109,8 +109,8 @@ def compiled_objects_cache(attribute_name):
Caching the id has the advantage that an object doesn't need to be
hashable.
"""
def wrapper(infer_state, obj, parent_context=None):
cache = getattr(infer_state, attribute_name)
def wrapper(inference_state, obj, parent_context=None):
cache = getattr(inference_state, attribute_name)
# Do a very cheap form of caching here.
key = id(obj)
try:
@@ -119,9 +119,9 @@ def compiled_objects_cache(attribute_name):
except KeyError:
# TODO wuaaaarrghhhhhhhh
if attribute_name == 'mixed_cache':
result = func(infer_state, obj, parent_context)
result = func(inference_state, obj, parent_context)
else:
result = func(infer_state, obj)
result = func(inference_state, obj)
# Need to cache all of them, otherwise the id could be overwritten.
cache[key] = result, obj, parent_context
return result
@@ -130,11 +130,11 @@ def compiled_objects_cache(attribute_name):
return decorator
def create_access(infer_state, obj):
return infer_state.compiled_subprocess.get_or_create_access_handle(obj)
def create_access(inference_state, obj):
return inference_state.compiled_subprocess.get_or_create_access_handle(obj)
def load_module(infer_state, dotted_name, sys_path):
def load_module(inference_state, dotted_name, sys_path):
temp, sys.path = sys.path, sys_path
try:
__import__(dotted_name)
@@ -154,7 +154,7 @@ def load_module(infer_state, dotted_name, sys_path):
# Just access the cache after import, because of #59 as well as the very
# complicated import structure of Python.
module = sys.modules[dotted_name]
return create_access_path(infer_state, module)
return create_access_path(inference_state, module)
class AccessPath(object):
@@ -171,8 +171,8 @@ class AccessPath(object):
self.accesses = value
def create_access_path(infer_state, obj):
access = create_access(infer_state, obj)
def create_access_path(inference_state, obj):
access = create_access(inference_state, obj)
return AccessPath(access.get_access_path_tuples())
@@ -193,18 +193,18 @@ def get_api_type(obj):
class DirectObjectAccess(object):
def __init__(self, infer_state, obj):
self._infer_state = infer_state
def __init__(self, inference_state, obj):
self._inference_state = inference_state
self._obj = obj
def __repr__(self):
return '%s(%s)' % (self.__class__.__name__, self.get_repr())
def _create_access(self, obj):
return create_access(self._infer_state, obj)
return create_access(self._inference_state, obj)
def _create_access_path(self, obj):
return create_access_path(self._infer_state, obj)
return create_access_path(self._inference_state, obj)
def py__bool__(self):
return bool(self._obj)
@@ -376,7 +376,7 @@ class DirectObjectAccess(object):
return get_api_type(self._obj)
def get_access_path_tuples(self):
accesses = [create_access(self._infer_state, o) for o in self._get_objects_path()]
accesses = [create_access(self._inference_state, o) for o in self._get_objects_path()]
return [(access.py__name__(), access) for access in accesses]
def _get_objects_path(self):