forked from VimPlug/jedi
Remove some more Python 3.5 references
This commit is contained in:
@@ -133,48 +133,6 @@ weakref.ref(1)
|
||||
#? int() None
|
||||
weakref.ref(1)()
|
||||
|
||||
# -----------------
|
||||
# functools
|
||||
# -----------------
|
||||
import functools
|
||||
|
||||
basetwo = functools.partial(int, base=2)
|
||||
#? int()
|
||||
basetwo()
|
||||
|
||||
def function(a, b):
|
||||
return a, b
|
||||
a = functools.partial(function, 0)
|
||||
|
||||
#? int()
|
||||
a('')[0]
|
||||
#? str()
|
||||
a('')[1]
|
||||
|
||||
kw = functools.partial(function, b=1.0)
|
||||
tup = kw(1)
|
||||
#? int()
|
||||
tup[0]
|
||||
#? float()
|
||||
tup[1]
|
||||
|
||||
def my_decorator(f):
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args, **kwds):
|
||||
return f(*args, **kwds)
|
||||
return wrapper
|
||||
|
||||
@my_decorator
|
||||
def example(a):
|
||||
return a
|
||||
|
||||
#? str()
|
||||
example('')
|
||||
|
||||
# From GH #1574
|
||||
#? float()
|
||||
functools.wraps(functools.partial(str, 1))(lambda: 1.0)()
|
||||
|
||||
# -----------------
|
||||
# sqlite3 (#84)
|
||||
# -----------------
|
||||
@@ -386,8 +344,47 @@ X().name
|
||||
X().attr_x.attr_y.value
|
||||
|
||||
# -----------------
|
||||
# functools Python 3.5+
|
||||
# functools
|
||||
# -----------------
|
||||
import functools
|
||||
|
||||
basetwo = functools.partial(int, base=2)
|
||||
#? int()
|
||||
basetwo()
|
||||
|
||||
def function(a, b):
|
||||
return a, b
|
||||
a = functools.partial(function, 0)
|
||||
|
||||
#? int()
|
||||
a('')[0]
|
||||
#? str()
|
||||
a('')[1]
|
||||
|
||||
kw = functools.partial(function, b=1.0)
|
||||
tup = kw(1)
|
||||
#? int()
|
||||
tup[0]
|
||||
#? float()
|
||||
tup[1]
|
||||
|
||||
def my_decorator(f):
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args, **kwds):
|
||||
return f(*args, **kwds)
|
||||
return wrapper
|
||||
|
||||
@my_decorator
|
||||
def example(a):
|
||||
return a
|
||||
|
||||
#? str()
|
||||
example('')
|
||||
|
||||
# From GH #1574
|
||||
#? float()
|
||||
functools.wraps(functools.partial(str, 1))(lambda: 1.0)()
|
||||
|
||||
class X:
|
||||
def function(self, a, b):
|
||||
return a, b
|
||||
@@ -440,11 +437,6 @@ X().just_partial('')[0]
|
||||
#? str()
|
||||
X().just_partial('')[1]
|
||||
|
||||
|
||||
# -----------------
|
||||
# functools Python 3.8
|
||||
# -----------------
|
||||
|
||||
# python >= 3.8
|
||||
|
||||
@functools.lru_cache
|
||||
|
||||
Reference in New Issue
Block a user