mirror of
https://github.com/davidhalter/jedi.git
synced 2026-10-21 09:17:05 +08:00
Make separate methods for goto_import and infer_import
This commit is contained in:
1 parent
2fb04db0ab
commit
bf4d42798b
2 files changed
+11
-2
No files matched your search
@@ -57,7 +57,16 @@ class ModuleCache(object):
|
||||
# This memoization is needed, because otherwise we will infinitely loop on
|
||||
# certain imports.
|
||||
@inference_state_method_cache(default=NO_VALUES)
|
||||
def infer_import(context, tree_name, is_goto=False):
|
||||
def infer_import(context, tree_name):
|
||||
return _infer_import(context, tree_name, is_goto=False)
|
||||
|
||||
|
||||
@inference_state_method_cache(default=[])
|
||||
def goto_import(context, tree_name):
|
||||
return _infer_import(context, tree_name, is_goto=True)
|
||||
|
||||
|
||||
def _infer_import(context, tree_name, is_goto=False):
|
||||
module_context = context.get_root_context()
|
||||
import_node = search_ancestor(tree_name, 'import_name', 'import_from')
|
||||
import_path = import_node.get_path_for_name(tree_name)
|
||||
|
||||
Reference in new issue
Block a user