mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Fix some collections.deque issues
This commit is contained in:
@@ -49,6 +49,7 @@ class BaseDefinition(object):
|
||||
'posix': 'os',
|
||||
'_io': 'io',
|
||||
'_functools': 'functools',
|
||||
'_collections': 'collections',
|
||||
'_sqlite3': 'sqlite3',
|
||||
'__builtin__': 'builtins',
|
||||
}
|
||||
|
||||
@@ -113,7 +113,6 @@ def _python_to_stub_names(names, fallback_to_python=False):
|
||||
if fallback_to_python or new_name.is_stub():
|
||||
yield new_name
|
||||
continue
|
||||
print(name.goto())
|
||||
|
||||
name_list = name.get_qualified_names()
|
||||
stubs = NO_CONTEXTS
|
||||
|
||||
@@ -227,6 +227,8 @@ def _load_from_typeshed(evaluator, python_context_set, parent_module_context, im
|
||||
map_ = None
|
||||
if len(import_names) == 1:
|
||||
map_ = _cache_stub_file_map(evaluator.grammar.version_info)
|
||||
if import_name == '_collections':
|
||||
import_name = 'collections'
|
||||
elif isinstance(parent_module_context, StubModuleContext):
|
||||
if not parent_module_context.is_package:
|
||||
# Only if it's a package (= a folder) something can be
|
||||
|
||||
@@ -24,8 +24,7 @@ from test.helpers import root_dir
|
||||
['from collections import Counter; Counter()', 'collections.Counter', True, True, {}],
|
||||
['from collections import Counter; Counter.most_common',
|
||||
'collections.Counter.most_common', True, True, {}],
|
||||
#['from collections import deque',
|
||||
#('_collections.deque', 'collections.deque'), True, False, {}],
|
||||
['from collections import deque', 'collections.deque', True, False, {}],
|
||||
|
||||
['from keyword import kwlist; kwlist', 'typing.Sequence', True, True,
|
||||
{'full_name': 'keyword.kwlist'}],
|
||||
@@ -43,10 +42,6 @@ def test_infer_and_goto(Script, code, full_name, has_stub, has_python, way,
|
||||
s = Script(code, _project=project)
|
||||
prefer_stubs = kwargs['prefer_stubs']
|
||||
only_stubs = kwargs['only_stubs']
|
||||
if isinstance(full_name, tuple):
|
||||
# Small hack to make it possible to test some special cases.
|
||||
should_land_on_stub = has_stub and (only_stubs or prefer_stubs)
|
||||
full_name = full_name[should_land_on_stub]
|
||||
|
||||
if type_ == 'goto':
|
||||
full_name = goto_changes.get('full_name', full_name)
|
||||
|
||||
Reference in New Issue
Block a user