mirror of https://github.com/tqdm/tqdm.git
linting
This commit is contained in:
parent
bdad681aa3
commit
a8317c9268
|
@ -546,7 +546,7 @@ class tqdm(Comparable):
|
|||
'{0}{1} [{2}, {3}{4}]'.format(
|
||||
n_fmt, unit, elapsed_str, rate_fmt, postfix)
|
||||
|
||||
def __new__(cls, *args, **_):
|
||||
def __new__(cls, *_, **__):
|
||||
# Create a new instance
|
||||
instance = object.__new__(cls)
|
||||
# Construct the lock if it does not exist
|
||||
|
|
|
@ -15,18 +15,22 @@ class Time(object):
|
|||
|
||||
@classmethod
|
||||
def reset(cls):
|
||||
"""zeroes internal offset"""
|
||||
cls.offset = 0
|
||||
|
||||
@classmethod
|
||||
def time(cls):
|
||||
"""time.time() + offset"""
|
||||
return time() + cls.offset
|
||||
|
||||
@staticmethod
|
||||
def sleep(dur):
|
||||
"""identical to time.sleep()"""
|
||||
return sleep(dur)
|
||||
|
||||
@classmethod
|
||||
def fake_sleep(cls, dur):
|
||||
"""adds `dur` to internal offset"""
|
||||
cls.offset += dur
|
||||
sleep(0.000001) # sleep to allow interrupt (instead of pass)
|
||||
|
||||
|
|
|
@ -1811,8 +1811,10 @@ def patch_lock(thread=True):
|
|||
raise SkipTest
|
||||
|
||||
def outer(func):
|
||||
"""actual decorator"""
|
||||
@wraps(func)
|
||||
def inner(*args, **kwargs):
|
||||
"""set & reset lock even if exceptions occur"""
|
||||
default_lock = tqdm.get_lock()
|
||||
try:
|
||||
tqdm.set_lock(lock)
|
||||
|
|
Loading…
Reference in New Issue