forked from VimPlug/jedi
Compare commits
2
Commits
3102215478
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19236b472b | ||
|
|
ef5d361121 |
@@ -66,6 +66,7 @@ Code Contributors
|
||||
- Martin Vielsmaier (@moser) <martin@vielsmaier.net>
|
||||
- TingJia Wu (@WutingjiaX) <wutingjia@bytedance.com>
|
||||
- Nguyễn Hồng Quân <ng.hong.quan@gmail.com>
|
||||
- haoran3160-afk (@haoran3160-afk)
|
||||
|
||||
And a few more "anonymous" contributors.
|
||||
|
||||
|
||||
+1
-1
@@ -831,7 +831,7 @@ class Signature(BaseSignature):
|
||||
def index(self):
|
||||
"""
|
||||
Returns the param index of the current cursor position.
|
||||
Returns None if the index cannot be found in the curent call.
|
||||
Returns None if the index cannot be found in the current call.
|
||||
|
||||
:rtype: int
|
||||
"""
|
||||
|
||||
@@ -125,7 +125,7 @@ class InferenceState:
|
||||
debug.dbg('execute result: %s in %s', value_set, value)
|
||||
return value_set
|
||||
|
||||
# mypy doesn't suppport decorated propeties (https://github.com/python/mypy/issues/1362)
|
||||
# mypy doesn't support decorated properties (https://github.com/python/mypy/issues/1362)
|
||||
@property
|
||||
@inference_state_function_cache()
|
||||
def builtins_module(self):
|
||||
|
||||
@@ -110,7 +110,7 @@ def _check_for_setattr(instance):
|
||||
|
||||
def add_attribute_error(name_context, lookup_value, name):
|
||||
message = ('AttributeError: %s has no attribute %s.' % (lookup_value, name))
|
||||
# Check for __getattr__/__getattribute__ existance and issue a warning
|
||||
# Check for __getattr__/__getattribute__ existence and issue a warning
|
||||
# instead of an error, if that happens.
|
||||
typ = Error
|
||||
if lookup_value.is_instance() and not lookup_value.is_compiled():
|
||||
|
||||
@@ -170,6 +170,8 @@ class AbstractTreeName(AbstractNameDefinition):
|
||||
trailer = par.parent
|
||||
if trailer.type == 'arglist':
|
||||
trailer = trailer.parent
|
||||
if trailer.type == 'error_node':
|
||||
return []
|
||||
if trailer.type != 'classdef':
|
||||
if trailer.type == 'decorator':
|
||||
value_set = context.infer_node(trailer.children[1])
|
||||
|
||||
@@ -224,7 +224,7 @@ class _BaseTreeInstance(AbstractInstanceValue):
|
||||
elif isinstance(f, CompiledValueFilter):
|
||||
yield CompiledInstanceClassFilter(self, f)
|
||||
else:
|
||||
# Propably from the metaclass.
|
||||
# Probably from the metaclass.
|
||||
yield f
|
||||
|
||||
@inference_state_method_cache()
|
||||
|
||||
@@ -231,6 +231,19 @@ def test_goto_follow_imports(Script):
|
||||
assert d.name == 'a'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('prefix', ['', 'def foo(bar): pass\n', 'def f():\n '])
|
||||
@pytest.mark.parametrize('call', ['foo(bar=1', 'foo(bar=1,', 'foo(foo(bar=1'])
|
||||
def test_goto_incomplete_named_argument(Script, prefix, call):
|
||||
code = prefix + call
|
||||
column = code.splitlines()[-1].index('bar')
|
||||
assert Script(code).goto(column=column) == []
|
||||
|
||||
|
||||
def test_goto_named_argument_in_complete_inner_call(Script):
|
||||
param, = Script('def foo(bar): pass\nfoo(foo(bar=1)').goto(2, 8)
|
||||
assert (param.name, param.line, param.column) == ('bar', 1, 8)
|
||||
|
||||
|
||||
def test_goto_module(Script):
|
||||
def check(line, expected, follow_imports=False):
|
||||
script = Script(path=path)
|
||||
|
||||
Reference in New Issue
Block a user