Skip to content

Commit d986637

Browse files
authored
Merge pull request #1180 from tqdm/devel
bump version, merge pull request #1180 from tqdm/devel
2 parents c1ec3b1 + b6ada18 commit d986637

10 files changed

Lines changed: 44 additions & 21 deletions

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
os: [macos-latest, windows-latest]
4646
name: py${{ matrix.python }}-${{ matrix.os }}
4747
runs-on: ${{ matrix.os }}
48+
timeout-minutes: 20
4849
steps:
4950
- uses: actions/checkout@v2
5051
with:
@@ -77,6 +78,7 @@ jobs:
7778
python: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
7879
name: py${{ matrix.python }}
7980
runs-on: ubuntu-latest
81+
timeout-minutes: 20
8082
steps:
8183
- uses: actions/checkout@v2
8284
with:
@@ -164,12 +166,11 @@ jobs:
164166
fi
165167
git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
166168
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
167-
id: create_release
168169
uses: softprops/action-gh-release@v1
169170
env:
170171
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
171172
with:
172-
release_name: tqdm ${{ github.ref }} stable
173+
name: tqdm ${{ github.ref }} stable
173174
body_path: _CHANGES.md
174175
draft: true
175176
files: |

.meta/.readme.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,9 +588,6 @@ Nested progress bars
588588
for k in trange(50, desc='3rd loop', leave=False):
589589
sleep(0.01)
590590
591-
On Windows `colorama <https://github.com/tartley/colorama>`__ will be used if
592-
available to keep nested bars on their respective lines.
593-
594591
For manual control over positioning (e.g. for multi-processing use),
595592
you may specify ``position=n`` where ``n=0`` for the outermost bar,
596593
``n=1`` for the next, and so on.
@@ -1254,7 +1251,7 @@ Citation information: |DOI|
12541251
.. |GitHub-Updated| image:: https://img.shields.io/github/last-commit/tqdm/tqdm/master.svg?logo=github&logoColor=white&label=pushed
12551252
:target: https://github.com/tqdm/tqdm/pulse
12561253
.. |Gift-Casper| image:: https://img.shields.io/badge/dynamic/json.svg?color=ff69b4&label=gifts%20received&prefix=%C2%A3&query=%24..sum&url=https%3A%2F%2Fcaspersci.uk.to%2Fgifts.json
1257-
:target: https://www.cdcl.ml/sponsor
1254+
:target: https://cdcl.ml/sponsor
12581255
.. |Versions| image:: https://img.shields.io/pypi/v/tqdm.svg
12591256
:target: https://tqdm.github.io/releases
12601257
.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg?label=pypi%20downloads&logo=PyPI&logoColor=white

