From b2c6e9e04525707a015f17cf426941a8d05bfb2b Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sat, 19 Jan 2019 23:18:09 +0000 Subject: [PATCH] flake8, .gitignore ipy --- .gitignore | 3 +++ Makefile | 3 ++- tqdm/_tqdm.py | 13 +++++++------ tqdm/_tqdm_gui.py | 3 ++- tqdm/_utils.py | 3 ++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index f42bedc6..6ec8d9ec 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,9 @@ __pycache__ # PyCharm .idea +# IPython +.ipynb_checkpoints + # asv .asv/ benchmarks/*.py[co] diff --git a/Makefile b/Makefile index f9791de8..3e8f24d5 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,8 @@ all: @+make build flake8: - @+flake8 --max-line-length=80 --exclude .asv,.tox -j 8 --count --statistics --exit-zero . + @+flake8 --max-line-length=80 --exclude .asv,.tox,.ipynb_checkpoints \ + -j 8 --count --statistics --exit-zero . test: tox --skip-missing-interpreters diff --git a/tqdm/_tqdm.py b/tqdm/_tqdm.py index b378a1a3..5284ce3e 100755 --- a/tqdm/_tqdm.py +++ b/tqdm/_tqdm.py @@ -79,8 +79,8 @@ class TqdmDefaultWriteLock(object): an argument to joblib or the parallelism lib you use. """ def __init__(self): - # Create global parallelism locks to avoid racing issues with parallel bars - # works only if fork available (Linux/MacOSX, but not Windows) + # Create global parallelism locks to avoid racing issues with parallel + # bars works only if fork available (Linux/MacOSX, but not Windows) self.create_mp_lock() self.create_th_lock() cls = type(self) @@ -210,8 +210,8 @@ class tqdm(Comparable): @staticmethod def ema(x, mu=None, alpha=0.3): """ - Exponential moving average: smoothing to give progressively lower - weights to older values. + Exponential moving average: smoothing to give progressively lower + weights to older values. Parameters ---------- @@ -222,7 +222,7 @@ class tqdm(Comparable): alpha : float, optional Smoothing factor in range [0, 1], [default: 0.3]. Increase to give more weight to recent values. - Ranges from 0 (yields mu) to 1 (yields x). + Ranges from 0 (yields mu) to 1 (yields x). """ return x if mu is None else (alpha * x) + (1 - alpha) * mu @@ -1098,7 +1098,8 @@ Please use `tqdm_gui(...)` instead of `tqdm(..., gui=True)` # EMA (not just overall average) if self.smoothing and delta_t and delta_it: rate = delta_t / delta_it - self.avg_time = self.ema(rate, self.avg_time, self.smoothing) + self.avg_time = self.ema( + rate, self.avg_time, self.smoothing) if not hasattr(self, "sp"): raise TqdmDeprecationWarning("""\ diff --git a/tqdm/_tqdm_gui.py b/tqdm/_tqdm_gui.py index aadd016c..ad46d8bd 100644 --- a/tqdm/_tqdm_gui.py +++ b/tqdm/_tqdm_gui.py @@ -243,7 +243,8 @@ class tqdm_gui(tqdm): # pragma: no cover # EMA (not just overall average) if self.smoothing and delta_t and delta_it: rate = delta_t / delta_it - self.avg_time = self.ema(rate, self.avg_time, self.smoothing) + self.avg_time = self.ema( + rate, self.avg_time, self.smoothing) # Inline due to multiple calls total = self.total diff --git a/tqdm/_utils.py b/tqdm/_utils.py index 63f9b311..8aebc0ef 100644 --- a/tqdm/_utils.py +++ b/tqdm/_utils.py @@ -6,7 +6,8 @@ CUR_OS = _curos() IS_WIN = CUR_OS in ['Windows', 'cli'] IS_NIX = (not IS_WIN) and any( CUR_OS.startswith(i) for i in - ['CYGWIN', 'MSYS', 'Linux', 'Darwin', 'SunOS', 'FreeBSD', 'NetBSD', 'OpenBSD']) + ['CYGWIN', 'MSYS', 'Linux', 'Darwin', 'SunOS', + 'FreeBSD', 'NetBSD', 'OpenBSD']) RE_ANSI = re.compile(r"\x1b\[[;\d]*[A-Za-z]")