mirror of https://github.com/tqdm/tqdm.git
codacy
This commit is contained in:
parent
95107d24bf
commit
715a629bb7
|
@ -24,5 +24,5 @@
|
|||
"benchmark_dir": "benchmarks",
|
||||
"env_dir": ".asv/env",
|
||||
"results_dir": ".asv/results",
|
||||
"html_dir": ".asv/html",
|
||||
"html_dir": ".asv/html"
|
||||
}
|
||||
|
|
|
@ -130,13 +130,13 @@ class Comparable(object):
|
|||
return self._comparable == other._comparable
|
||||
|
||||
def __ne__(self, other):
|
||||
return not (self == other)
|
||||
return not self == other
|
||||
|
||||
def __gt__(self, other):
|
||||
return not (self <= other)
|
||||
return not self <= other
|
||||
|
||||
def __ge__(self, other):
|
||||
return not (self < other)
|
||||
return not self < other
|
||||
|
||||
|
||||
def _is_utf(encoding):
|
||||
|
|
|
@ -24,7 +24,7 @@ def test_main():
|
|||
|
||||
# actual test:
|
||||
|
||||
assert (ls_out in res.replace('\r\n', '\n'))
|
||||
assert ls_out in res.replace('\r\n', '\n')
|
||||
|
||||
# semi-fake test which gets coverage:
|
||||
_SYS = sys.stdin, sys.argv
|
||||
|
@ -49,7 +49,7 @@ def test_main():
|
|||
sys.argv = ['', '--ascii', '--bytes', '--unit_scale', 'False']
|
||||
with closing(UnicodeIO()) as fp:
|
||||
main(fp=fp)
|
||||
assert (str(len(IN_DATA)) in fp.getvalue())
|
||||
assert str(len(IN_DATA)) in fp.getvalue()
|
||||
|
||||
sys.stdin = IN_DATA_LIST
|
||||
sys.argv = ['', '-ascii', '--unit_scale', 'False',
|
||||
|
|
|
@ -172,7 +172,7 @@ def test_iter_overhead():
|
|||
with relative_timer() as time_tqdm:
|
||||
for i in t:
|
||||
a += i
|
||||
assert (a == (total * total - total) / 2.0)
|
||||
assert a == (total * total - total) / 2.0
|
||||
|
||||
a = 0
|
||||
with relative_timer() as time_bench:
|
||||
|
@ -227,7 +227,7 @@ def test_iter_overhead_hard():
|
|||
with relative_timer() as time_tqdm:
|
||||
for i in t:
|
||||
a += i
|
||||
assert (a == (total * total - total) / 2.0)
|
||||
assert a == (total * total - total) / 2.0
|
||||
|
||||
a = 0
|
||||
with relative_timer() as time_bench:
|
||||
|
@ -237,7 +237,7 @@ def test_iter_overhead_hard():
|
|||
|
||||
# Compute relative overhead of tqdm against native range()
|
||||
try:
|
||||
assert (time_tqdm() < 60 * time_bench())
|
||||
assert time_tqdm() < 60 * time_bench()
|
||||
except AssertionError:
|
||||
raise AssertionError('trange(%g): %f, range(%g): %f' %
|
||||
(total, time_tqdm(), total, time_bench()))
|
||||
|
@ -267,7 +267,7 @@ def test_manual_overhead_hard():
|
|||
|
||||
# Compute relative overhead of tqdm against native range()
|
||||
try:
|
||||
assert (time_tqdm() < 100 * time_bench())
|
||||
assert time_tqdm() < 100 * time_bench()
|
||||
except AssertionError:
|
||||
raise AssertionError('tqdm(%g): %f, range(%g): %f' %
|
||||
(total, time_tqdm(), total, time_bench()))
|
||||
|
@ -287,7 +287,7 @@ def test_iter_overhead_simplebar_hard():
|
|||
with relative_timer() as time_tqdm:
|
||||
for i in t:
|
||||
a += i
|
||||
assert (a == (total * total - total) / 2.0)
|
||||
assert a == (total * total - total) / 2.0
|
||||
|
||||
a = 0
|
||||
s = simple_progress(_range(total), file=our_file, leave=True,
|
||||
|
@ -298,7 +298,7 @@ def test_iter_overhead_simplebar_hard():
|
|||
|
||||
# Compute relative overhead of tqdm against native range()
|
||||
try:
|
||||
assert (time_tqdm() < 2.5 * time_bench())
|
||||
assert time_tqdm() < 2.5 * time_bench()
|
||||
except AssertionError:
|
||||
raise AssertionError('trange(%g): %f, simple_progress(%g): %f' %
|
||||
(total, time_tqdm(), total, time_bench()))
|
||||
|
@ -330,7 +330,7 @@ def test_manual_overhead_simplebar_hard():
|
|||
|
||||
# Compute relative overhead of tqdm against native range()
|
||||
try:
|
||||
assert (time_tqdm() < 2.5 * time_bench())
|
||||
assert time_tqdm() < 2.5 * time_bench()
|
||||
except AssertionError:
|
||||
raise AssertionError('tqdm(%g): %f, simple_progress(%g): %f' %
|
||||
(total, time_tqdm(), total, time_bench()))
|
||||
|
|
|
@ -109,7 +109,7 @@ def test_monitoring_and_cleanup():
|
|||
timer.sleep(maxinterval * 2)
|
||||
t.update(2)
|
||||
timeend = timer.time()
|
||||
while not (t.monitor.woken >= timeend):
|
||||
while t.monitor.woken < timeend:
|
||||
timer.sleep(1) # Force monitor to wake up if it woken too soon
|
||||
sleep(0.000001)
|
||||
# Wait for the monitor to get out of sleep's loop and update tqdm..
|
||||
|
|
Loading…
Reference in New Issue