forked from VimPlug/jedi
descriptors are now also working with classes. this means classmethod/staticmethod are now working
This commit is contained in:
@@ -558,8 +558,11 @@ class Execution(Executable):
|
||||
def iterate():
|
||||
# `var_args` is typically an Array, and not a list.
|
||||
for var_arg in self.var_args:
|
||||
# empty var_arg
|
||||
if len(var_arg) == 0:
|
||||
yield None, None
|
||||
# *args
|
||||
if var_arg[0] == '*':
|
||||
elif var_arg[0] == '*':
|
||||
arrays = follow_call_list([var_arg[1:]])
|
||||
for array in arrays:
|
||||
for field in array.get_contents():
|
||||
@@ -958,7 +961,7 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
|
||||
res_new = []
|
||||
#print 'descc', scope, result, name_str
|
||||
for r in result:
|
||||
if isinstance(scope, (Instance)) \
|
||||
if isinstance(scope, (Instance, Class)) \
|
||||
and hasattr(r, 'get_descriptor_return'):
|
||||
# handle descriptors
|
||||
try:
|
||||
@@ -1079,7 +1082,7 @@ def follow_call_list(call_list):
|
||||
result += follow_call_list(call)
|
||||
else:
|
||||
# With things like params, these can also be functions...
|
||||
if isinstance(call, (Function, parsing.Class, Instance)):
|
||||
if isinstance(call, (Function, Class, Instance)):
|
||||
result.append(call)
|
||||
# The string tokens are just operations (+, -, etc.)
|
||||
elif not isinstance(call, str):
|
||||
|
||||
@@ -47,5 +47,5 @@ class classmethod():
|
||||
|
||||
def __get__(self, obj, cls):
|
||||
def _method(*args, **kwargs):
|
||||
self._func(cls, *args, **kwargs)
|
||||
return self._func(cls, *args, **kwargs)
|
||||
return _method
|
||||
|
||||
@@ -236,6 +236,10 @@ class RevealAccess(object):
|
||||
|
||||
class C(object):
|
||||
x = RevealAccess(10, 'var "x"')
|
||||
#? RevealAccess()
|
||||
x
|
||||
#? ['__get__']
|
||||
x.__get__
|
||||
y = 5.0
|
||||
|
||||
m = C()
|
||||
@@ -243,7 +247,7 @@ m = C()
|
||||
m.x
|
||||
#? float()
|
||||
m.y
|
||||
##? int()
|
||||
#? int()
|
||||
C.x
|
||||
|
||||
# -----------------
|
||||
@@ -335,25 +339,25 @@ class E(object):
|
||||
return cls.a
|
||||
|
||||
e = E(1)
|
||||
##? int()
|
||||
#? int()
|
||||
e.f(1)
|
||||
##? int()
|
||||
#? int()
|
||||
E.f(1)
|
||||
##? int()
|
||||
#? int()
|
||||
e.g(1)
|
||||
##? int()
|
||||
#? int()
|
||||
E.g(1)
|
||||
|
||||
##? int()
|
||||
#? int()
|
||||
e.s(1)
|
||||
##? int()
|
||||
#? int()
|
||||
E.s(1)
|
||||
##? int()
|
||||
#? int()
|
||||
e.t(1)
|
||||
##? int()
|
||||
#? int()
|
||||
E.t(1)
|
||||
|
||||
##? str()
|
||||
#? str()
|
||||
e.u(1)
|
||||
##? str()
|
||||
#? str()
|
||||
E.u(1)
|
||||
|
||||
Reference in New Issue
Block a user