DEMO.ipynb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"cell_type": "markdown",
5959
"metadata": {},
6060
"source": [
61-
"![Screenshot](https://img.tqdm.ml/tqdm.gif)|[![Video](https://img.tqdm.ml/video.jpg)](https://tqdm.github.io/video) [![Slides](https://img.tqdm.ml/slides.jpg)](https://tqdm.github.io/PyData2019/slides.html)\n",
61+
"![Screenshot](https://img.tqdm.ml/tqdm.gif)|[![Video](https://img.tqdm.ml/video.jpg)](https://tqdm.github.io/video) [![Slides](https://img.tqdm.ml/slides.jpg)](https://tqdm.github.io/PyData2019/slides.html) [![Merch](https://img.tqdm.ml/merch.jpg)](https://tqdm.github.io/merch)\n",
6262
"-|-\n",
6363
"\n",
6464
"It can also be executed as a module with pipes:"
@@ -273,7 +273,7 @@
273273
"metadata": {},
274274
"outputs": [],
275275
"source": [
276-
"! find . -name '*.py' -type f -exec cat \\{} \\; | tqdm --unit loc --unit_scale --total 4104300 >> /dev/null"
276+
"! find . -name '*.py' -type f -exec cat \\{} \\; | tqdm --unit loc --unit-scale --total 4104300 --null"
277277
]
278278
},
279279
{
@@ -472,9 +472,6 @@
472472
"cell_type": "markdown",
473473
"metadata": {},
474474
"source": [
475-
"On Windows [colorama](https://github.com/tartley/colorama) will be used\n",
476-
"if available to keep nested bars on their respective lines.\n",
477-
"\n",
478475
"For manual control over positioning (e.g. for multi-processing use),\n",
479476
"you may specify `position=n` where `n=0` for the outermost bar, `n=1`\n",
480477
"for the next, and so on. However, it's best to check if tqdm can work\n",
@@ -702,9 +699,9 @@
702699
"\n",
703700
"### Keras Integration\n",
704701
"\n",
705-
"```python\n",
706702
"A `keras` callback is also available:\n",
707703
"\n",
704+
"```python\n",
708705
"from tqdm.keras import TqdmCallback\n",
709706
"\n",
710707
"...\n",

README.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -807,9 +807,6 @@ Nested progress bars
807807
for k in trange(50, desc='3rd loop', leave=False):
808808
sleep(0.01)
809809
810-
On Windows `colorama <https://github.com/tartley/colorama>`__ will be used if
811-
available to keep nested bars on their respective lines.
812-
813810
For manual control over positioning (e.g. for multi-processing use),
814811
you may specify ``position=n`` where ``n=0`` for the outermost bar,
815812
``n=1`` for the next, and so on.
@@ -1473,7 +1470,7 @@ Citation information: |DOI|
14731470
.. |GitHub-Updated| image:: https://img.shields.io/github/last-commit/tqdm/tqdm/master.svg?logo=github&logoColor=white&label=pushed
14741471
:target: https://github.com/tqdm/tqdm/pulse
14751472
.. |Gift-Casper| image:: https://img.shields.io/badge/dynamic/json.svg?color=ff69b4&label=gifts%20received&prefix=%C2%A3&query=%24..sum&url=https%3A%2F%2Fcaspersci.uk.to%2Fgifts.json
1476-
:target: https://www.cdcl.ml/sponsor
1473+
:target: https://cdcl.ml/sponsor
14771474
.. |Versions| image:: https://img.shields.io/pypi/v/tqdm.svg
14781475
:target: https://tqdm.github.io/releases
14791476
.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg?label=pypi%20downloads&logo=PyPI&logoColor=white

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ classifiers=
7575
[options]
7676
setup_requires=setuptools>=42; setuptools_scm[toml]>=3.4
7777
python_requires=>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
78+
install_requires=
79+
colorama; platform_system == 'Windows'
7880
tests_require=tox
7981
include_package_data=True
8082
packages=find:

tqdm/asyncio.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
... ...
99
"""
1010
import asyncio
11+
from sys import version_info
1112

1213
from .std import tqdm as std_tqdm
1314

@@ -60,7 +61,10 @@ def as_completed(cls, fs, *, loop=None, timeout=None, total=None, **tqdm_kwargs)
6061
"""
6162
if total is None:
6263
total = len(fs)
63-
yield from cls(asyncio.as_completed(fs, loop=loop, timeout=timeout),
64+
kwargs = {}
65+
if version_info[:2] < (3, 10):
66+
kwargs['loop'] = loop
67+
yield from cls(asyncio.as_completed(fs, timeout=timeout, **kwargs),
6468
total=total, **tqdm_kwargs)
6569

6670
@classmethod

tqdm/contrib/telegram.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ def write(self, s):
6262
else:
6363
return future
6464

65+
def delete(self):
66+
"""Deletes internal `message_id`."""
67+
try:
68+
future = self.submit(
69+
self.session.post, self.API + '%s/deleteMessage' % self.token,
70+
data={'chat_id': self.chat_id, 'message_id': self.message_id})
71+
except Exception as e:
72+
tqdm_auto.write(str(e))
73+
else:
74+
return future
75+
6576

6677
class tqdm_telegram(tqdm_auto):
6778
"""
@@ -112,6 +123,13 @@ def clear(self, *args, **kwargs):
112123
if not self.disable:
113124
self.tgio.write("")
114125

126+
def close(self):
127+
if self.disable:
128+
return
129+
super(tqdm_telegram, self).close()
130+
if not (self.leave or (self.leave is None and self.pos == 0)):
131+
self.tgio.delete()
132+
115133

116134
def ttgrange(*args, **kwargs):
117135
"""

tqdm/keras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
try:
99
import keras
10-
except ImportError as e:
10+
except (ImportError, AttributeError) as e:
1111
try:
1212
from tensorflow import keras
1313
except ImportError:

tqdm/rich.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ def __init__(self, *args, **kwargs):
113113
self._prog.__enter__()
114114
self._task_id = self._prog.add_task(self.desc or "", **d)
115115

116-
def close(self, *args, **kwargs):
116+
def close(self):
117117
if self.disable:
118118
return
119-
super(tqdm_rich, self).close(*args, **kwargs)
119+
super(tqdm_rich, self).close()
120120
self._prog.__exit__(None, None, None)
121121

122122
def clear(self, *_, **__):

tqdm/std.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ def status_printer(file):
336336
"""
337337
fp = file
338338
fp_flush = getattr(fp, 'flush', lambda: None) # pragma: no cover
339+
if fp in (sys.stderr, sys.stdout):
340+
sys.stderr.flush()
341+
sys.stdout.flush()
339342

340343
def fp_write(s):
341344
fp.write(_unicode(s))
@@ -790,8 +793,12 @@ def inner(df, func, *args, **kwargs):
790793
" Use keyword arguments instead.",
791794
fp_write=getattr(t.fp, 'write', sys.stderr.write))
792795

796+
try: # pandas>=1.3.0
797+
from pandas.core.common import is_builtin_func
798+
except ImportError:
799+
is_builtin_func = df._is_builtin_func
793800
try:
794-
func = df._is_builtin_func(func)
801+
func = is_builtin_func(func)
795802
except TypeError:
796803
pass
797804

0 commit comments

Comments
 (0)