Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-tqdm for openSUSE:Factory checked in at 2024-05-08 11:38:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-tqdm (Old) and /work/SRC/openSUSE:Factory/.python-tqdm.new.1880 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-tqdm" Wed May 8 11:38:38 2024 rev:58 rq:1172287 version:4.66.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-tqdm/python-tqdm.changes 2023-11-26 19:36:24.336188594 +0100 +++ /work/SRC/openSUSE:Factory/.python-tqdm.new.1880/python-tqdm.changes 2024-05-08 11:38:49.546792521 +0200 @@ -1,0 +2,13 @@ +Tue May 7 01:37:49 UTC 2024 - Steve Kowalik <[email protected]> + +- Update to 4.66.4: + * rich: fix completion (#1395 <- #1306) + * cli: eval safety (CVE-2024-34062, bsc#1223880) + * pandas: add DataFrame.progress_map (#1549) + * notebook: fix HTML padding (#1506) + * keras: fix resuming training when verbose>=2 (#1508) + * fix format_num negative fractions missing leading zero (#1548) + * fix Python 3.12 DeprecationWarning on import (#1519) +- Drop patch sprinkle-in-timezone.patch: Included upstream. + +------------------------------------------------------------------- Old: ---- sprinkle-in-timezone.patch tqdm-4.66.1.tar.gz New: ---- tqdm-4.66.4.tar.gz BETA DEBUG BEGIN: Old: * fix Python 3.12 DeprecationWarning on import (#1519) - Drop patch sprinkle-in-timezone.patch: Included upstream. BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-tqdm.spec ++++++ --- /var/tmp/diff_new_pack.NQnxkZ/_old 2024-05-08 11:38:51.690870492 +0200 +++ /var/tmp/diff_new_pack.NQnxkZ/_new 2024-05-08 11:38:51.690870492 +0200 @@ -1,7 +1,7 @@ # -# spec file +# spec file for package python-tqdm # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -28,14 +28,12 @@ %endif %{?sle15_python_module_pythons} Name: python-tqdm%{pkg_suffix} -Version: 4.66.1 +Version: 4.66.4 Release: 0 Summary: An extensible progress meter License: MIT AND MPL-2.0 URL: https://github.com/tqdm/tqdm Source: https://files.pythonhosted.org/packages/source/t/tqdm/tqdm-%{version}.tar.gz -# PATCH-FIX-UPSTREAM gh#tqdm/tqdm#1519 Specify a timezone for fromtimestamp() -Patch0: sprinkle-in-timezone.patch BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools_scm} @@ -45,7 +43,7 @@ BuildRequires: fdupes BuildRequires: python-rpm-macros Requires(post): update-alternatives -Requires(postun):update-alternatives +Requires(postun): update-alternatives Enhances: python-ipython BuildArch: noarch %if %{with test} ++++++ tqdm-4.66.1.tar.gz -> tqdm-4.66.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/.pre-commit-config.yaml new/tqdm-4.66.4/.pre-commit-config.yaml --- old/tqdm-4.66.1/.pre-commit-config.yaml 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/.pre-commit-config.yaml 2024-05-03 00:41:32.000000000 +0200 @@ -2,7 +2,7 @@ python: python3 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -39,7 +39,7 @@ - pytest-timeout - pytest-asyncio - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 args: [-j8] @@ -52,11 +52,11 @@ - flake8-pyproject - flake8-string-format - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/kynan/nbstripout - rev: 0.6.1 + rev: 0.7.1 hooks: - id: nbstripout args: [--keep-count, --keep-output] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/DEMO.ipynb new/tqdm-4.66.4/DEMO.ipynb --- old/tqdm-4.66.1/DEMO.ipynb 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/DEMO.ipynb 2024-05-03 00:41:32.000000000 +0200 @@ -413,7 +413,7 @@ " \"\"\"Provides a `total_time` format parameter\"\"\"\n", " @property\n", " def format_dict(self):\n", - " d = super(TqdmExtraFormat, self).format_dict\n", + " d = super().format_dict\n", " total_time = d[\"elapsed\"] * (d[\"total\"] or 0) / max(d[\"n\"], 1)\n", " d.update(total_time=self.format_interval(total_time) + \" in total\")\n", " return d\n", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/LICENCE new/tqdm-4.66.4/LICENCE --- old/tqdm-4.66.1/LICENCE 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/LICENCE 2024-05-03 00:41:32.000000000 +0200 @@ -7,7 +7,7 @@ in reverse chronological order: * files: * - MPL-2.0 2015-2023 (c) Casper da Costa-Luis + MPL-2.0 2015-2024 (c) Casper da Costa-Luis [casperdcl](https://github.com/casperdcl). * files: tqdm/_tqdm.py MIT 2016 (c) [PR #96] on behalf of Google Inc. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/Makefile new/tqdm-4.66.4/Makefile --- old/tqdm-4.66.1/Makefile 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/Makefile 2024-05-03 00:41:32.000000000 +0200 @@ -137,9 +137,9 @@ @+python -c "import os, glob; [os.remove(i) for i in glob.glob('*.py[co]')]" @+python -c "import os, glob; [os.remove(i) for i in glob.glob('tests/*.py[co]')]" @+python -c "import os, glob; [os.remove(i) for i in glob.glob('benchmarks/*.py[co]')]" + @+python -c "import os, glob; [os.remove(i) for i in glob.glob('examples/*.py[co]')]" @+python -c "import os, glob; [os.remove(i) for i in glob.glob('tqdm/*.py[co]')]" @+python -c "import os, glob; [os.remove(i) for i in glob.glob('tqdm/contrib/*.py[co]')]" - @+python -c "import os, glob; [os.remove(i) for i in glob.glob('tqdm/examples/*.py[co]')]" toxclean: @+python -c "import shutil; shutil.rmtree('.tox', True)" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/PKG-INFO new/tqdm-4.66.4/PKG-INFO --- old/tqdm-4.66.1/PKG-INFO 2023-08-10 13:38:37.229219200 +0200 +++ new/tqdm-4.66.4/PKG-INFO 2024-05-03 00:41:59.899034700 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: tqdm -Version: 4.66.1 +Version: 4.66.4 Summary: Fast, Extensible Progress Meter Maintainer-email: tqdm developers <[email protected]> License: MPL-2.0 AND MIT @@ -65,11 +65,19 @@ Classifier: Topic :: Utilities Requires-Python: >=3.7 Description-Content-Type: text/x-rst +License-File: LICENCE +Requires-Dist: colorama; platform_system == "Windows" Provides-Extra: dev +Requires-Dist: pytest>=6; extra == "dev" +Requires-Dist: pytest-cov; extra == "dev" +Requires-Dist: pytest-timeout; extra == "dev" +Requires-Dist: pytest-xdist; extra == "dev" Provides-Extra: slack +Requires-Dist: slack-sdk; extra == "slack" Provides-Extra: telegram +Requires-Dist: requests; extra == "telegram" Provides-Extra: notebook -License-File: LICENCE +Requires-Dist: ipywidgets>=6; extra == "notebook" |Logo| @@ -839,7 +847,7 @@ """Provides a `total_time` format parameter""" @property def format_dict(self): - d = super(TqdmExtraFormat, self).format_dict + d = super().format_dict total_time = d["elapsed"] * (d["total"] or 0) / max(d["n"], 1) d.update(total_time=self.format_interval(total_time) + " in total") return d @@ -903,7 +911,7 @@ def progresser(n): interval = 0.001 / (n + 2) total = 5000 - text = "#{}, est. {:<04.2}s".format(n, interval * total) + text = f"#{n}, est. {interval * total:<04.2}s" for _ in trange(total, desc=text, position=n): sleep(interval) @@ -926,7 +934,7 @@ def progresser(n): interval = 0.001 / (n + 2) total = 5000 - text = "#{}, est. {:<04.2}s".format(n, interval * total) + text = f"#{n}, est. {interval * total:<04.2}s" for _ in trange(total, desc=text): sleep(interval) if n == 6: @@ -1055,7 +1063,7 @@ class TqdmExt(std_tqdm): def update(self, n=1): - displayed = super(TqdmExt, self).update(n) + displayed = super().update(n) if displayed: external_callback(**self.format_dict) return displayed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/README.rst new/tqdm-4.66.4/README.rst --- old/tqdm-4.66.1/README.rst 2023-08-10 13:38:26.000000000 +0200 +++ new/tqdm-4.66.4/README.rst 2024-05-03 00:41:56.000000000 +0200 @@ -766,7 +766,7 @@ """Provides a `total_time` format parameter""" @property def format_dict(self): - d = super(TqdmExtraFormat, self).format_dict + d = super().format_dict total_time = d["elapsed"] * (d["total"] or 0) / max(d["n"], 1) d.update(total_time=self.format_interval(total_time) + " in total") return d @@ -830,7 +830,7 @@ def progresser(n): interval = 0.001 / (n + 2) total = 5000 - text = "#{}, est. {:<04.2}s".format(n, interval * total) + text = f"#{n}, est. {interval * total:<04.2}s" for _ in trange(total, desc=text, position=n): sleep(interval) @@ -853,7 +853,7 @@ def progresser(n): interval = 0.001 / (n + 2) total = 5000 - text = "#{}, est. {:<04.2}s".format(n, interval * total) + text = f"#{n}, est. {interval * total:<04.2}s" for _ in trange(total, desc=text): sleep(interval) if n == 6: @@ -982,7 +982,7 @@ class TqdmExt(std_tqdm): def update(self, n=1): - displayed = super(TqdmExt, self).update(n) + displayed = super().update(n) if displayed: external_callback(**self.format_dict) return displayed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/environment.yml new/tqdm-4.66.4/environment.yml --- old/tqdm-4.66.1/environment.yml 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/environment.yml 2024-05-03 00:41:32.000000000 +0200 @@ -28,6 +28,7 @@ - matplotlib # gui - numpy # pandas, keras, contrib.tenumerate - pandas +- pyarrow # pandas - tensorflow # keras - slack-sdk # contrib.slack - requests # contrib.telegram diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tests/tests_keras.py new/tqdm-4.66.4/tests/tests_keras.py --- old/tqdm-4.66.1/tests/tests_keras.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tests/tests_keras.py 2024-05-03 00:41:32.000000000 +0200 @@ -39,8 +39,8 @@ verbose=0)]) _, res = capsys.readouterr() assert "training: " in res - assert "{epochs}/{epochs}".format(epochs=epochs) in res - assert "{batches}/{batches}".format(batches=batches) not in res + assert f"{epochs}/{epochs}" in res + assert f"{batches}/{batches}" not in res # full (epoch and batch) progress model.fit( @@ -58,8 +58,8 @@ verbose=2)]) _, res = capsys.readouterr() assert "training: " in res - assert "{epochs}/{epochs}".format(epochs=epochs) in res - assert "{batches}/{batches}".format(batches=batches) in res + assert f"{epochs}/{epochs}" in res + assert f"{batches}/{batches}" in res # auto-detect epochs and batches model.fit( @@ -71,8 +71,8 @@ callbacks=[TqdmCallback(desc="training", verbose=2)]) _, res = capsys.readouterr() assert "training: " in res - assert "{epochs}/{epochs}".format(epochs=epochs) in res - assert "{batches}/{batches}".format(batches=batches) in res + assert f"{epochs}/{epochs}" in res + assert f"{batches}/{batches}" in res # continue training (start from epoch != 0) initial_epoch = 3 @@ -87,5 +87,5 @@ miniters=1, mininterval=0, maxinterval=0)]) _, res = capsys.readouterr() assert "training: " in res - assert "{epochs}/{epochs}".format(epochs=initial_epoch - 1) not in res - assert "{epochs}/{epochs}".format(epochs=epochs) in res + assert f"{initial_epoch - 1}/{initial_epoch - 1}" not in res + assert f"{epochs}/{epochs}" in res diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tests/tests_pandas.py new/tqdm-4.66.4/tests/tests_pandas.py --- old/tqdm-4.66.1/tests/tests_pandas.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tests/tests_pandas.py 2024-05-03 00:41:32.000000000 +0200 @@ -4,6 +4,7 @@ pytestmark = mark.slow +np = importorskip('numpy') random = importorskip('numpy.random') rand = random.rand randint = random.randint @@ -66,6 +67,7 @@ f"\nExpected:\n{exres} at least twice.\nIn:\n{our_file.read()}\n") [email protected]("ignore:DataFrame.applymap has been deprecated:FutureWarning") def test_pandas_data_frame(): """Test pandas.DataFrame.progress_apply and .progress_applymap""" with closing(StringIO()) as our_file: @@ -80,6 +82,12 @@ res2 = df.applymap(task_func) assert res1.equals(res2) + # map + if hasattr(df, 'map'): # pandas>=2.1.0 + res1 = df.progress_map(task_func) + res2 = df.map(task_func) + assert res1.equals(res2) + # apply unhashable res1 = [] df.progress_apply(res1.extend) @@ -107,6 +115,8 @@ f"\nExpected:\n{exres} at least once.\nIn:\n{our_file.read()}\n") [email protected]( + "ignore:DataFrameGroupBy.apply operated on the grouping columns:DeprecationWarning") def test_pandas_groupby_apply(): """Test pandas.DataFrame.groupby(...).progress_apply""" with closing(StringIO()) as our_file: @@ -119,8 +129,8 @@ dfs.groupby(['a']).progress_apply(lambda x: None) df2 = df = pd.DataFrame({'a': randint(1, 8, 10000), 'b': rand(10000)}) - res1 = df2.groupby("a").apply(max) - res2 = df2.groupby("a").progress_apply(max) + res1 = df2.groupby("a").apply(np.maximum.reduce) + res2 = df2.groupby("a").progress_apply(np.maximum.reduce) assert res1.equals(res2) our_file.seek(0) @@ -139,11 +149,11 @@ dfs.loc[0] = [2, 1, 1] dfs['d'] = 100 - expects = ['500/500', '1/1', '4/4', '2/2'] + expects = ['500/500', '1/1', '4/4', '4/4'] dfs.groupby(dfs.index).progress_apply(lambda x: None) dfs.groupby('d').progress_apply(lambda x: None) - dfs.groupby(dfs.columns, axis=1).progress_apply(lambda x: None) - dfs.groupby([2, 2, 1, 1], axis=1).progress_apply(lambda x: None) + dfs.T.groupby(dfs.columns).progress_apply(lambda x: None) + dfs.T.groupby([2, 2, 1, 1]).progress_apply(lambda x: None) our_file.seek(0) if our_file.read().count('100%') < 4: @@ -159,6 +169,8 @@ f"\nExpected:\n{exres} at least once.\nIn:\n{our_file.read()}\n") [email protected]( + "ignore:DataFrameGroupBy.apply operated on the grouping columns:DeprecationWarning") def test_pandas_leave(): """Test pandas with `leave=True`""" with closing(StringIO()) as our_file: @@ -193,6 +205,8 @@ "keyword arguments instead")) [email protected]( + "ignore:DataFrameGroupBy.apply operated on the grouping columns:DeprecationWarning") def test_pandas_deprecation(): """Test bar object instance as argument deprecation""" try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tests/tests_perf.py new/tqdm-4.66.4/tests/tests_perf.py --- old/tqdm-4.66.1/tests/tests_perf.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tests/tests_perf.py 2024-05-03 00:41:32.000000000 +0200 @@ -96,10 +96,7 @@ def format_interval(t): mins, s = divmod(int(t), 60) h, m = divmod(mins, 60) - if h: - return '{0:d}:{1:02d}:{2:02d}'.format(h, m, s) - else: - return '{0:02d}:{1:02d}'.format(m, s) + return f'{h:d}:{m:02d}:{s:02d}' if h else f'{m:02d}:{s:02d}' def update_and_print(i=1): n[0] += i @@ -141,20 +138,15 @@ update_and_print(0) if iterable is not None: return update_and_yield() - else: - return update_and_print + return update_and_print def assert_performance(thresh, name_left, time_left, name_right, time_right): """raises if time_left > thresh * time_right""" if time_left > thresh * time_right: raise ValueError( - ('{name[0]}: {time[0]:f}, ' - '{name[1]}: {time[1]:f}, ' - 'ratio {ratio:f} > {thresh:f}').format( - name=(name_left, name_right), - time=(time_left, time_right), - ratio=time_left / time_right, thresh=thresh)) + f'{name_left}: {time_left:f}, {name_right}: {time_right:f}' + f', ratio {time_left / time_right:f} > {thresh:f}') @retry_on_except() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tests/tests_tqdm.py new/tqdm-4.66.4/tests/tests_tqdm.py --- old/tqdm-4.66.1/tests/tests_tqdm.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tests/tests_tqdm.py 2024-05-03 00:41:32.000000000 +0200 @@ -107,7 +107,7 @@ class UnicodeIO(IOBase): """Unicode version of StringIO""" def __init__(self, *args, **kwargs): - super(UnicodeIO, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.encoding = 'U8' # io.StringIO supports unicode, but no encoding self.text = '' self.cursor = 0 @@ -189,6 +189,8 @@ assert float(format_num(1337)) == 1337 assert format_num(int(1e6)) == '1e+6' assert format_num(1239876) == '1' '239' '876' + assert format_num(0.00001234) == '1.23e-5' + assert format_num(-0.1234) == '-0.123' def test_format_meter(): @@ -315,11 +317,11 @@ def test_bar_formatspec(): """Test Bar.__format__ spec""" - assert "{0:5a}".format(Bar(0.3)) == "#5 " - assert "{0:2}".format(Bar(0.5, charset=" .oO0")) == "0 " - assert "{0:2a}".format(Bar(0.5, charset=" .oO0")) == "# " - assert "{0:-6a}".format(Bar(0.5, 10)) == '## ' - assert "{0:2b}".format(Bar(0.5, 10)) == ' ' + assert f"{Bar(0.3):5a}" == "#5 " + assert f"{Bar(0.5, charset=' .oO0'):2}" == "0 " + assert f"{Bar(0.5, charset=' .oO0'):2a}" == "# " + assert f"{Bar(0.5, 10):-6a}" == '## ' + assert f"{Bar(0.5, 10):2b}" == ' ' def test_all_defaults(): @@ -340,7 +342,7 @@ class WriteTypeChecker(BytesIO): """File-like to assert the expected type is written""" def __init__(self, expected_type): - super(WriteTypeChecker, self).__init__() + super().__init__() self.expected_type = expected_type def write(self, s): @@ -1093,7 +1095,7 @@ """Provides a `total_time` format parameter""" @property def format_dict(self): - d = super(TqdmExtraFormat, self).format_dict + d = super().format_dict total_time = d["elapsed"] * (d["total"] or 0) / max(d["n"], 1) d.update(total_time=self.format_interval(total_time) + " in total") return d @@ -1113,7 +1115,7 @@ bar_format='{l_bar}{eta:%Y-%m-%d}'): pass _, err = capsys.readouterr() - assert "\r100%|{eta:%Y-%m-%d}\n".format(eta=dt.now()) in err + assert f"\r100%|{dt.now():%Y-%m-%d}\n" in err def test_unpause(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/_dist_ver.py new/tqdm-4.66.4/tqdm/_dist_ver.py --- old/tqdm-4.66.1/tqdm/_dist_ver.py 2023-08-10 13:38:37.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/_dist_ver.py 2024-05-03 00:41:59.000000000 +0200 @@ -1 +1 @@ -__version__ = '4.66.1' +__version__ = '4.66.4' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/asyncio.py new/tqdm-4.66.4/tqdm/asyncio.py --- old/tqdm-4.66.1/tqdm/asyncio.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/asyncio.py 2024-05-03 00:41:32.000000000 +0200 @@ -21,7 +21,7 @@ Asynchronous-friendly version of tqdm. """ def __init__(self, iterable=None, *args, **kwargs): - super(tqdm_asyncio, self).__init__(iterable, *args, **kwargs) + super().__init__(iterable, *args, **kwargs) self.iterable_awaitable = False if iterable is not None: if hasattr(iterable, "__anext__"): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/cli.py new/tqdm-4.66.4/tqdm/cli.py --- old/tqdm-4.66.1/tqdm/cli.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/cli.py 2024-05-03 00:41:32.000000000 +0200 @@ -21,23 +21,34 @@ return cast(val, t) except TqdmTypeError: pass - raise TqdmTypeError(val + ' : ' + typ) + raise TqdmTypeError(f"{val} : {typ}") # sys.stderr.write('\ndebug | `val:type`: `' + val + ':' + typ + '`.\n') if typ == 'bool': if (val == 'True') or (val == ''): return True - elif val == 'False': + if val == 'False': return False - else: - raise TqdmTypeError(val + ' : ' + typ) - try: - return eval(typ + '("' + val + '")') - except Exception: - if typ == 'chr': - return chr(ord(eval('"' + val + '"'))).encode() - else: - raise TqdmTypeError(val + ' : ' + typ) + raise TqdmTypeError(val + ' : ' + typ) + if typ == 'chr': + if len(val) == 1: + return val.encode() + if re.match(r"^\\\w+$", val): + return eval(f'"{val}"').encode() + raise TqdmTypeError(f"{val} : {typ}") + if typ == 'str': + return val + if typ == 'int': + try: + return int(val) + except ValueError as exc: + raise TqdmTypeError(f"{val} : {typ}") from exc + if typ == 'float': + try: + return float(val) + except ValueError as exc: + raise TqdmTypeError(f"{val} : {typ}") from exc + raise TqdmTypeError(f"{val} : {typ}") def posix_pipe(fin, fout, delim=b'\\n', buf_size=256, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/contrib/__init__.py new/tqdm-4.66.4/tqdm/contrib/__init__.py --- old/tqdm-4.66.1/tqdm/contrib/__init__.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/contrib/__init__.py 2024-05-03 00:41:32.000000000 +0200 @@ -17,7 +17,7 @@ """Dummy file-like that will write to tqdm""" def __init__(self, wrapped): - super(DummyTqdmFile, self).__init__(wrapped) + super().__init__(wrapped) self._buf = [] def write(self, x, nolock=False): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/contrib/discord.py new/tqdm-4.66.4/tqdm/contrib/discord.py --- old/tqdm-4.66.1/tqdm/contrib/discord.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/contrib/discord.py 2024-05-03 00:41:32.000000000 +0200 @@ -27,7 +27,7 @@ """Non-blocking file-like IO using a Discord Bot.""" def __init__(self, token, channel_id): """Creates a new message in the given `channel_id`.""" - super(DiscordIO, self).__init__() + super().__init__() config = ClientConfig() config.token = token client = Client(config) @@ -91,10 +91,10 @@ kwargs.pop('token', getenv("TQDM_DISCORD_TOKEN")), kwargs.pop('channel_id', getenv("TQDM_DISCORD_CHANNEL_ID"))) kwargs['mininterval'] = max(1.5, kwargs.get('mininterval', 1.5)) - super(tqdm_discord, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def display(self, **kwargs): - super(tqdm_discord, self).display(**kwargs) + super().display(**kwargs) fmt = self.format_dict if fmt.get('bar_format', None): fmt['bar_format'] = fmt['bar_format'].replace( @@ -104,7 +104,7 @@ self.dio.write(self.format_meter(**fmt)) def clear(self, *args, **kwargs): - super(tqdm_discord, self).clear(*args, **kwargs) + super().clear(*args, **kwargs) if not self.disable: self.dio.write("") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/contrib/logging.py new/tqdm-4.66.4/tqdm/contrib/logging.py --- old/tqdm-4.66.1/tqdm/contrib/logging.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/contrib/logging.py 2024-05-03 00:41:32.000000000 +0200 @@ -18,7 +18,7 @@ self, tqdm_class=std_tqdm # type: Type[std_tqdm] ): - super(_TqdmLoggingHandler, self).__init__() + super().__init__() self.tqdm_class = tqdm_class def emit(self, record): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/contrib/slack.py new/tqdm-4.66.4/tqdm/contrib/slack.py --- old/tqdm-4.66.1/tqdm/contrib/slack.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/contrib/slack.py 2024-05-03 00:41:32.000000000 +0200 @@ -27,7 +27,7 @@ """Non-blocking file-like IO using a Slack app.""" def __init__(self, token, channel): """Creates a new message in the given `channel`.""" - super(SlackIO, self).__init__() + super().__init__() self.client = WebClient(token=token) self.text = self.__class__.__name__ try: @@ -88,10 +88,10 @@ kwargs.pop('token', getenv("TQDM_SLACK_TOKEN")), kwargs.pop('channel', getenv("TQDM_SLACK_CHANNEL"))) kwargs['mininterval'] = max(1.5, kwargs.get('mininterval', 1.5)) - super(tqdm_slack, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def display(self, **kwargs): - super(tqdm_slack, self).display(**kwargs) + super().display(**kwargs) fmt = self.format_dict if fmt.get('bar_format', None): fmt['bar_format'] = fmt['bar_format'].replace( @@ -105,7 +105,7 @@ self.sio.write(self.format_meter(**fmt)) def clear(self, *args, **kwargs): - super(tqdm_slack, self).clear(*args, **kwargs) + super().clear(*args, **kwargs) if not self.disable: self.sio.write("") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/contrib/telegram.py new/tqdm-4.66.4/tqdm/contrib/telegram.py --- old/tqdm-4.66.1/tqdm/contrib/telegram.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/contrib/telegram.py 2024-05-03 00:41:32.000000000 +0200 @@ -27,7 +27,7 @@ def __init__(self, token, chat_id): """Creates a new message in the given `chat_id`.""" - super(TelegramIO, self).__init__() + super().__init__() self.token = token self.chat_id = chat_id self.session = Session() @@ -118,10 +118,10 @@ self.tgio = TelegramIO( kwargs.pop('token', getenv('TQDM_TELEGRAM_TOKEN')), kwargs.pop('chat_id', getenv('TQDM_TELEGRAM_CHAT_ID'))) - super(tqdm_telegram, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def display(self, **kwargs): - super(tqdm_telegram, self).display(**kwargs) + super().display(**kwargs) fmt = self.format_dict if fmt.get('bar_format', None): fmt['bar_format'] = fmt['bar_format'].replace( @@ -131,14 +131,14 @@ self.tgio.write(self.format_meter(**fmt)) def clear(self, *args, **kwargs): - super(tqdm_telegram, self).clear(*args, **kwargs) + super().clear(*args, **kwargs) if not self.disable: self.tgio.write("") def close(self): if self.disable: return - super(tqdm_telegram, self).close() + super().close() if not (self.leave or (self.leave is None and self.pos == 0)): self.tgio.delete() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/dask.py new/tqdm-4.66.4/tqdm/dask.py --- old/tqdm-4.66.1/tqdm/dask.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/dask.py 2024-05-03 00:41:32.000000000 +0200 @@ -20,7 +20,7 @@ tqdm_kwargs : optional Any other arguments used for all bars. """ - super(TqdmCallback, self).__init__(start=start, pretask=pretask) + super().__init__(start=start, pretask=pretask) if tqdm_kwargs: tqdm_class = partial(tqdm_class, **tqdm_kwargs) self.tqdm_class = tqdm_class diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/gui.py new/tqdm-4.66.4/tqdm/gui.py --- old/tqdm-4.66.1/tqdm/gui.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/gui.py 2024-05-03 00:41:32.000000000 +0200 @@ -32,7 +32,7 @@ kwargs = kwargs.copy() kwargs['gui'] = True colour = kwargs.pop('colour', 'g') - super(tqdm_gui, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if self.disable: return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/keras.py new/tqdm-4.66.4/tqdm/keras.py --- old/tqdm-4.66.1/tqdm/keras.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/keras.py 2024-05-03 00:41:32.000000000 +0200 @@ -94,7 +94,7 @@ raise KeyError('Unknown verbosity') def on_train_end(self, *_, **__): - if self.verbose: + if hasattr(self, 'batch_bar'): self.batch_bar.close() self.epoch_bar.close() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/notebook.py new/tqdm-4.66.4/tqdm/notebook.py --- old/tqdm-4.66.1/tqdm/notebook.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/notebook.py 2024-05-03 00:41:32.000000000 +0200 @@ -80,7 +80,7 @@ def __repr__(self, pretty=False): pbar = getattr(self, 'pbar', None) if pbar is None: - return super(TqdmHBox, self).__repr__() + return super().__repr__() return pbar.format_meter(**self._json_(pretty)) def _repr_pretty_(self, pp, *_, **__): @@ -157,6 +157,7 @@ pbar.value = self.n if msg: + msg = msg.replace(' ', u'\u2007') # fix html space padding # html escape special characters (like '&') if '<bar/>' in msg: left, right = map(escape, re.split(r'\|?<bar/>\|?', msg, maxsplit=1)) @@ -219,7 +220,7 @@ kwargs['disable'] = bool(kwargs.get('disable', False)) colour = kwargs.pop('colour', None) display_here = kwargs.pop('display', True) - super(tqdm_notebook, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if self.disable or not kwargs['gui']: self.disp = lambda *_, **__: None return @@ -245,7 +246,7 @@ def __iter__(self): try: - it = super(tqdm_notebook, self).__iter__() + it = super().__iter__() for obj in it: # return super(tqdm...) will not catch exception yield obj @@ -258,7 +259,7 @@ def update(self, n=1): try: - return super(tqdm_notebook, self).update(n=n) + return super().update(n=n) # NB: except ... [ as ...] breaks IPython async KeyboardInterrupt except: # NOQA # cannot catch KeyboardInterrupt when using manual tqdm @@ -271,7 +272,7 @@ def close(self): if self.disable: return - super(tqdm_notebook, self).close() + super().close() # Try to detect if there was an error or KeyboardInterrupt # in manual mode: if n < total, things probably got wrong if self.total and self.n < self.total: @@ -296,14 +297,14 @@ total : int or float, optional. Total to use for the new bar. """ if self.disable: - return super(tqdm_notebook, self).reset(total=total) + return super().reset(total=total) _, pbar, _ = self.container.children pbar.bar_style = '' if total is not None: pbar.max = total if not self.total and self.ncols is None: # no longer unknown total pbar.layout.width = None # reset width - return super(tqdm_notebook, self).reset(total=total) + return super().reset(total=total) def tnrange(*args, **kwargs): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/rich.py new/tqdm-4.66.4/tqdm/rich.py --- old/tqdm-4.66.1/tqdm/rich.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/rich.py 2024-05-03 00:41:32.000000000 +0200 @@ -90,7 +90,7 @@ kwargs['disable'] = bool(kwargs.get('disable', False)) progress = kwargs.pop('progress', None) options = kwargs.pop('options', {}).copy() - super(tqdm_rich, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if self.disable: return @@ -116,7 +116,8 @@ def close(self): if self.disable: return - super(tqdm_rich, self).close() + self.display() # print 100%, vis #1306 + super().close() self._prog.__exit__(None, None, None) def clear(self, *_, **__): @@ -137,7 +138,7 @@ """ if hasattr(self, '_prog'): self._prog.reset(total=total) - super(tqdm_rich, self).reset(total=total) + super().reset(total=total) def trrange(*args, **kwargs): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/std.py new/tqdm-4.66.4/tqdm/std.py --- old/tqdm-4.66.1/tqdm/std.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/std.py 2024-05-03 00:41:32.000000000 +0200 @@ -10,7 +10,7 @@ import sys from collections import OrderedDict, defaultdict from contextlib import contextmanager -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from numbers import Number from time import time from warnings import warn @@ -46,7 +46,7 @@ if fp_write is not None: fp_write("\n" + self.__class__.__name__ + ": " + str(msg).rstrip() + '\n') else: - super(TqdmWarning, self).__init__(msg, *a, **k) + super().__init__(msg, *a, **k) class TqdmExperimentalWarning(TqdmWarning, FutureWarning): @@ -391,11 +391,11 @@ if abs(num) < 999.5: if abs(num) < 99.95: if abs(num) < 9.995: - return '{0:1.2f}'.format(num) + unit + suffix - return '{0:2.1f}'.format(num) + unit + suffix - return '{0:3.0f}'.format(num) + unit + suffix + return f'{num:1.2f}{unit}{suffix}' + return f'{num:2.1f}{unit}{suffix}' + return f'{num:3.0f}{unit}{suffix}' num /= divisor - return '{0:3.1f}Y'.format(num) + suffix + return f'{num:3.1f}Y{suffix}' @staticmethod def format_interval(t): @@ -414,10 +414,7 @@ """ mins, s = divmod(int(t), 60) h, m = divmod(mins, 60) - if h: - return '{0:d}:{1:02d}:{2:02d}'.format(h, m, s) - else: - return '{0:02d}:{1:02d}'.format(m, s) + return f'{h:d}:{m:02d}:{s:02d}' if h else f'{m:02d}:{s:02d}' @staticmethod def format_num(n): @@ -434,7 +431,7 @@ out : str Formatted number. """ - f = '{0:.3g}'.format(n).replace('+0', '+').replace('-0', '-') + f = f'{n:.3g}'.replace('e+0', 'e+').replace('e-0', 'e-') n = str(n) return f if len(f) < len(n) else n @@ -554,10 +551,10 @@ rate = (n - initial) / elapsed inv_rate = 1 / rate if rate else None format_sizeof = tqdm.format_sizeof - rate_noinv_fmt = ((format_sizeof(rate) if unit_scale else - '{0:5.2f}'.format(rate)) if rate else '?') + unit + '/s' + rate_noinv_fmt = ((format_sizeof(rate) if unit_scale else f'{rate:5.2f}') + if rate else '?') + unit + '/s' rate_inv_fmt = ( - (format_sizeof(inv_rate) if unit_scale else '{0:5.2f}'.format(inv_rate)) + (format_sizeof(inv_rate) if unit_scale else f'{inv_rate:5.2f}') if inv_rate else '?') + 's/' + unit rate_fmt = rate_inv_fmt if inv_rate and inv_rate > 1 else rate_noinv_fmt @@ -577,7 +574,7 @@ remaining_str = tqdm.format_interval(remaining) if rate else '?' try: eta_dt = (datetime.now() + timedelta(seconds=remaining) - if rate and total else datetime.utcfromtimestamp(0)) + if rate and total else datetime.fromtimestamp(0, timezone.utc)) except OverflowError: eta_dt = datetime.max @@ -615,7 +612,7 @@ frac = n / total percentage = frac * 100 - l_bar += '{0:3.0f}%|'.format(percentage) + l_bar += f'{percentage:3.0f}%|' if ncols == 0: return l_bar[:-1] + r_bar[1:] @@ -933,6 +930,8 @@ DataFrame.progress_apply = inner_generator() DataFrameGroupBy.progress_apply = inner_generator() DataFrame.progress_applymap = inner_generator('applymap') + DataFrame.progress_map = inner_generator('map') + DataFrameGroupBy.progress_map = inner_generator('map') if Panel is not None: Panel.progress_apply = inner_generator() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/tk.py new/tqdm-4.66.4/tqdm/tk.py --- old/tqdm-4.66.1/tqdm/tk.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/tk.py 2024-05-03 00:41:32.000000000 +0200 @@ -53,7 +53,7 @@ grab = kwargs.pop('grab', False) tk_parent = kwargs.pop('tk_parent', None) self._cancel_callback = kwargs.pop('cancel_callback', None) - super(tqdm_tk, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if self.disable: return @@ -172,7 +172,7 @@ self._tk_pbar.configure(maximum=100, mode="indeterminate") else: self._tk_pbar.configure(maximum=total, mode="determinate") - super(tqdm_tk, self).reset(total=total) + super().reset(total=total) @staticmethod def _tk_dispatching_helper(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm/utils.py new/tqdm-4.66.4/tqdm/utils.py --- old/tqdm-4.66.1/tqdm/utils.py 2023-08-10 13:37:57.000000000 +0200 +++ new/tqdm-4.66.4/tqdm/utils.py 2024-05-03 00:41:32.000000000 +0200 @@ -38,6 +38,7 @@ camelCase isn't supported (because Windows ignores case). Precedence (highest first): + - call (`foo(a=3)`) - environ (`FOO_A=2`) - signature (`def foo(a=1)`) @@ -101,7 +102,7 @@ class FormatReplace(object): """ >>> a = FormatReplace('something') - >>> "{:5d}".format(a) + >>> f"{a:5d}" 'something' """ # NOQA: P102 def __init__(self, replace=''): @@ -166,7 +167,7 @@ """ # pylint: disable=too-few-public-methods def __init__(self, wrapped, encoding): - super(SimpleTextIOWrapper, self).__init__(wrapped) + super().__init__(wrapped) self.wrapper_setattr('encoding', encoding) def write(self, s): @@ -210,7 +211,7 @@ return inner def __init__(self, wrapped, tqdm_instance): - super(DisableOnWriteError, self).__init__(wrapped) + super().__init__(wrapped) if hasattr(wrapped, 'write'): self.wrapper_setattr( 'write', self.disable_on_exception(tqdm_instance, wrapped.write)) @@ -228,7 +229,7 @@ Wrap a given `file`-like object's `read()` or `write()` to report lengths to the given `callback` """ - super(CallbackIOWrapper, self).__init__(stream) + super().__init__(stream) func = getattr(stream, method) if method == "write": @wraps(func) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tqdm-4.66.1/tqdm.egg-info/PKG-INFO new/tqdm-4.66.4/tqdm.egg-info/PKG-INFO --- old/tqdm-4.66.1/tqdm.egg-info/PKG-INFO 2023-08-10 13:38:37.000000000 +0200 +++ new/tqdm-4.66.4/tqdm.egg-info/PKG-INFO 2024-05-03 00:41:59.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: tqdm -Version: 4.66.1 +Version: 4.66.4 Summary: Fast, Extensible Progress Meter Maintainer-email: tqdm developers <[email protected]> License: MPL-2.0 AND MIT @@ -65,11 +65,19 @@ Classifier: Topic :: Utilities Requires-Python: >=3.7 Description-Content-Type: text/x-rst +License-File: LICENCE +Requires-Dist: colorama; platform_system == "Windows" Provides-Extra: dev +Requires-Dist: pytest>=6; extra == "dev" +Requires-Dist: pytest-cov; extra == "dev" +Requires-Dist: pytest-timeout; extra == "dev" +Requires-Dist: pytest-xdist; extra == "dev" Provides-Extra: slack +Requires-Dist: slack-sdk; extra == "slack" Provides-Extra: telegram +Requires-Dist: requests; extra == "telegram" Provides-Extra: notebook -License-File: LICENCE +Requires-Dist: ipywidgets>=6; extra == "notebook" |Logo| @@ -839,7 +847,7 @@ """Provides a `total_time` format parameter""" @property def format_dict(self): - d = super(TqdmExtraFormat, self).format_dict + d = super().format_dict total_time = d["elapsed"] * (d["total"] or 0) / max(d["n"], 1) d.update(total_time=self.format_interval(total_time) + " in total") return d @@ -903,7 +911,7 @@ def progresser(n): interval = 0.001 / (n + 2) total = 5000 - text = "#{}, est. {:<04.2}s".format(n, interval * total) + text = f"#{n}, est. {interval * total:<04.2}s" for _ in trange(total, desc=text, position=n): sleep(interval) @@ -926,7 +934,7 @@ def progresser(n): interval = 0.001 / (n + 2) total = 5000 - text = "#{}, est. {:<04.2}s".format(n, interval * total) + text = f"#{n}, est. {interval * total:<04.2}s" for _ in trange(total, desc=text): sleep(interval) if n == 6: @@ -1055,7 +1063,7 @@ class TqdmExt(std_tqdm): def update(self, n=1): - displayed = super(TqdmExt, self).update(n) + displayed = super().update(n) if displayed: external_callback(**self.format_dict) return displayed
