mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Fix an issue with partial keyword inputs.
This commit is contained in:
@@ -6,4 +6,4 @@ class partial():
|
|||||||
|
|
||||||
def __call__(self, *args, **kwargs):
|
def __call__(self, *args, **kwargs):
|
||||||
# I know this doesn't work in Python, but in Jedi it does ;-)
|
# I know this doesn't work in Python, but in Jedi it does ;-)
|
||||||
return self.__func(*self.__args, *args, **self.keywords, **kwargs)
|
return self.__func(*self.__args, *args, **self.__keywords, **kwargs)
|
||||||
|
|||||||
@@ -78,15 +78,22 @@ basetwo = functools.partial(int, base=2)
|
|||||||
#? int()
|
#? int()
|
||||||
basetwo()
|
basetwo()
|
||||||
|
|
||||||
def a(a, b):
|
def function(a, b):
|
||||||
return a, b
|
return a, b
|
||||||
a = functools.partial(a, 0)
|
a = functools.partial(function, 0)
|
||||||
|
|
||||||
#? int()
|
#? int()
|
||||||
a('')[0]
|
a('')[0]
|
||||||
#? str()
|
#? str()
|
||||||
a('')[1]
|
a('')[1]
|
||||||
|
|
||||||
|
kw = functools.partial(function, b=1.0)
|
||||||
|
tup = kw(1)
|
||||||
|
#? int()
|
||||||
|
tup[0]
|
||||||
|
#? float()
|
||||||
|
tup[1]
|
||||||
|
|
||||||
def my_decorator(f):
|
def my_decorator(f):
|
||||||
@functools.wraps(f)
|
@functools.wraps(f)
|
||||||
def wrapper(*args, **kwds):
|
def wrapper(*args, **kwds):
|
||||||
|
|||||||
Reference in New Issue
Block a user