Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- parrot/lib/python3.10/site-packages/cv2/qt/fonts/DejaVuSansCondensed.ttf +3 -0
- parrot/lib/python3.10/site-packages/tqdm/__main__.py +3 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/__init__.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/__main__.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/_dist_ver.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/_main.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/_monitor.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_gui.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_notebook.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_pandas.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/asyncio.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/auto.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/autonotebook.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/cli.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/gui.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/keras.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/notebook.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/rich.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/std.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/tk.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/utils.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/__pycache__/version.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/_dist_ver.py +1 -0
- parrot/lib/python3.10/site-packages/tqdm/_tqdm.py +9 -0
- parrot/lib/python3.10/site-packages/tqdm/_tqdm_gui.py +9 -0
- parrot/lib/python3.10/site-packages/tqdm/_tqdm_pandas.py +24 -0
- parrot/lib/python3.10/site-packages/tqdm/asyncio.py +93 -0
- parrot/lib/python3.10/site-packages/tqdm/auto.py +40 -0
- parrot/lib/python3.10/site-packages/tqdm/autonotebook.py +29 -0
- parrot/lib/python3.10/site-packages/tqdm/cli.py +325 -0
- parrot/lib/python3.10/site-packages/tqdm/completion.sh +19 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/__init__.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/bells.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/concurrent.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/discord.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/logging.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/slack.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/telegram.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/utils_worker.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/itertools.py +35 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/logging.py +126 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/telegram.py +153 -0
- parrot/lib/python3.10/site-packages/tqdm/contrib/utils_worker.py +38 -0
- parrot/lib/python3.10/site-packages/tqdm/keras.py +122 -0
- parrot/lib/python3.10/site-packages/tqdm/notebook.py +317 -0
- parrot/lib/python3.10/site-packages/tqdm/rich.py +151 -0
- parrot/lib/python3.10/site-packages/tqdm/tk.py +196 -0
- parrot/lib/python3.10/site-packages/tqdm/tqdm.1 +314 -0
.gitattributes
CHANGED
|
@@ -148,3 +148,4 @@ parrot/lib/python3.10/site-packages/aiohttp/_http_writer.cpython-310-x86_64-linu
|
|
| 148 |
parrot/lib/libquadmath.so filter=lfs diff=lfs merge=lfs -text
|
| 149 |
parrot/lib/python3.10/site-packages/pyarrow/_dataset_parquet.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 150 |
parrot/lib/python3.10/ensurepip/_bundled/setuptools-65.5.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 148 |
parrot/lib/libquadmath.so filter=lfs diff=lfs merge=lfs -text
|
| 149 |
parrot/lib/python3.10/site-packages/pyarrow/_dataset_parquet.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 150 |
parrot/lib/python3.10/ensurepip/_bundled/setuptools-65.5.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
|
| 151 |
+
parrot/lib/python3.10/site-packages/cv2/qt/fonts/DejaVuSansCondensed.ttf filter=lfs diff=lfs merge=lfs -text
|
parrot/lib/python3.10/site-packages/cv2/qt/fonts/DejaVuSansCondensed.ttf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:69f1355c9eef0a3d11a6c06f3cbf1d46eabfdadcc993589a3be93a44ed8678b4
|
| 3 |
+
size 643852
|
parrot/lib/python3.10/site-packages/tqdm/__main__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .cli import main
|
| 2 |
+
|
| 3 |
+
main()
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (1.47 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/__main__.cpython-310.pyc
ADDED
|
Binary file (196 Bytes). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/_dist_ver.cpython-310.pyc
ADDED
|
Binary file (179 Bytes). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/_main.cpython-310.pyc
ADDED
|
Binary file (430 Bytes). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/_monitor.cpython-310.pyc
ADDED
|
Binary file (2.79 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm.cpython-310.pyc
ADDED
|
Binary file (425 Bytes). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_gui.cpython-310.pyc
ADDED
|
Binary file (438 Bytes). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_notebook.cpython-310.pyc
ADDED
|
Binary file (458 Bytes). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_pandas.cpython-310.pyc
ADDED
|
Binary file (946 Bytes). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/asyncio.cpython-310.pyc
ADDED
|
Binary file (3.35 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/auto.cpython-310.pyc
ADDED
|
Binary file (1.1 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/autonotebook.cpython-310.pyc
ADDED
|
Binary file (992 Bytes). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/cli.cpython-310.pyc
ADDED
|
Binary file (9.21 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/gui.cpython-310.pyc
ADDED
|
Binary file (4.53 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/keras.cpython-310.pyc
ADDED
|
Binary file (4.92 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/notebook.cpython-310.pyc
ADDED
|
Binary file (7.37 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/rich.cpython-310.pyc
ADDED
|
Binary file (5.04 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/std.cpython-310.pyc
ADDED
|
Binary file (45.4 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/tk.cpython-310.pyc
ADDED
|
Binary file (6.15 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/utils.cpython-310.pyc
ADDED
|
Binary file (13.8 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/__pycache__/version.cpython-310.pyc
ADDED
|
Binary file (496 Bytes). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/_dist_ver.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
__version__ = '4.66.5'
|
parrot/lib/python3.10/site-packages/tqdm/_tqdm.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from warnings import warn
|
| 2 |
+
|
| 3 |
+
from .std import * # NOQA
|
| 4 |
+
from .std import __all__ # NOQA
|
| 5 |
+
from .std import TqdmDeprecationWarning
|
| 6 |
+
|
| 7 |
+
warn("This function will be removed in tqdm==5.0.0\n"
|
| 8 |
+
"Please use `tqdm.std.*` instead of `tqdm._tqdm.*`",
|
| 9 |
+
TqdmDeprecationWarning, stacklevel=2)
|
parrot/lib/python3.10/site-packages/tqdm/_tqdm_gui.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from warnings import warn
|
| 2 |
+
|
| 3 |
+
from .gui import * # NOQA
|
| 4 |
+
from .gui import __all__ # NOQA
|
| 5 |
+
from .std import TqdmDeprecationWarning
|
| 6 |
+
|
| 7 |
+
warn("This function will be removed in tqdm==5.0.0\n"
|
| 8 |
+
"Please use `tqdm.gui.*` instead of `tqdm._tqdm_gui.*`",
|
| 9 |
+
TqdmDeprecationWarning, stacklevel=2)
|
parrot/lib/python3.10/site-packages/tqdm/_tqdm_pandas.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
|
| 3 |
+
__author__ = "github.com/casperdcl"
|
| 4 |
+
__all__ = ['tqdm_pandas']
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def tqdm_pandas(tclass, **tqdm_kwargs):
|
| 8 |
+
"""
|
| 9 |
+
Registers the given `tqdm` instance with
|
| 10 |
+
`pandas.core.groupby.DataFrameGroupBy.progress_apply`.
|
| 11 |
+
"""
|
| 12 |
+
from tqdm import TqdmDeprecationWarning
|
| 13 |
+
|
| 14 |
+
if isinstance(tclass, type) or (getattr(tclass, '__name__', '').startswith(
|
| 15 |
+
'tqdm_')): # delayed adapter case
|
| 16 |
+
TqdmDeprecationWarning(
|
| 17 |
+
"Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm, ...)`.",
|
| 18 |
+
fp_write=getattr(tqdm_kwargs.get('file', None), 'write', sys.stderr.write))
|
| 19 |
+
tclass.pandas(**tqdm_kwargs)
|
| 20 |
+
else:
|
| 21 |
+
TqdmDeprecationWarning(
|
| 22 |
+
"Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm(...))`.",
|
| 23 |
+
fp_write=getattr(tclass.fp, 'write', sys.stderr.write))
|
| 24 |
+
type(tclass).pandas(deprecated_t=tclass)
|
parrot/lib/python3.10/site-packages/tqdm/asyncio.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Asynchronous progressbar decorator for iterators.
|
| 3 |
+
Includes a default `range` iterator printing to `stderr`.
|
| 4 |
+
|
| 5 |
+
Usage:
|
| 6 |
+
>>> from tqdm.asyncio import trange, tqdm
|
| 7 |
+
>>> async for i in trange(10):
|
| 8 |
+
... ...
|
| 9 |
+
"""
|
| 10 |
+
import asyncio
|
| 11 |
+
from sys import version_info
|
| 12 |
+
|
| 13 |
+
from .std import tqdm as std_tqdm
|
| 14 |
+
|
| 15 |
+
__author__ = {"github.com/": ["casperdcl"]}
|
| 16 |
+
__all__ = ['tqdm_asyncio', 'tarange', 'tqdm', 'trange']
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class tqdm_asyncio(std_tqdm):
|
| 20 |
+
"""
|
| 21 |
+
Asynchronous-friendly version of tqdm.
|
| 22 |
+
"""
|
| 23 |
+
def __init__(self, iterable=None, *args, **kwargs):
|
| 24 |
+
super().__init__(iterable, *args, **kwargs)
|
| 25 |
+
self.iterable_awaitable = False
|
| 26 |
+
if iterable is not None:
|
| 27 |
+
if hasattr(iterable, "__anext__"):
|
| 28 |
+
self.iterable_next = iterable.__anext__
|
| 29 |
+
self.iterable_awaitable = True
|
| 30 |
+
elif hasattr(iterable, "__next__"):
|
| 31 |
+
self.iterable_next = iterable.__next__
|
| 32 |
+
else:
|
| 33 |
+
self.iterable_iterator = iter(iterable)
|
| 34 |
+
self.iterable_next = self.iterable_iterator.__next__
|
| 35 |
+
|
| 36 |
+
def __aiter__(self):
|
| 37 |
+
return self
|
| 38 |
+
|
| 39 |
+
async def __anext__(self):
|
| 40 |
+
try:
|
| 41 |
+
if self.iterable_awaitable:
|
| 42 |
+
res = await self.iterable_next()
|
| 43 |
+
else:
|
| 44 |
+
res = self.iterable_next()
|
| 45 |
+
self.update()
|
| 46 |
+
return res
|
| 47 |
+
except StopIteration:
|
| 48 |
+
self.close()
|
| 49 |
+
raise StopAsyncIteration
|
| 50 |
+
except BaseException:
|
| 51 |
+
self.close()
|
| 52 |
+
raise
|
| 53 |
+
|
| 54 |
+
def send(self, *args, **kwargs):
|
| 55 |
+
return self.iterable.send(*args, **kwargs)
|
| 56 |
+
|
| 57 |
+
@classmethod
|
| 58 |
+
def as_completed(cls, fs, *, loop=None, timeout=None, total=None, **tqdm_kwargs):
|
| 59 |
+
"""
|
| 60 |
+
Wrapper for `asyncio.as_completed`.
|
| 61 |
+
"""
|
| 62 |
+
if total is None:
|
| 63 |
+
total = len(fs)
|
| 64 |
+
kwargs = {}
|
| 65 |
+
if version_info[:2] < (3, 10):
|
| 66 |
+
kwargs['loop'] = loop
|
| 67 |
+
yield from cls(asyncio.as_completed(fs, timeout=timeout, **kwargs),
|
| 68 |
+
total=total, **tqdm_kwargs)
|
| 69 |
+
|
| 70 |
+
@classmethod
|
| 71 |
+
async def gather(cls, *fs, loop=None, timeout=None, total=None, **tqdm_kwargs):
|
| 72 |
+
"""
|
| 73 |
+
Wrapper for `asyncio.gather`.
|
| 74 |
+
"""
|
| 75 |
+
async def wrap_awaitable(i, f):
|
| 76 |
+
return i, await f
|
| 77 |
+
|
| 78 |
+
ifs = [wrap_awaitable(i, f) for i, f in enumerate(fs)]
|
| 79 |
+
res = [await f for f in cls.as_completed(ifs, loop=loop, timeout=timeout,
|
| 80 |
+
total=total, **tqdm_kwargs)]
|
| 81 |
+
return [i for _, i in sorted(res)]
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def tarange(*args, **kwargs):
|
| 85 |
+
"""
|
| 86 |
+
A shortcut for `tqdm.asyncio.tqdm(range(*args), **kwargs)`.
|
| 87 |
+
"""
|
| 88 |
+
return tqdm_asyncio(range(*args), **kwargs)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
# Aliases
|
| 92 |
+
tqdm = tqdm_asyncio
|
| 93 |
+
trange = tarange
|
parrot/lib/python3.10/site-packages/tqdm/auto.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Enables multiple commonly used features.
|
| 3 |
+
|
| 4 |
+
Method resolution order:
|
| 5 |
+
|
| 6 |
+
- `tqdm.autonotebook` without import warnings
|
| 7 |
+
- `tqdm.asyncio`
|
| 8 |
+
- `tqdm.std` base class
|
| 9 |
+
|
| 10 |
+
Usage:
|
| 11 |
+
>>> from tqdm.auto import trange, tqdm
|
| 12 |
+
>>> for i in trange(10):
|
| 13 |
+
... ...
|
| 14 |
+
"""
|
| 15 |
+
import warnings
|
| 16 |
+
|
| 17 |
+
from .std import TqdmExperimentalWarning
|
| 18 |
+
|
| 19 |
+
with warnings.catch_warnings():
|
| 20 |
+
warnings.simplefilter("ignore", category=TqdmExperimentalWarning)
|
| 21 |
+
from .autonotebook import tqdm as notebook_tqdm
|
| 22 |
+
|
| 23 |
+
from .asyncio import tqdm as asyncio_tqdm
|
| 24 |
+
from .std import tqdm as std_tqdm
|
| 25 |
+
|
| 26 |
+
if notebook_tqdm != std_tqdm:
|
| 27 |
+
class tqdm(notebook_tqdm, asyncio_tqdm): # pylint: disable=inconsistent-mro
|
| 28 |
+
pass
|
| 29 |
+
else:
|
| 30 |
+
tqdm = asyncio_tqdm
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def trange(*args, **kwargs):
|
| 34 |
+
"""
|
| 35 |
+
A shortcut for `tqdm.auto.tqdm(range(*args), **kwargs)`.
|
| 36 |
+
"""
|
| 37 |
+
return tqdm(range(*args), **kwargs)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
__all__ = ["tqdm", "trange"]
|
parrot/lib/python3.10/site-packages/tqdm/autonotebook.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Automatically choose between `tqdm.notebook` and `tqdm.std`.
|
| 3 |
+
|
| 4 |
+
Usage:
|
| 5 |
+
>>> from tqdm.autonotebook import trange, tqdm
|
| 6 |
+
>>> for i in trange(10):
|
| 7 |
+
... ...
|
| 8 |
+
"""
|
| 9 |
+
import sys
|
| 10 |
+
from warnings import warn
|
| 11 |
+
|
| 12 |
+
try:
|
| 13 |
+
get_ipython = sys.modules['IPython'].get_ipython
|
| 14 |
+
if 'IPKernelApp' not in get_ipython().config: # pragma: no cover
|
| 15 |
+
raise ImportError("console")
|
| 16 |
+
from .notebook import WARN_NOIPYW, IProgress
|
| 17 |
+
if IProgress is None:
|
| 18 |
+
from .std import TqdmWarning
|
| 19 |
+
warn(WARN_NOIPYW, TqdmWarning, stacklevel=2)
|
| 20 |
+
raise ImportError('ipywidgets')
|
| 21 |
+
except Exception:
|
| 22 |
+
from .std import tqdm, trange
|
| 23 |
+
else: # pragma: no cover
|
| 24 |
+
from .notebook import tqdm, trange
|
| 25 |
+
from .std import TqdmExperimentalWarning
|
| 26 |
+
warn("Using `tqdm.autonotebook.tqdm` in notebook mode."
|
| 27 |
+
" Use `tqdm.tqdm` instead to force console mode"
|
| 28 |
+
" (e.g. in jupyter console)", TqdmExperimentalWarning, stacklevel=2)
|
| 29 |
+
__all__ = ["tqdm", "trange"]
|
parrot/lib/python3.10/site-packages/tqdm/cli.py
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Module version for monitoring CLI pipes (`... | python -m tqdm | ...`).
|
| 3 |
+
"""
|
| 4 |
+
import logging
|
| 5 |
+
import re
|
| 6 |
+
import sys
|
| 7 |
+
from ast import literal_eval as numeric
|
| 8 |
+
from textwrap import indent
|
| 9 |
+
|
| 10 |
+
from .std import TqdmKeyError, TqdmTypeError, tqdm
|
| 11 |
+
from .version import __version__
|
| 12 |
+
|
| 13 |
+
__all__ = ["main"]
|
| 14 |
+
log = logging.getLogger(__name__)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def cast(val, typ):
|
| 18 |
+
log.debug((val, typ))
|
| 19 |
+
if " or " in typ:
|
| 20 |
+
for t in typ.split(" or "):
|
| 21 |
+
try:
|
| 22 |
+
return cast(val, t)
|
| 23 |
+
except TqdmTypeError:
|
| 24 |
+
pass
|
| 25 |
+
raise TqdmTypeError(f"{val} : {typ}")
|
| 26 |
+
|
| 27 |
+
# sys.stderr.write('\ndebug | `val:type`: `' + val + ':' + typ + '`.\n')
|
| 28 |
+
if typ == 'bool':
|
| 29 |
+
if (val == 'True') or (val == ''):
|
| 30 |
+
return True
|
| 31 |
+
if val == 'False':
|
| 32 |
+
return False
|
| 33 |
+
raise TqdmTypeError(val + ' : ' + typ)
|
| 34 |
+
if typ == 'chr':
|
| 35 |
+
if len(val) == 1:
|
| 36 |
+
return val.encode()
|
| 37 |
+
if re.match(r"^\\\w+$", val):
|
| 38 |
+
return eval(f'"{val}"').encode()
|
| 39 |
+
raise TqdmTypeError(f"{val} : {typ}")
|
| 40 |
+
if typ == 'str':
|
| 41 |
+
return val
|
| 42 |
+
if typ == 'int':
|
| 43 |
+
try:
|
| 44 |
+
return int(val)
|
| 45 |
+
except ValueError as exc:
|
| 46 |
+
raise TqdmTypeError(f"{val} : {typ}") from exc
|
| 47 |
+
if typ == 'float':
|
| 48 |
+
try:
|
| 49 |
+
return float(val)
|
| 50 |
+
except ValueError as exc:
|
| 51 |
+
raise TqdmTypeError(f"{val} : {typ}") from exc
|
| 52 |
+
raise TqdmTypeError(f"{val} : {typ}")
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def posix_pipe(fin, fout, delim=b'\\n', buf_size=256,
|
| 56 |
+
callback=lambda float: None, callback_len=True):
|
| 57 |
+
"""
|
| 58 |
+
Params
|
| 59 |
+
------
|
| 60 |
+
fin : binary file with `read(buf_size : int)` method
|
| 61 |
+
fout : binary file with `write` (and optionally `flush`) methods.
|
| 62 |
+
callback : function(float), e.g.: `tqdm.update`
|
| 63 |
+
callback_len : If (default: True) do `callback(len(buffer))`.
|
| 64 |
+
Otherwise, do `callback(data) for data in buffer.split(delim)`.
|
| 65 |
+
"""
|
| 66 |
+
fp_write = fout.write
|
| 67 |
+
|
| 68 |
+
if not delim:
|
| 69 |
+
while True:
|
| 70 |
+
tmp = fin.read(buf_size)
|
| 71 |
+
|
| 72 |
+
# flush at EOF
|
| 73 |
+
if not tmp:
|
| 74 |
+
getattr(fout, 'flush', lambda: None)()
|
| 75 |
+
return
|
| 76 |
+
|
| 77 |
+
fp_write(tmp)
|
| 78 |
+
callback(len(tmp))
|
| 79 |
+
# return
|
| 80 |
+
|
| 81 |
+
buf = b''
|
| 82 |
+
len_delim = len(delim)
|
| 83 |
+
# n = 0
|
| 84 |
+
while True:
|
| 85 |
+
tmp = fin.read(buf_size)
|
| 86 |
+
|
| 87 |
+
# flush at EOF
|
| 88 |
+
if not tmp:
|
| 89 |
+
if buf:
|
| 90 |
+
fp_write(buf)
|
| 91 |
+
if callback_len:
|
| 92 |
+
# n += 1 + buf.count(delim)
|
| 93 |
+
callback(1 + buf.count(delim))
|
| 94 |
+
else:
|
| 95 |
+
for i in buf.split(delim):
|
| 96 |
+
callback(i)
|
| 97 |
+
getattr(fout, 'flush', lambda: None)()
|
| 98 |
+
return # n
|
| 99 |
+
|
| 100 |
+
while True:
|
| 101 |
+
i = tmp.find(delim)
|
| 102 |
+
if i < 0:
|
| 103 |
+
buf += tmp
|
| 104 |
+
break
|
| 105 |
+
fp_write(buf + tmp[:i + len(delim)])
|
| 106 |
+
# n += 1
|
| 107 |
+
callback(1 if callback_len else (buf + tmp[:i]))
|
| 108 |
+
buf = b''
|
| 109 |
+
tmp = tmp[i + len_delim:]
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
# ((opt, type), ... )
|
| 113 |
+
RE_OPTS = re.compile(r'\n {4}(\S+)\s{2,}:\s*([^,]+)')
|
| 114 |
+
# better split method assuming no positional args
|
| 115 |
+
RE_SHLEX = re.compile(r'\s*(?<!\S)--?([^\s=]+)(\s+|=|$)')
|
| 116 |
+
|
| 117 |
+
# TODO: add custom support for some of the following?
|
| 118 |
+
UNSUPPORTED_OPTS = ('iterable', 'gui', 'out', 'file')
|
| 119 |
+
|
| 120 |
+
# The 8 leading spaces are required for consistency
|
| 121 |
+
CLI_EXTRA_DOC = r"""
|
| 122 |
+
Extra CLI Options
|
| 123 |
+
-----------------
|
| 124 |
+
name : type, optional
|
| 125 |
+
TODO: find out why this is needed.
|
| 126 |
+
delim : chr, optional
|
| 127 |
+
Delimiting character [default: '\n']. Use '\0' for null.
|
| 128 |
+
N.B.: on Windows systems, Python converts '\n' to '\r\n'.
|
| 129 |
+
buf_size : int, optional
|
| 130 |
+
String buffer size in bytes [default: 256]
|
| 131 |
+
used when `delim` is specified.
|
| 132 |
+
bytes : bool, optional
|
| 133 |
+
If true, will count bytes, ignore `delim`, and default
|
| 134 |
+
`unit_scale` to True, `unit_divisor` to 1024, and `unit` to 'B'.
|
| 135 |
+
tee : bool, optional
|
| 136 |
+
If true, passes `stdin` to both `stderr` and `stdout`.
|
| 137 |
+
update : bool, optional
|
| 138 |
+
If true, will treat input as newly elapsed iterations,
|
| 139 |
+
i.e. numbers to pass to `update()`. Note that this is slow
|
| 140 |
+
(~2e5 it/s) since every input must be decoded as a number.
|
| 141 |
+
update_to : bool, optional
|
| 142 |
+
If true, will treat input as total elapsed iterations,
|
| 143 |
+
i.e. numbers to assign to `self.n`. Note that this is slow
|
| 144 |
+
(~2e5 it/s) since every input must be decoded as a number.
|
| 145 |
+
null : bool, optional
|
| 146 |
+
If true, will discard input (no stdout).
|
| 147 |
+
manpath : str, optional
|
| 148 |
+
Directory in which to install tqdm man pages.
|
| 149 |
+
comppath : str, optional
|
| 150 |
+
Directory in which to place tqdm completion.
|
| 151 |
+
log : str, optional
|
| 152 |
+
CRITICAL|FATAL|ERROR|WARN(ING)|[default: 'INFO']|DEBUG|NOTSET.
|
| 153 |
+
"""
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def main(fp=sys.stderr, argv=None):
|
| 157 |
+
"""
|
| 158 |
+
Parameters (internal use only)
|
| 159 |
+
---------
|
| 160 |
+
fp : file-like object for tqdm
|
| 161 |
+
argv : list (default: sys.argv[1:])
|
| 162 |
+
"""
|
| 163 |
+
if argv is None:
|
| 164 |
+
argv = sys.argv[1:]
|
| 165 |
+
try:
|
| 166 |
+
log_idx = argv.index('--log')
|
| 167 |
+
except ValueError:
|
| 168 |
+
for i in argv:
|
| 169 |
+
if i.startswith('--log='):
|
| 170 |
+
logLevel = i[len('--log='):]
|
| 171 |
+
break
|
| 172 |
+
else:
|
| 173 |
+
logLevel = 'INFO'
|
| 174 |
+
else:
|
| 175 |
+
# argv.pop(log_idx)
|
| 176 |
+
# logLevel = argv.pop(log_idx)
|
| 177 |
+
logLevel = argv[log_idx + 1]
|
| 178 |
+
logging.basicConfig(level=getattr(logging, logLevel),
|
| 179 |
+
format="%(levelname)s:%(module)s:%(lineno)d:%(message)s")
|
| 180 |
+
|
| 181 |
+
# py<3.13 doesn't dedent docstrings
|
| 182 |
+
d = (tqdm.__doc__ if sys.version_info < (3, 13)
|
| 183 |
+
else indent(tqdm.__doc__, " ")) + CLI_EXTRA_DOC
|
| 184 |
+
|
| 185 |
+
opt_types = dict(RE_OPTS.findall(d))
|
| 186 |
+
# opt_types['delim'] = 'chr'
|
| 187 |
+
|
| 188 |
+
for o in UNSUPPORTED_OPTS:
|
| 189 |
+
opt_types.pop(o)
|
| 190 |
+
|
| 191 |
+
log.debug(sorted(opt_types.items()))
|
| 192 |
+
|
| 193 |
+
# d = RE_OPTS.sub(r' --\1=<\1> : \2', d)
|
| 194 |
+
split = RE_OPTS.split(d)
|
| 195 |
+
opt_types_desc = zip(split[1::3], split[2::3], split[3::3])
|
| 196 |
+
d = ''.join(('\n --{0} : {2}{3}' if otd[1] == 'bool' else
|
| 197 |
+
'\n --{0}=<{1}> : {2}{3}').format(
|
| 198 |
+
otd[0].replace('_', '-'), otd[0], *otd[1:])
|
| 199 |
+
for otd in opt_types_desc if otd[0] not in UNSUPPORTED_OPTS)
|
| 200 |
+
|
| 201 |
+
help_short = "Usage:\n tqdm [--help | options]\n"
|
| 202 |
+
d = help_short + """
|
| 203 |
+
Options:
|
| 204 |
+
-h, --help Print this help and exit.
|
| 205 |
+
-v, --version Print version and exit.
|
| 206 |
+
""" + d.strip('\n') + '\n'
|
| 207 |
+
|
| 208 |
+
# opts = docopt(d, version=__version__)
|
| 209 |
+
if any(v in argv for v in ('-v', '--version')):
|
| 210 |
+
sys.stdout.write(__version__ + '\n')
|
| 211 |
+
sys.exit(0)
|
| 212 |
+
elif any(v in argv for v in ('-h', '--help')):
|
| 213 |
+
sys.stdout.write(d + '\n')
|
| 214 |
+
sys.exit(0)
|
| 215 |
+
elif argv and argv[0][:2] != '--':
|
| 216 |
+
sys.stderr.write(f"Error:Unknown argument:{argv[0]}\n{help_short}")
|
| 217 |
+
|
| 218 |
+
argv = RE_SHLEX.split(' '.join(["tqdm"] + argv))
|
| 219 |
+
opts = dict(zip(argv[1::3], argv[3::3]))
|
| 220 |
+
|
| 221 |
+
log.debug(opts)
|
| 222 |
+
opts.pop('log', True)
|
| 223 |
+
|
| 224 |
+
tqdm_args = {'file': fp}
|
| 225 |
+
try:
|
| 226 |
+
for (o, v) in opts.items():
|
| 227 |
+
o = o.replace('-', '_')
|
| 228 |
+
try:
|
| 229 |
+
tqdm_args[o] = cast(v, opt_types[o])
|
| 230 |
+
except KeyError as e:
|
| 231 |
+
raise TqdmKeyError(str(e))
|
| 232 |
+
log.debug('args:' + str(tqdm_args))
|
| 233 |
+
|
| 234 |
+
delim_per_char = tqdm_args.pop('bytes', False)
|
| 235 |
+
update = tqdm_args.pop('update', False)
|
| 236 |
+
update_to = tqdm_args.pop('update_to', False)
|
| 237 |
+
if sum((delim_per_char, update, update_to)) > 1:
|
| 238 |
+
raise TqdmKeyError("Can only have one of --bytes --update --update_to")
|
| 239 |
+
except Exception:
|
| 240 |
+
fp.write("\nError:\n" + help_short)
|
| 241 |
+
stdin, stdout_write = sys.stdin, sys.stdout.write
|
| 242 |
+
for i in stdin:
|
| 243 |
+
stdout_write(i)
|
| 244 |
+
raise
|
| 245 |
+
else:
|
| 246 |
+
buf_size = tqdm_args.pop('buf_size', 256)
|
| 247 |
+
delim = tqdm_args.pop('delim', b'\\n')
|
| 248 |
+
tee = tqdm_args.pop('tee', False)
|
| 249 |
+
manpath = tqdm_args.pop('manpath', None)
|
| 250 |
+
comppath = tqdm_args.pop('comppath', None)
|
| 251 |
+
if tqdm_args.pop('null', False):
|
| 252 |
+
class stdout(object):
|
| 253 |
+
@staticmethod
|
| 254 |
+
def write(_):
|
| 255 |
+
pass
|
| 256 |
+
else:
|
| 257 |
+
stdout = sys.stdout
|
| 258 |
+
stdout = getattr(stdout, 'buffer', stdout)
|
| 259 |
+
stdin = getattr(sys.stdin, 'buffer', sys.stdin)
|
| 260 |
+
if manpath or comppath:
|
| 261 |
+
from importlib import resources
|
| 262 |
+
from os import path
|
| 263 |
+
from shutil import copyfile
|
| 264 |
+
|
| 265 |
+
def cp(name, dst):
|
| 266 |
+
"""copy resource `name` to `dst`"""
|
| 267 |
+
if hasattr(resources, 'files'):
|
| 268 |
+
copyfile(str(resources.files('tqdm') / name), dst)
|
| 269 |
+
else: # py<3.9
|
| 270 |
+
with resources.path('tqdm', name) as src:
|
| 271 |
+
copyfile(str(src), dst)
|
| 272 |
+
log.info("written:%s", dst)
|
| 273 |
+
if manpath is not None:
|
| 274 |
+
cp('tqdm.1', path.join(manpath, 'tqdm.1'))
|
| 275 |
+
if comppath is not None:
|
| 276 |
+
cp('completion.sh', path.join(comppath, 'tqdm_completion.sh'))
|
| 277 |
+
sys.exit(0)
|
| 278 |
+
if tee:
|
| 279 |
+
stdout_write = stdout.write
|
| 280 |
+
fp_write = getattr(fp, 'buffer', fp).write
|
| 281 |
+
|
| 282 |
+
class stdout(object): # pylint: disable=function-redefined
|
| 283 |
+
@staticmethod
|
| 284 |
+
def write(x):
|
| 285 |
+
with tqdm.external_write_mode(file=fp):
|
| 286 |
+
fp_write(x)
|
| 287 |
+
stdout_write(x)
|
| 288 |
+
if delim_per_char:
|
| 289 |
+
tqdm_args.setdefault('unit', 'B')
|
| 290 |
+
tqdm_args.setdefault('unit_scale', True)
|
| 291 |
+
tqdm_args.setdefault('unit_divisor', 1024)
|
| 292 |
+
log.debug(tqdm_args)
|
| 293 |
+
with tqdm(**tqdm_args) as t:
|
| 294 |
+
posix_pipe(stdin, stdout, '', buf_size, t.update)
|
| 295 |
+
elif delim == b'\\n':
|
| 296 |
+
log.debug(tqdm_args)
|
| 297 |
+
write = stdout.write
|
| 298 |
+
if update or update_to:
|
| 299 |
+
with tqdm(**tqdm_args) as t:
|
| 300 |
+
if update:
|
| 301 |
+
def callback(i):
|
| 302 |
+
t.update(numeric(i.decode()))
|
| 303 |
+
else: # update_to
|
| 304 |
+
def callback(i):
|
| 305 |
+
t.update(numeric(i.decode()) - t.n)
|
| 306 |
+
for i in stdin:
|
| 307 |
+
write(i)
|
| 308 |
+
callback(i)
|
| 309 |
+
else:
|
| 310 |
+
for i in tqdm(stdin, **tqdm_args):
|
| 311 |
+
write(i)
|
| 312 |
+
else:
|
| 313 |
+
log.debug(tqdm_args)
|
| 314 |
+
with tqdm(**tqdm_args) as t:
|
| 315 |
+
callback_len = False
|
| 316 |
+
if update:
|
| 317 |
+
def callback(i):
|
| 318 |
+
t.update(numeric(i.decode()))
|
| 319 |
+
elif update_to:
|
| 320 |
+
def callback(i):
|
| 321 |
+
t.update(numeric(i.decode()) - t.n)
|
| 322 |
+
else:
|
| 323 |
+
callback = t.update
|
| 324 |
+
callback_len = True
|
| 325 |
+
posix_pipe(stdin, stdout, delim, buf_size, callback, callback_len)
|
parrot/lib/python3.10/site-packages/tqdm/completion.sh
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
_tqdm(){
|
| 3 |
+
local cur prv
|
| 4 |
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
| 5 |
+
prv="${COMP_WORDS[COMP_CWORD - 1]}"
|
| 6 |
+
|
| 7 |
+
case ${prv} in
|
| 8 |
+
--bar_format|--buf_size|--colour|--comppath|--delay|--delim|--desc|--initial|--lock_args|--manpath|--maxinterval|--mininterval|--miniters|--ncols|--nrows|--position|--postfix|--smoothing|--total|--unit|--unit_divisor)
|
| 9 |
+
# await user input
|
| 10 |
+
;;
|
| 11 |
+
"--log")
|
| 12 |
+
COMPREPLY=($(compgen -W 'CRITICAL FATAL ERROR WARN WARNING INFO DEBUG NOTSET' -- ${cur}))
|
| 13 |
+
;;
|
| 14 |
+
*)
|
| 15 |
+
COMPREPLY=($(compgen -W '--ascii --bar_format --buf_size --bytes --colour --comppath --delay --delim --desc --disable --dynamic_ncols --help --initial --leave --lock_args --log --manpath --maxinterval --mininterval --miniters --ncols --nrows --null --position --postfix --smoothing --tee --total --unit --unit_divisor --unit_scale --update --update_to --version --write_bytes -h -v' -- ${cur}))
|
| 16 |
+
;;
|
| 17 |
+
esac
|
| 18 |
+
}
|
| 19 |
+
complete -F _tqdm tqdm
|
parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (3 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/bells.cpython-310.pyc
ADDED
|
Binary file (1.02 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/concurrent.cpython-310.pyc
ADDED
|
Binary file (3.62 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/discord.cpython-310.pyc
ADDED
|
Binary file (4.28 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/logging.cpython-310.pyc
ADDED
|
Binary file (3.89 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/slack.cpython-310.pyc
ADDED
|
Binary file (4.31 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/telegram.cpython-310.pyc
ADDED
|
Binary file (5.26 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/contrib/__pycache__/utils_worker.cpython-310.pyc
ADDED
|
Binary file (1.47 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/tqdm/contrib/itertools.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Thin wrappers around `itertools`.
|
| 3 |
+
"""
|
| 4 |
+
import itertools
|
| 5 |
+
|
| 6 |
+
from ..auto import tqdm as tqdm_auto
|
| 7 |
+
|
| 8 |
+
__author__ = {"github.com/": ["casperdcl"]}
|
| 9 |
+
__all__ = ['product']
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def product(*iterables, **tqdm_kwargs):
|
| 13 |
+
"""
|
| 14 |
+
Equivalent of `itertools.product`.
|
| 15 |
+
|
| 16 |
+
Parameters
|
| 17 |
+
----------
|
| 18 |
+
tqdm_class : [default: tqdm.auto.tqdm].
|
| 19 |
+
"""
|
| 20 |
+
kwargs = tqdm_kwargs.copy()
|
| 21 |
+
tqdm_class = kwargs.pop("tqdm_class", tqdm_auto)
|
| 22 |
+
try:
|
| 23 |
+
lens = list(map(len, iterables))
|
| 24 |
+
except TypeError:
|
| 25 |
+
total = None
|
| 26 |
+
else:
|
| 27 |
+
total = 1
|
| 28 |
+
for i in lens:
|
| 29 |
+
total *= i
|
| 30 |
+
kwargs.setdefault("total", total)
|
| 31 |
+
with tqdm_class(**kwargs) as t:
|
| 32 |
+
it = itertools.product(*iterables)
|
| 33 |
+
for i in it:
|
| 34 |
+
yield i
|
| 35 |
+
t.update()
|
parrot/lib/python3.10/site-packages/tqdm/contrib/logging.py
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Helper functionality for interoperability with stdlib `logging`.
|
| 3 |
+
"""
|
| 4 |
+
import logging
|
| 5 |
+
import sys
|
| 6 |
+
from contextlib import contextmanager
|
| 7 |
+
|
| 8 |
+
try:
|
| 9 |
+
from typing import Iterator, List, Optional, Type # noqa: F401
|
| 10 |
+
except ImportError:
|
| 11 |
+
pass
|
| 12 |
+
|
| 13 |
+
from ..std import tqdm as std_tqdm
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class _TqdmLoggingHandler(logging.StreamHandler):
|
| 17 |
+
def __init__(
|
| 18 |
+
self,
|
| 19 |
+
tqdm_class=std_tqdm # type: Type[std_tqdm]
|
| 20 |
+
):
|
| 21 |
+
super().__init__()
|
| 22 |
+
self.tqdm_class = tqdm_class
|
| 23 |
+
|
| 24 |
+
def emit(self, record):
|
| 25 |
+
try:
|
| 26 |
+
msg = self.format(record)
|
| 27 |
+
self.tqdm_class.write(msg, file=self.stream)
|
| 28 |
+
self.flush()
|
| 29 |
+
except (KeyboardInterrupt, SystemExit):
|
| 30 |
+
raise
|
| 31 |
+
except: # noqa pylint: disable=bare-except
|
| 32 |
+
self.handleError(record)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def _is_console_logging_handler(handler):
|
| 36 |
+
return (isinstance(handler, logging.StreamHandler)
|
| 37 |
+
and handler.stream in {sys.stdout, sys.stderr})
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def _get_first_found_console_logging_handler(handlers):
|
| 41 |
+
for handler in handlers:
|
| 42 |
+
if _is_console_logging_handler(handler):
|
| 43 |
+
return handler
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
@contextmanager
|
| 47 |
+
def logging_redirect_tqdm(
|
| 48 |
+
loggers=None, # type: Optional[List[logging.Logger]],
|
| 49 |
+
tqdm_class=std_tqdm # type: Type[std_tqdm]
|
| 50 |
+
):
|
| 51 |
+
# type: (...) -> Iterator[None]
|
| 52 |
+
"""
|
| 53 |
+
Context manager redirecting console logging to `tqdm.write()`, leaving
|
| 54 |
+
other logging handlers (e.g. log files) unaffected.
|
| 55 |
+
|
| 56 |
+
Parameters
|
| 57 |
+
----------
|
| 58 |
+
loggers : list, optional
|
| 59 |
+
Which handlers to redirect (default: [logging.root]).
|
| 60 |
+
tqdm_class : optional
|
| 61 |
+
|
| 62 |
+
Example
|
| 63 |
+
-------
|
| 64 |
+
```python
|
| 65 |
+
import logging
|
| 66 |
+
from tqdm import trange
|
| 67 |
+
from tqdm.contrib.logging import logging_redirect_tqdm
|
| 68 |
+
|
| 69 |
+
LOG = logging.getLogger(__name__)
|
| 70 |
+
|
| 71 |
+
if __name__ == '__main__':
|
| 72 |
+
logging.basicConfig(level=logging.INFO)
|
| 73 |
+
with logging_redirect_tqdm():
|
| 74 |
+
for i in trange(9):
|
| 75 |
+
if i == 4:
|
| 76 |
+
LOG.info("console logging redirected to `tqdm.write()`")
|
| 77 |
+
# logging restored
|
| 78 |
+
```
|
| 79 |
+
"""
|
| 80 |
+
if loggers is None:
|
| 81 |
+
loggers = [logging.root]
|
| 82 |
+
original_handlers_list = [logger.handlers for logger in loggers]
|
| 83 |
+
try:
|
| 84 |
+
for logger in loggers:
|
| 85 |
+
tqdm_handler = _TqdmLoggingHandler(tqdm_class)
|
| 86 |
+
orig_handler = _get_first_found_console_logging_handler(logger.handlers)
|
| 87 |
+
if orig_handler is not None:
|
| 88 |
+
tqdm_handler.setFormatter(orig_handler.formatter)
|
| 89 |
+
tqdm_handler.stream = orig_handler.stream
|
| 90 |
+
logger.handlers = [
|
| 91 |
+
handler for handler in logger.handlers
|
| 92 |
+
if not _is_console_logging_handler(handler)] + [tqdm_handler]
|
| 93 |
+
yield
|
| 94 |
+
finally:
|
| 95 |
+
for logger, original_handlers in zip(loggers, original_handlers_list):
|
| 96 |
+
logger.handlers = original_handlers
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
@contextmanager
|
| 100 |
+
def tqdm_logging_redirect(
|
| 101 |
+
*args,
|
| 102 |
+
# loggers=None, # type: Optional[List[logging.Logger]]
|
| 103 |
+
# tqdm=None, # type: Optional[Type[tqdm.tqdm]]
|
| 104 |
+
**kwargs
|
| 105 |
+
):
|
| 106 |
+
# type: (...) -> Iterator[None]
|
| 107 |
+
"""
|
| 108 |
+
Convenience shortcut for:
|
| 109 |
+
```python
|
| 110 |
+
with tqdm_class(*args, **tqdm_kwargs) as pbar:
|
| 111 |
+
with logging_redirect_tqdm(loggers=loggers, tqdm_class=tqdm_class):
|
| 112 |
+
yield pbar
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
Parameters
|
| 116 |
+
----------
|
| 117 |
+
tqdm_class : optional, (default: tqdm.std.tqdm).
|
| 118 |
+
loggers : optional, list.
|
| 119 |
+
**tqdm_kwargs : passed to `tqdm_class`.
|
| 120 |
+
"""
|
| 121 |
+
tqdm_kwargs = kwargs.copy()
|
| 122 |
+
loggers = tqdm_kwargs.pop('loggers', None)
|
| 123 |
+
tqdm_class = tqdm_kwargs.pop('tqdm_class', std_tqdm)
|
| 124 |
+
with tqdm_class(*args, **tqdm_kwargs) as pbar:
|
| 125 |
+
with logging_redirect_tqdm(loggers=loggers, tqdm_class=tqdm_class):
|
| 126 |
+
yield pbar
|
parrot/lib/python3.10/site-packages/tqdm/contrib/telegram.py
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Sends updates to a Telegram bot.
|
| 3 |
+
|
| 4 |
+
Usage:
|
| 5 |
+
>>> from tqdm.contrib.telegram import tqdm, trange
|
| 6 |
+
>>> for i in trange(10, token='{token}', chat_id='{chat_id}'):
|
| 7 |
+
... ...
|
| 8 |
+
|
| 9 |
+

|
| 10 |
+
"""
|
| 11 |
+
from os import getenv
|
| 12 |
+
from warnings import warn
|
| 13 |
+
|
| 14 |
+
from requests import Session
|
| 15 |
+
|
| 16 |
+
from ..auto import tqdm as tqdm_auto
|
| 17 |
+
from ..std import TqdmWarning
|
| 18 |
+
from .utils_worker import MonoWorker
|
| 19 |
+
|
| 20 |
+
__author__ = {"github.com/": ["casperdcl"]}
|
| 21 |
+
__all__ = ['TelegramIO', 'tqdm_telegram', 'ttgrange', 'tqdm', 'trange']
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class TelegramIO(MonoWorker):
|
| 25 |
+
"""Non-blocking file-like IO using a Telegram Bot."""
|
| 26 |
+
API = 'https://api.telegram.org/bot'
|
| 27 |
+
|
| 28 |
+
def __init__(self, token, chat_id):
|
| 29 |
+
"""Creates a new message in the given `chat_id`."""
|
| 30 |
+
super().__init__()
|
| 31 |
+
self.token = token
|
| 32 |
+
self.chat_id = chat_id
|
| 33 |
+
self.session = Session()
|
| 34 |
+
self.text = self.__class__.__name__
|
| 35 |
+
self.message_id
|
| 36 |
+
|
| 37 |
+
@property
|
| 38 |
+
def message_id(self):
|
| 39 |
+
if hasattr(self, '_message_id'):
|
| 40 |
+
return self._message_id
|
| 41 |
+
try:
|
| 42 |
+
res = self.session.post(
|
| 43 |
+
self.API + '%s/sendMessage' % self.token,
|
| 44 |
+
data={'text': '`' + self.text + '`', 'chat_id': self.chat_id,
|
| 45 |
+
'parse_mode': 'MarkdownV2'}).json()
|
| 46 |
+
except Exception as e:
|
| 47 |
+
tqdm_auto.write(str(e))
|
| 48 |
+
else:
|
| 49 |
+
if res.get('error_code') == 429:
|
| 50 |
+
warn("Creation rate limit: try increasing `mininterval`.",
|
| 51 |
+
TqdmWarning, stacklevel=2)
|
| 52 |
+
else:
|
| 53 |
+
self._message_id = res['result']['message_id']
|
| 54 |
+
return self._message_id
|
| 55 |
+
|
| 56 |
+
def write(self, s):
|
| 57 |
+
"""Replaces internal `message_id`'s text with `s`."""
|
| 58 |
+
if not s:
|
| 59 |
+
s = "..."
|
| 60 |
+
s = s.replace('\r', '').strip()
|
| 61 |
+
if s == self.text:
|
| 62 |
+
return # avoid duplicate message Bot error
|
| 63 |
+
message_id = self.message_id
|
| 64 |
+
if message_id is None:
|
| 65 |
+
return
|
| 66 |
+
self.text = s
|
| 67 |
+
try:
|
| 68 |
+
future = self.submit(
|
| 69 |
+
self.session.post, self.API + '%s/editMessageText' % self.token,
|
| 70 |
+
data={'text': '`' + s + '`', 'chat_id': self.chat_id,
|
| 71 |
+
'message_id': message_id, 'parse_mode': 'MarkdownV2'})
|
| 72 |
+
except Exception as e:
|
| 73 |
+
tqdm_auto.write(str(e))
|
| 74 |
+
else:
|
| 75 |
+
return future
|
| 76 |
+
|
| 77 |
+
def delete(self):
|
| 78 |
+
"""Deletes internal `message_id`."""
|
| 79 |
+
try:
|
| 80 |
+
future = self.submit(
|
| 81 |
+
self.session.post, self.API + '%s/deleteMessage' % self.token,
|
| 82 |
+
data={'chat_id': self.chat_id, 'message_id': self.message_id})
|
| 83 |
+
except Exception as e:
|
| 84 |
+
tqdm_auto.write(str(e))
|
| 85 |
+
else:
|
| 86 |
+
return future
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
class tqdm_telegram(tqdm_auto):
|
| 90 |
+
"""
|
| 91 |
+
Standard `tqdm.auto.tqdm` but also sends updates to a Telegram Bot.
|
| 92 |
+
May take a few seconds to create (`__init__`).
|
| 93 |
+
|
| 94 |
+
- create a bot <https://core.telegram.org/bots#6-botfather>
|
| 95 |
+
- copy its `{token}`
|
| 96 |
+
- add the bot to a chat and send it a message such as `/start`
|
| 97 |
+
- go to <https://api.telegram.org/bot`{token}`/getUpdates> to find out
|
| 98 |
+
the `{chat_id}`
|
| 99 |
+
- paste the `{token}` & `{chat_id}` below
|
| 100 |
+
|
| 101 |
+
>>> from tqdm.contrib.telegram import tqdm, trange
|
| 102 |
+
>>> for i in tqdm(iterable, token='{token}', chat_id='{chat_id}'):
|
| 103 |
+
... ...
|
| 104 |
+
"""
|
| 105 |
+
def __init__(self, *args, **kwargs):
|
| 106 |
+
"""
|
| 107 |
+
Parameters
|
| 108 |
+
----------
|
| 109 |
+
token : str, required. Telegram token
|
| 110 |
+
[default: ${TQDM_TELEGRAM_TOKEN}].
|
| 111 |
+
chat_id : str, required. Telegram chat ID
|
| 112 |
+
[default: ${TQDM_TELEGRAM_CHAT_ID}].
|
| 113 |
+
|
| 114 |
+
See `tqdm.auto.tqdm.__init__` for other parameters.
|
| 115 |
+
"""
|
| 116 |
+
if not kwargs.get('disable'):
|
| 117 |
+
kwargs = kwargs.copy()
|
| 118 |
+
self.tgio = TelegramIO(
|
| 119 |
+
kwargs.pop('token', getenv('TQDM_TELEGRAM_TOKEN')),
|
| 120 |
+
kwargs.pop('chat_id', getenv('TQDM_TELEGRAM_CHAT_ID')))
|
| 121 |
+
super().__init__(*args, **kwargs)
|
| 122 |
+
|
| 123 |
+
def display(self, **kwargs):
|
| 124 |
+
super().display(**kwargs)
|
| 125 |
+
fmt = self.format_dict
|
| 126 |
+
if fmt.get('bar_format', None):
|
| 127 |
+
fmt['bar_format'] = fmt['bar_format'].replace(
|
| 128 |
+
'<bar/>', '{bar:10u}').replace('{bar}', '{bar:10u}')
|
| 129 |
+
else:
|
| 130 |
+
fmt['bar_format'] = '{l_bar}{bar:10u}{r_bar}'
|
| 131 |
+
self.tgio.write(self.format_meter(**fmt))
|
| 132 |
+
|
| 133 |
+
def clear(self, *args, **kwargs):
|
| 134 |
+
super().clear(*args, **kwargs)
|
| 135 |
+
if not self.disable:
|
| 136 |
+
self.tgio.write("")
|
| 137 |
+
|
| 138 |
+
def close(self):
|
| 139 |
+
if self.disable:
|
| 140 |
+
return
|
| 141 |
+
super().close()
|
| 142 |
+
if not (self.leave or (self.leave is None and self.pos == 0)):
|
| 143 |
+
self.tgio.delete()
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
def ttgrange(*args, **kwargs):
|
| 147 |
+
"""Shortcut for `tqdm.contrib.telegram.tqdm(range(*args), **kwargs)`."""
|
| 148 |
+
return tqdm_telegram(range(*args), **kwargs)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
# Aliases
|
| 152 |
+
tqdm = tqdm_telegram
|
| 153 |
+
trange = ttgrange
|
parrot/lib/python3.10/site-packages/tqdm/contrib/utils_worker.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
IO/concurrency helpers for `tqdm.contrib`.
|
| 3 |
+
"""
|
| 4 |
+
from collections import deque
|
| 5 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 6 |
+
|
| 7 |
+
from ..auto import tqdm as tqdm_auto
|
| 8 |
+
|
| 9 |
+
__author__ = {"github.com/": ["casperdcl"]}
|
| 10 |
+
__all__ = ['MonoWorker']
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class MonoWorker(object):
|
| 14 |
+
"""
|
| 15 |
+
Supports one running task and one waiting task.
|
| 16 |
+
The waiting task is the most recent submitted (others are discarded).
|
| 17 |
+
"""
|
| 18 |
+
def __init__(self):
|
| 19 |
+
self.pool = ThreadPoolExecutor(max_workers=1)
|
| 20 |
+
self.futures = deque([], 2)
|
| 21 |
+
|
| 22 |
+
def submit(self, func, *args, **kwargs):
|
| 23 |
+
"""`func(*args, **kwargs)` may replace currently waiting task."""
|
| 24 |
+
futures = self.futures
|
| 25 |
+
if len(futures) == futures.maxlen:
|
| 26 |
+
running = futures.popleft()
|
| 27 |
+
if not running.done():
|
| 28 |
+
if len(futures): # clear waiting
|
| 29 |
+
waiting = futures.pop()
|
| 30 |
+
waiting.cancel()
|
| 31 |
+
futures.appendleft(running) # re-insert running
|
| 32 |
+
try:
|
| 33 |
+
waiting = self.pool.submit(func, *args, **kwargs)
|
| 34 |
+
except Exception as e:
|
| 35 |
+
tqdm_auto.write(str(e))
|
| 36 |
+
else:
|
| 37 |
+
futures.append(waiting)
|
| 38 |
+
return waiting
|
parrot/lib/python3.10/site-packages/tqdm/keras.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from copy import copy
|
| 2 |
+
from functools import partial
|
| 3 |
+
|
| 4 |
+
from .auto import tqdm as tqdm_auto
|
| 5 |
+
|
| 6 |
+
try:
|
| 7 |
+
import keras
|
| 8 |
+
except (ImportError, AttributeError) as e:
|
| 9 |
+
try:
|
| 10 |
+
from tensorflow import keras
|
| 11 |
+
except ImportError:
|
| 12 |
+
raise e
|
| 13 |
+
__author__ = {"github.com/": ["casperdcl"]}
|
| 14 |
+
__all__ = ['TqdmCallback']
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class TqdmCallback(keras.callbacks.Callback):
|
| 18 |
+
"""Keras callback for epoch and batch progress."""
|
| 19 |
+
@staticmethod
|
| 20 |
+
def bar2callback(bar, pop=None, delta=(lambda logs: 1)):
|
| 21 |
+
def callback(_, logs=None):
|
| 22 |
+
n = delta(logs)
|
| 23 |
+
if logs:
|
| 24 |
+
if pop:
|
| 25 |
+
logs = copy(logs)
|
| 26 |
+
[logs.pop(i, 0) for i in pop]
|
| 27 |
+
bar.set_postfix(logs, refresh=False)
|
| 28 |
+
bar.update(n)
|
| 29 |
+
|
| 30 |
+
return callback
|
| 31 |
+
|
| 32 |
+
def __init__(self, epochs=None, data_size=None, batch_size=None, verbose=1,
|
| 33 |
+
tqdm_class=tqdm_auto, **tqdm_kwargs):
|
| 34 |
+
"""
|
| 35 |
+
Parameters
|
| 36 |
+
----------
|
| 37 |
+
epochs : int, optional
|
| 38 |
+
data_size : int, optional
|
| 39 |
+
Number of training pairs.
|
| 40 |
+
batch_size : int, optional
|
| 41 |
+
Number of training pairs per batch.
|
| 42 |
+
verbose : int
|
| 43 |
+
0: epoch, 1: batch (transient), 2: batch. [default: 1].
|
| 44 |
+
Will be set to `0` unless both `data_size` and `batch_size`
|
| 45 |
+
are given.
|
| 46 |
+
tqdm_class : optional
|
| 47 |
+
`tqdm` class to use for bars [default: `tqdm.auto.tqdm`].
|
| 48 |
+
tqdm_kwargs : optional
|
| 49 |
+
Any other arguments used for all bars.
|
| 50 |
+
"""
|
| 51 |
+
if tqdm_kwargs:
|
| 52 |
+
tqdm_class = partial(tqdm_class, **tqdm_kwargs)
|
| 53 |
+
self.tqdm_class = tqdm_class
|
| 54 |
+
self.epoch_bar = tqdm_class(total=epochs, unit='epoch')
|
| 55 |
+
self.on_epoch_end = self.bar2callback(self.epoch_bar)
|
| 56 |
+
if data_size and batch_size:
|
| 57 |
+
self.batches = batches = (data_size + batch_size - 1) // batch_size
|
| 58 |
+
else:
|
| 59 |
+
self.batches = batches = None
|
| 60 |
+
self.verbose = verbose
|
| 61 |
+
if verbose == 1:
|
| 62 |
+
self.batch_bar = tqdm_class(total=batches, unit='batch', leave=False)
|
| 63 |
+
self.on_batch_end = self.bar2callback(
|
| 64 |
+
self.batch_bar, pop=['batch', 'size'],
|
| 65 |
+
delta=lambda logs: logs.get('size', 1))
|
| 66 |
+
|
| 67 |
+
def on_train_begin(self, *_, **__):
|
| 68 |
+
params = self.params.get
|
| 69 |
+
auto_total = params('epochs', params('nb_epoch', None))
|
| 70 |
+
if auto_total is not None and auto_total != self.epoch_bar.total:
|
| 71 |
+
self.epoch_bar.reset(total=auto_total)
|
| 72 |
+
|
| 73 |
+
def on_epoch_begin(self, epoch, *_, **__):
|
| 74 |
+
if self.epoch_bar.n < epoch:
|
| 75 |
+
ebar = self.epoch_bar
|
| 76 |
+
ebar.n = ebar.last_print_n = ebar.initial = epoch
|
| 77 |
+
if self.verbose:
|
| 78 |
+
params = self.params.get
|
| 79 |
+
total = params('samples', params(
|
| 80 |
+
'nb_sample', params('steps', None))) or self.batches
|
| 81 |
+
if self.verbose == 2:
|
| 82 |
+
if hasattr(self, 'batch_bar'):
|
| 83 |
+
self.batch_bar.close()
|
| 84 |
+
self.batch_bar = self.tqdm_class(
|
| 85 |
+
total=total, unit='batch', leave=True,
|
| 86 |
+
unit_scale=1 / (params('batch_size', 1) or 1))
|
| 87 |
+
self.on_batch_end = self.bar2callback(
|
| 88 |
+
self.batch_bar, pop=['batch', 'size'],
|
| 89 |
+
delta=lambda logs: logs.get('size', 1))
|
| 90 |
+
elif self.verbose == 1:
|
| 91 |
+
self.batch_bar.unit_scale = 1 / (params('batch_size', 1) or 1)
|
| 92 |
+
self.batch_bar.reset(total=total)
|
| 93 |
+
else:
|
| 94 |
+
raise KeyError('Unknown verbosity')
|
| 95 |
+
|
| 96 |
+
def on_train_end(self, *_, **__):
|
| 97 |
+
if hasattr(self, 'batch_bar'):
|
| 98 |
+
self.batch_bar.close()
|
| 99 |
+
self.epoch_bar.close()
|
| 100 |
+
|
| 101 |
+
def display(self):
|
| 102 |
+
"""Displays in the current cell in Notebooks."""
|
| 103 |
+
container = getattr(self.epoch_bar, 'container', None)
|
| 104 |
+
if container is None:
|
| 105 |
+
return
|
| 106 |
+
from .notebook import display
|
| 107 |
+
display(container)
|
| 108 |
+
batch_bar = getattr(self, 'batch_bar', None)
|
| 109 |
+
if batch_bar is not None:
|
| 110 |
+
display(batch_bar.container)
|
| 111 |
+
|
| 112 |
+
@staticmethod
|
| 113 |
+
def _implements_train_batch_hooks():
|
| 114 |
+
return True
|
| 115 |
+
|
| 116 |
+
@staticmethod
|
| 117 |
+
def _implements_test_batch_hooks():
|
| 118 |
+
return True
|
| 119 |
+
|
| 120 |
+
@staticmethod
|
| 121 |
+
def _implements_predict_batch_hooks():
|
| 122 |
+
return True
|
parrot/lib/python3.10/site-packages/tqdm/notebook.py
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
IPython/Jupyter Notebook progressbar decorator for iterators.
|
| 3 |
+
Includes a default `range` iterator printing to `stderr`.
|
| 4 |
+
|
| 5 |
+
Usage:
|
| 6 |
+
>>> from tqdm.notebook import trange, tqdm
|
| 7 |
+
>>> for i in trange(10):
|
| 8 |
+
... ...
|
| 9 |
+
"""
|
| 10 |
+
# import compatibility functions and utilities
|
| 11 |
+
import re
|
| 12 |
+
import sys
|
| 13 |
+
from html import escape
|
| 14 |
+
from weakref import proxy
|
| 15 |
+
|
| 16 |
+
# to inherit from the tqdm class
|
| 17 |
+
from .std import tqdm as std_tqdm
|
| 18 |
+
|
| 19 |
+
if True: # pragma: no cover
|
| 20 |
+
# import IPython/Jupyter base widget and display utilities
|
| 21 |
+
IPY = 0
|
| 22 |
+
try: # IPython 4.x
|
| 23 |
+
import ipywidgets
|
| 24 |
+
IPY = 4
|
| 25 |
+
except ImportError: # IPython 3.x / 2.x
|
| 26 |
+
IPY = 32
|
| 27 |
+
import warnings
|
| 28 |
+
with warnings.catch_warnings():
|
| 29 |
+
warnings.filterwarnings(
|
| 30 |
+
'ignore', message=".*The `IPython.html` package has been deprecated.*")
|
| 31 |
+
try:
|
| 32 |
+
import IPython.html.widgets as ipywidgets # NOQA: F401
|
| 33 |
+
except ImportError:
|
| 34 |
+
pass
|
| 35 |
+
|
| 36 |
+
try: # IPython 4.x / 3.x
|
| 37 |
+
if IPY == 32:
|
| 38 |
+
from IPython.html.widgets import HTML
|
| 39 |
+
from IPython.html.widgets import FloatProgress as IProgress
|
| 40 |
+
from IPython.html.widgets import HBox
|
| 41 |
+
IPY = 3
|
| 42 |
+
else:
|
| 43 |
+
from ipywidgets import HTML
|
| 44 |
+
from ipywidgets import FloatProgress as IProgress
|
| 45 |
+
from ipywidgets import HBox
|
| 46 |
+
except ImportError:
|
| 47 |
+
try: # IPython 2.x
|
| 48 |
+
from IPython.html.widgets import HTML
|
| 49 |
+
from IPython.html.widgets import ContainerWidget as HBox
|
| 50 |
+
from IPython.html.widgets import FloatProgressWidget as IProgress
|
| 51 |
+
IPY = 2
|
| 52 |
+
except ImportError:
|
| 53 |
+
IPY = 0
|
| 54 |
+
IProgress = None
|
| 55 |
+
HBox = object
|
| 56 |
+
|
| 57 |
+
try:
|
| 58 |
+
from IPython.display import display # , clear_output
|
| 59 |
+
except ImportError:
|
| 60 |
+
pass
|
| 61 |
+
|
| 62 |
+
__author__ = {"github.com/": ["lrq3000", "casperdcl", "alexanderkuk"]}
|
| 63 |
+
__all__ = ['tqdm_notebook', 'tnrange', 'tqdm', 'trange']
|
| 64 |
+
WARN_NOIPYW = ("IProgress not found. Please update jupyter and ipywidgets."
|
| 65 |
+
" See https://ipywidgets.readthedocs.io/en/stable"
|
| 66 |
+
"/user_install.html")
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class TqdmHBox(HBox):
|
| 70 |
+
"""`ipywidgets.HBox` with a pretty representation"""
|
| 71 |
+
def _json_(self, pretty=None):
|
| 72 |
+
pbar = getattr(self, 'pbar', None)
|
| 73 |
+
if pbar is None:
|
| 74 |
+
return {}
|
| 75 |
+
d = pbar.format_dict
|
| 76 |
+
if pretty is not None:
|
| 77 |
+
d["ascii"] = not pretty
|
| 78 |
+
return d
|
| 79 |
+
|
| 80 |
+
def __repr__(self, pretty=False):
|
| 81 |
+
pbar = getattr(self, 'pbar', None)
|
| 82 |
+
if pbar is None:
|
| 83 |
+
return super().__repr__()
|
| 84 |
+
return pbar.format_meter(**self._json_(pretty))
|
| 85 |
+
|
| 86 |
+
def _repr_pretty_(self, pp, *_, **__):
|
| 87 |
+
pp.text(self.__repr__(True))
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
class tqdm_notebook(std_tqdm):
|
| 91 |
+
"""
|
| 92 |
+
Experimental IPython/Jupyter Notebook widget using tqdm!
|
| 93 |
+
"""
|
| 94 |
+
@staticmethod
|
| 95 |
+
def status_printer(_, total=None, desc=None, ncols=None):
|
| 96 |
+
"""
|
| 97 |
+
Manage the printing of an IPython/Jupyter Notebook progress bar widget.
|
| 98 |
+
"""
|
| 99 |
+
# Fallback to text bar if there's no total
|
| 100 |
+
# DEPRECATED: replaced with an 'info' style bar
|
| 101 |
+
# if not total:
|
| 102 |
+
# return super(tqdm_notebook, tqdm_notebook).status_printer(file)
|
| 103 |
+
|
| 104 |
+
# fp = file
|
| 105 |
+
|
| 106 |
+
# Prepare IPython progress bar
|
| 107 |
+
if IProgress is None: # #187 #451 #558 #872
|
| 108 |
+
raise ImportError(WARN_NOIPYW)
|
| 109 |
+
if total:
|
| 110 |
+
pbar = IProgress(min=0, max=total)
|
| 111 |
+
else: # No total? Show info style bar with no progress tqdm status
|
| 112 |
+
pbar = IProgress(min=0, max=1)
|
| 113 |
+
pbar.value = 1
|
| 114 |
+
pbar.bar_style = 'info'
|
| 115 |
+
if ncols is None:
|
| 116 |
+
pbar.layout.width = "20px"
|
| 117 |
+
|
| 118 |
+
ltext = HTML()
|
| 119 |
+
rtext = HTML()
|
| 120 |
+
if desc:
|
| 121 |
+
ltext.value = desc
|
| 122 |
+
container = TqdmHBox(children=[ltext, pbar, rtext])
|
| 123 |
+
# Prepare layout
|
| 124 |
+
if ncols is not None: # use default style of ipywidgets
|
| 125 |
+
# ncols could be 100, "100px", "100%"
|
| 126 |
+
ncols = str(ncols) # ipywidgets only accepts string
|
| 127 |
+
try:
|
| 128 |
+
if int(ncols) > 0: # isnumeric and positive
|
| 129 |
+
ncols += 'px'
|
| 130 |
+
except ValueError:
|
| 131 |
+
pass
|
| 132 |
+
pbar.layout.flex = '2'
|
| 133 |
+
container.layout.width = ncols
|
| 134 |
+
container.layout.display = 'inline-flex'
|
| 135 |
+
container.layout.flex_flow = 'row wrap'
|
| 136 |
+
|
| 137 |
+
return container
|
| 138 |
+
|
| 139 |
+
def display(self, msg=None, pos=None,
|
| 140 |
+
# additional signals
|
| 141 |
+
close=False, bar_style=None, check_delay=True):
|
| 142 |
+
# Note: contrary to native tqdm, msg='' does NOT clear bar
|
| 143 |
+
# goal is to keep all infos if error happens so user knows
|
| 144 |
+
# at which iteration the loop failed.
|
| 145 |
+
|
| 146 |
+
# Clear previous output (really necessary?)
|
| 147 |
+
# clear_output(wait=1)
|
| 148 |
+
|
| 149 |
+
if not msg and not close:
|
| 150 |
+
d = self.format_dict
|
| 151 |
+
# remove {bar}
|
| 152 |
+
d['bar_format'] = (d['bar_format'] or "{l_bar}<bar/>{r_bar}").replace(
|
| 153 |
+
"{bar}", "<bar/>")
|
| 154 |
+
msg = self.format_meter(**d)
|
| 155 |
+
|
| 156 |
+
ltext, pbar, rtext = self.container.children
|
| 157 |
+
pbar.value = self.n
|
| 158 |
+
|
| 159 |
+
if msg:
|
| 160 |
+
msg = msg.replace(' ', u'\u2007') # fix html space padding
|
| 161 |
+
# html escape special characters (like '&')
|
| 162 |
+
if '<bar/>' in msg:
|
| 163 |
+
left, right = map(escape, re.split(r'\|?<bar/>\|?', msg, maxsplit=1))
|
| 164 |
+
else:
|
| 165 |
+
left, right = '', escape(msg)
|
| 166 |
+
|
| 167 |
+
# Update description
|
| 168 |
+
ltext.value = left
|
| 169 |
+
# never clear the bar (signal: msg='')
|
| 170 |
+
if right:
|
| 171 |
+
rtext.value = right
|
| 172 |
+
|
| 173 |
+
# Change bar style
|
| 174 |
+
if bar_style:
|
| 175 |
+
# Hack-ish way to avoid the danger bar_style being overridden by
|
| 176 |
+
# success because the bar gets closed after the error...
|
| 177 |
+
if pbar.bar_style != 'danger' or bar_style != 'success':
|
| 178 |
+
pbar.bar_style = bar_style
|
| 179 |
+
|
| 180 |
+
# Special signal to close the bar
|
| 181 |
+
if close and pbar.bar_style != 'danger': # hide only if no error
|
| 182 |
+
try:
|
| 183 |
+
self.container.close()
|
| 184 |
+
except AttributeError:
|
| 185 |
+
self.container.visible = False
|
| 186 |
+
self.container.layout.visibility = 'hidden' # IPYW>=8
|
| 187 |
+
|
| 188 |
+
if check_delay and self.delay > 0 and not self.displayed:
|
| 189 |
+
display(self.container)
|
| 190 |
+
self.displayed = True
|
| 191 |
+
|
| 192 |
+
@property
|
| 193 |
+
def colour(self):
|
| 194 |
+
if hasattr(self, 'container'):
|
| 195 |
+
return self.container.children[-2].style.bar_color
|
| 196 |
+
|
| 197 |
+
@colour.setter
|
| 198 |
+
def colour(self, bar_color):
|
| 199 |
+
if hasattr(self, 'container'):
|
| 200 |
+
self.container.children[-2].style.bar_color = bar_color
|
| 201 |
+
|
| 202 |
+
def __init__(self, *args, **kwargs):
|
| 203 |
+
"""
|
| 204 |
+
Supports the usual `tqdm.tqdm` parameters as well as those listed below.
|
| 205 |
+
|
| 206 |
+
Parameters
|
| 207 |
+
----------
|
| 208 |
+
display : Whether to call `display(self.container)` immediately
|
| 209 |
+
[default: True].
|
| 210 |
+
"""
|
| 211 |
+
kwargs = kwargs.copy()
|
| 212 |
+
# Setup default output
|
| 213 |
+
file_kwarg = kwargs.get('file', sys.stderr)
|
| 214 |
+
if file_kwarg is sys.stderr or file_kwarg is None:
|
| 215 |
+
kwargs['file'] = sys.stdout # avoid the red block in IPython
|
| 216 |
+
|
| 217 |
+
# Initialize parent class + avoid printing by using gui=True
|
| 218 |
+
kwargs['gui'] = True
|
| 219 |
+
# convert disable = None to False
|
| 220 |
+
kwargs['disable'] = bool(kwargs.get('disable', False))
|
| 221 |
+
colour = kwargs.pop('colour', None)
|
| 222 |
+
display_here = kwargs.pop('display', True)
|
| 223 |
+
super().__init__(*args, **kwargs)
|
| 224 |
+
if self.disable or not kwargs['gui']:
|
| 225 |
+
self.disp = lambda *_, **__: None
|
| 226 |
+
return
|
| 227 |
+
|
| 228 |
+
# Get bar width
|
| 229 |
+
self.ncols = '100%' if self.dynamic_ncols else kwargs.get("ncols", None)
|
| 230 |
+
|
| 231 |
+
# Replace with IPython progress bar display (with correct total)
|
| 232 |
+
unit_scale = 1 if self.unit_scale is True else self.unit_scale or 1
|
| 233 |
+
total = self.total * unit_scale if self.total else self.total
|
| 234 |
+
self.container = self.status_printer(self.fp, total, self.desc, self.ncols)
|
| 235 |
+
self.container.pbar = proxy(self)
|
| 236 |
+
self.displayed = False
|
| 237 |
+
if display_here and self.delay <= 0:
|
| 238 |
+
display(self.container)
|
| 239 |
+
self.displayed = True
|
| 240 |
+
self.disp = self.display
|
| 241 |
+
self.colour = colour
|
| 242 |
+
|
| 243 |
+
# Print initial bar state
|
| 244 |
+
if not self.disable:
|
| 245 |
+
self.display(check_delay=False)
|
| 246 |
+
|
| 247 |
+
def __iter__(self):
|
| 248 |
+
try:
|
| 249 |
+
it = super().__iter__()
|
| 250 |
+
for obj in it:
|
| 251 |
+
# return super(tqdm...) will not catch exception
|
| 252 |
+
yield obj
|
| 253 |
+
# NB: except ... [ as ...] breaks IPython async KeyboardInterrupt
|
| 254 |
+
except: # NOQA
|
| 255 |
+
self.disp(bar_style='danger')
|
| 256 |
+
raise
|
| 257 |
+
# NB: don't `finally: close()`
|
| 258 |
+
# since this could be a shared bar which the user will `reset()`
|
| 259 |
+
|
| 260 |
+
def update(self, n=1):
|
| 261 |
+
try:
|
| 262 |
+
return super().update(n=n)
|
| 263 |
+
# NB: except ... [ as ...] breaks IPython async KeyboardInterrupt
|
| 264 |
+
except: # NOQA
|
| 265 |
+
# cannot catch KeyboardInterrupt when using manual tqdm
|
| 266 |
+
# as the interrupt will most likely happen on another statement
|
| 267 |
+
self.disp(bar_style='danger')
|
| 268 |
+
raise
|
| 269 |
+
# NB: don't `finally: close()`
|
| 270 |
+
# since this could be a shared bar which the user will `reset()`
|
| 271 |
+
|
| 272 |
+
def close(self):
|
| 273 |
+
if self.disable:
|
| 274 |
+
return
|
| 275 |
+
super().close()
|
| 276 |
+
# Try to detect if there was an error or KeyboardInterrupt
|
| 277 |
+
# in manual mode: if n < total, things probably got wrong
|
| 278 |
+
if self.total and self.n < self.total:
|
| 279 |
+
self.disp(bar_style='danger', check_delay=False)
|
| 280 |
+
else:
|
| 281 |
+
if self.leave:
|
| 282 |
+
self.disp(bar_style='success', check_delay=False)
|
| 283 |
+
else:
|
| 284 |
+
self.disp(close=True, check_delay=False)
|
| 285 |
+
|
| 286 |
+
def clear(self, *_, **__):
|
| 287 |
+
pass
|
| 288 |
+
|
| 289 |
+
def reset(self, total=None):
|
| 290 |
+
"""
|
| 291 |
+
Resets to 0 iterations for repeated use.
|
| 292 |
+
|
| 293 |
+
Consider combining with `leave=True`.
|
| 294 |
+
|
| 295 |
+
Parameters
|
| 296 |
+
----------
|
| 297 |
+
total : int or float, optional. Total to use for the new bar.
|
| 298 |
+
"""
|
| 299 |
+
if self.disable:
|
| 300 |
+
return super().reset(total=total)
|
| 301 |
+
_, pbar, _ = self.container.children
|
| 302 |
+
pbar.bar_style = ''
|
| 303 |
+
if total is not None:
|
| 304 |
+
pbar.max = total
|
| 305 |
+
if not self.total and self.ncols is None: # no longer unknown total
|
| 306 |
+
pbar.layout.width = None # reset width
|
| 307 |
+
return super().reset(total=total)
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
def tnrange(*args, **kwargs):
|
| 311 |
+
"""Shortcut for `tqdm.notebook.tqdm(range(*args), **kwargs)`."""
|
| 312 |
+
return tqdm_notebook(range(*args), **kwargs)
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
# Aliases
|
| 316 |
+
tqdm = tqdm_notebook
|
| 317 |
+
trange = tnrange
|
parrot/lib/python3.10/site-packages/tqdm/rich.py
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
`rich.progress` decorator for iterators.
|
| 3 |
+
|
| 4 |
+
Usage:
|
| 5 |
+
>>> from tqdm.rich import trange, tqdm
|
| 6 |
+
>>> for i in trange(10):
|
| 7 |
+
... ...
|
| 8 |
+
"""
|
| 9 |
+
from warnings import warn
|
| 10 |
+
|
| 11 |
+
from rich.progress import (
|
| 12 |
+
BarColumn, Progress, ProgressColumn, Text, TimeElapsedColumn, TimeRemainingColumn, filesize)
|
| 13 |
+
|
| 14 |
+
from .std import TqdmExperimentalWarning
|
| 15 |
+
from .std import tqdm as std_tqdm
|
| 16 |
+
|
| 17 |
+
__author__ = {"github.com/": ["casperdcl"]}
|
| 18 |
+
__all__ = ['tqdm_rich', 'trrange', 'tqdm', 'trange']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class FractionColumn(ProgressColumn):
|
| 22 |
+
"""Renders completed/total, e.g. '0.5/2.3 G'."""
|
| 23 |
+
def __init__(self, unit_scale=False, unit_divisor=1000):
|
| 24 |
+
self.unit_scale = unit_scale
|
| 25 |
+
self.unit_divisor = unit_divisor
|
| 26 |
+
super().__init__()
|
| 27 |
+
|
| 28 |
+
def render(self, task):
|
| 29 |
+
"""Calculate common unit for completed and total."""
|
| 30 |
+
completed = int(task.completed)
|
| 31 |
+
total = int(task.total)
|
| 32 |
+
if self.unit_scale:
|
| 33 |
+
unit, suffix = filesize.pick_unit_and_suffix(
|
| 34 |
+
total,
|
| 35 |
+
["", "K", "M", "G", "T", "P", "E", "Z", "Y"],
|
| 36 |
+
self.unit_divisor,
|
| 37 |
+
)
|
| 38 |
+
else:
|
| 39 |
+
unit, suffix = filesize.pick_unit_and_suffix(total, [""], 1)
|
| 40 |
+
precision = 0 if unit == 1 else 1
|
| 41 |
+
return Text(
|
| 42 |
+
f"{completed/unit:,.{precision}f}/{total/unit:,.{precision}f} {suffix}",
|
| 43 |
+
style="progress.download")
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class RateColumn(ProgressColumn):
|
| 47 |
+
"""Renders human readable transfer speed."""
|
| 48 |
+
def __init__(self, unit="", unit_scale=False, unit_divisor=1000):
|
| 49 |
+
self.unit = unit
|
| 50 |
+
self.unit_scale = unit_scale
|
| 51 |
+
self.unit_divisor = unit_divisor
|
| 52 |
+
super().__init__()
|
| 53 |
+
|
| 54 |
+
def render(self, task):
|
| 55 |
+
"""Show data transfer speed."""
|
| 56 |
+
speed = task.speed
|
| 57 |
+
if speed is None:
|
| 58 |
+
return Text(f"? {self.unit}/s", style="progress.data.speed")
|
| 59 |
+
if self.unit_scale:
|
| 60 |
+
unit, suffix = filesize.pick_unit_and_suffix(
|
| 61 |
+
speed,
|
| 62 |
+
["", "K", "M", "G", "T", "P", "E", "Z", "Y"],
|
| 63 |
+
self.unit_divisor,
|
| 64 |
+
)
|
| 65 |
+
else:
|
| 66 |
+
unit, suffix = filesize.pick_unit_and_suffix(speed, [""], 1)
|
| 67 |
+
precision = 0 if unit == 1 else 1
|
| 68 |
+
return Text(f"{speed/unit:,.{precision}f} {suffix}{self.unit}/s",
|
| 69 |
+
style="progress.data.speed")
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class tqdm_rich(std_tqdm): # pragma: no cover
|
| 73 |
+
"""Experimental rich.progress GUI version of tqdm!"""
|
| 74 |
+
# TODO: @classmethod: write()?
|
| 75 |
+
def __init__(self, *args, **kwargs):
|
| 76 |
+
"""
|
| 77 |
+
This class accepts the following parameters *in addition* to
|
| 78 |
+
the parameters accepted by `tqdm`.
|
| 79 |
+
|
| 80 |
+
Parameters
|
| 81 |
+
----------
|
| 82 |
+
progress : tuple, optional
|
| 83 |
+
arguments for `rich.progress.Progress()`.
|
| 84 |
+
options : dict, optional
|
| 85 |
+
keyword arguments for `rich.progress.Progress()`.
|
| 86 |
+
"""
|
| 87 |
+
kwargs = kwargs.copy()
|
| 88 |
+
kwargs['gui'] = True
|
| 89 |
+
# convert disable = None to False
|
| 90 |
+
kwargs['disable'] = bool(kwargs.get('disable', False))
|
| 91 |
+
progress = kwargs.pop('progress', None)
|
| 92 |
+
options = kwargs.pop('options', {}).copy()
|
| 93 |
+
super().__init__(*args, **kwargs)
|
| 94 |
+
|
| 95 |
+
if self.disable:
|
| 96 |
+
return
|
| 97 |
+
|
| 98 |
+
warn("rich is experimental/alpha", TqdmExperimentalWarning, stacklevel=2)
|
| 99 |
+
d = self.format_dict
|
| 100 |
+
if progress is None:
|
| 101 |
+
progress = (
|
| 102 |
+
"[progress.description]{task.description}"
|
| 103 |
+
"[progress.percentage]{task.percentage:>4.0f}%",
|
| 104 |
+
BarColumn(bar_width=None),
|
| 105 |
+
FractionColumn(
|
| 106 |
+
unit_scale=d['unit_scale'], unit_divisor=d['unit_divisor']),
|
| 107 |
+
"[", TimeElapsedColumn(), "<", TimeRemainingColumn(),
|
| 108 |
+
",", RateColumn(unit=d['unit'], unit_scale=d['unit_scale'],
|
| 109 |
+
unit_divisor=d['unit_divisor']), "]"
|
| 110 |
+
)
|
| 111 |
+
options.setdefault('transient', not self.leave)
|
| 112 |
+
self._prog = Progress(*progress, **options)
|
| 113 |
+
self._prog.__enter__()
|
| 114 |
+
self._task_id = self._prog.add_task(self.desc or "", **d)
|
| 115 |
+
|
| 116 |
+
def close(self):
|
| 117 |
+
if self.disable:
|
| 118 |
+
return
|
| 119 |
+
self.display() # print 100%, vis #1306
|
| 120 |
+
super().close()
|
| 121 |
+
self._prog.__exit__(None, None, None)
|
| 122 |
+
|
| 123 |
+
def clear(self, *_, **__):
|
| 124 |
+
pass
|
| 125 |
+
|
| 126 |
+
def display(self, *_, **__):
|
| 127 |
+
if not hasattr(self, '_prog'):
|
| 128 |
+
return
|
| 129 |
+
self._prog.update(self._task_id, completed=self.n, description=self.desc)
|
| 130 |
+
|
| 131 |
+
def reset(self, total=None):
|
| 132 |
+
"""
|
| 133 |
+
Resets to 0 iterations for repeated use.
|
| 134 |
+
|
| 135 |
+
Parameters
|
| 136 |
+
----------
|
| 137 |
+
total : int or float, optional. Total to use for the new bar.
|
| 138 |
+
"""
|
| 139 |
+
if hasattr(self, '_prog'):
|
| 140 |
+
self._prog.reset(total=total)
|
| 141 |
+
super().reset(total=total)
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def trrange(*args, **kwargs):
|
| 145 |
+
"""Shortcut for `tqdm.rich.tqdm(range(*args), **kwargs)`."""
|
| 146 |
+
return tqdm_rich(range(*args), **kwargs)
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
# Aliases
|
| 150 |
+
tqdm = tqdm_rich
|
| 151 |
+
trange = trrange
|
parrot/lib/python3.10/site-packages/tqdm/tk.py
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Tkinter GUI progressbar decorator for iterators.
|
| 3 |
+
|
| 4 |
+
Usage:
|
| 5 |
+
>>> from tqdm.tk import trange, tqdm
|
| 6 |
+
>>> for i in trange(10):
|
| 7 |
+
... ...
|
| 8 |
+
"""
|
| 9 |
+
import re
|
| 10 |
+
import sys
|
| 11 |
+
import tkinter
|
| 12 |
+
import tkinter.ttk as ttk
|
| 13 |
+
from warnings import warn
|
| 14 |
+
|
| 15 |
+
from .std import TqdmExperimentalWarning, TqdmWarning
|
| 16 |
+
from .std import tqdm as std_tqdm
|
| 17 |
+
|
| 18 |
+
__author__ = {"github.com/": ["richardsheridan", "casperdcl"]}
|
| 19 |
+
__all__ = ['tqdm_tk', 'ttkrange', 'tqdm', 'trange']
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class tqdm_tk(std_tqdm): # pragma: no cover
|
| 23 |
+
"""
|
| 24 |
+
Experimental Tkinter GUI version of tqdm!
|
| 25 |
+
|
| 26 |
+
Note: Window interactivity suffers if `tqdm_tk` is not running within
|
| 27 |
+
a Tkinter mainloop and values are generated infrequently. In this case,
|
| 28 |
+
consider calling `tqdm_tk.refresh()` frequently in the Tk thread.
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
# TODO: @classmethod: write()?
|
| 32 |
+
|
| 33 |
+
def __init__(self, *args, **kwargs):
|
| 34 |
+
"""
|
| 35 |
+
This class accepts the following parameters *in addition* to
|
| 36 |
+
the parameters accepted by `tqdm`.
|
| 37 |
+
|
| 38 |
+
Parameters
|
| 39 |
+
----------
|
| 40 |
+
grab : bool, optional
|
| 41 |
+
Grab the input across all windows of the process.
|
| 42 |
+
tk_parent : `tkinter.Wm`, optional
|
| 43 |
+
Parent Tk window.
|
| 44 |
+
cancel_callback : Callable, optional
|
| 45 |
+
Create a cancel button and set `cancel_callback` to be called
|
| 46 |
+
when the cancel or window close button is clicked.
|
| 47 |
+
"""
|
| 48 |
+
kwargs = kwargs.copy()
|
| 49 |
+
kwargs['gui'] = True
|
| 50 |
+
# convert disable = None to False
|
| 51 |
+
kwargs['disable'] = bool(kwargs.get('disable', False))
|
| 52 |
+
self._warn_leave = 'leave' in kwargs
|
| 53 |
+
grab = kwargs.pop('grab', False)
|
| 54 |
+
tk_parent = kwargs.pop('tk_parent', None)
|
| 55 |
+
self._cancel_callback = kwargs.pop('cancel_callback', None)
|
| 56 |
+
super().__init__(*args, **kwargs)
|
| 57 |
+
|
| 58 |
+
if self.disable:
|
| 59 |
+
return
|
| 60 |
+
|
| 61 |
+
if tk_parent is None: # Discover parent widget
|
| 62 |
+
try:
|
| 63 |
+
tk_parent = tkinter._default_root
|
| 64 |
+
except AttributeError:
|
| 65 |
+
raise AttributeError(
|
| 66 |
+
"`tk_parent` required when using `tkinter.NoDefaultRoot()`")
|
| 67 |
+
if tk_parent is None: # use new default root window as display
|
| 68 |
+
self._tk_window = tkinter.Tk()
|
| 69 |
+
else: # some other windows already exist
|
| 70 |
+
self._tk_window = tkinter.Toplevel()
|
| 71 |
+
else:
|
| 72 |
+
self._tk_window = tkinter.Toplevel(tk_parent)
|
| 73 |
+
|
| 74 |
+
warn("GUI is experimental/alpha", TqdmExperimentalWarning, stacklevel=2)
|
| 75 |
+
self._tk_dispatching = self._tk_dispatching_helper()
|
| 76 |
+
|
| 77 |
+
self._tk_window.protocol("WM_DELETE_WINDOW", self.cancel)
|
| 78 |
+
self._tk_window.wm_title(self.desc)
|
| 79 |
+
self._tk_window.wm_attributes("-topmost", 1)
|
| 80 |
+
self._tk_window.after(0, lambda: self._tk_window.wm_attributes("-topmost", 0))
|
| 81 |
+
self._tk_n_var = tkinter.DoubleVar(self._tk_window, value=0)
|
| 82 |
+
self._tk_text_var = tkinter.StringVar(self._tk_window)
|
| 83 |
+
pbar_frame = ttk.Frame(self._tk_window, padding=5)
|
| 84 |
+
pbar_frame.pack()
|
| 85 |
+
_tk_label = ttk.Label(pbar_frame, textvariable=self._tk_text_var,
|
| 86 |
+
wraplength=600, anchor="center", justify="center")
|
| 87 |
+
_tk_label.pack()
|
| 88 |
+
self._tk_pbar = ttk.Progressbar(
|
| 89 |
+
pbar_frame, variable=self._tk_n_var, length=450)
|
| 90 |
+
if self.total is not None:
|
| 91 |
+
self._tk_pbar.configure(maximum=self.total)
|
| 92 |
+
else:
|
| 93 |
+
self._tk_pbar.configure(mode="indeterminate")
|
| 94 |
+
self._tk_pbar.pack()
|
| 95 |
+
if self._cancel_callback is not None:
|
| 96 |
+
_tk_button = ttk.Button(pbar_frame, text="Cancel", command=self.cancel)
|
| 97 |
+
_tk_button.pack()
|
| 98 |
+
if grab:
|
| 99 |
+
self._tk_window.grab_set()
|
| 100 |
+
|
| 101 |
+
def close(self):
|
| 102 |
+
if self.disable:
|
| 103 |
+
return
|
| 104 |
+
|
| 105 |
+
self.disable = True
|
| 106 |
+
|
| 107 |
+
with self.get_lock():
|
| 108 |
+
self._instances.remove(self)
|
| 109 |
+
|
| 110 |
+
def _close():
|
| 111 |
+
self._tk_window.after('idle', self._tk_window.destroy)
|
| 112 |
+
if not self._tk_dispatching:
|
| 113 |
+
self._tk_window.update()
|
| 114 |
+
|
| 115 |
+
self._tk_window.protocol("WM_DELETE_WINDOW", _close)
|
| 116 |
+
|
| 117 |
+
# if leave is set but we are self-dispatching, the left window is
|
| 118 |
+
# totally unresponsive unless the user manually dispatches
|
| 119 |
+
if not self.leave:
|
| 120 |
+
_close()
|
| 121 |
+
elif not self._tk_dispatching:
|
| 122 |
+
if self._warn_leave:
|
| 123 |
+
warn("leave flag ignored if not in tkinter mainloop",
|
| 124 |
+
TqdmWarning, stacklevel=2)
|
| 125 |
+
_close()
|
| 126 |
+
|
| 127 |
+
def clear(self, *_, **__):
|
| 128 |
+
pass
|
| 129 |
+
|
| 130 |
+
def display(self, *_, **__):
|
| 131 |
+
self._tk_n_var.set(self.n)
|
| 132 |
+
d = self.format_dict
|
| 133 |
+
# remove {bar}
|
| 134 |
+
d['bar_format'] = (d['bar_format'] or "{l_bar}<bar/>{r_bar}").replace(
|
| 135 |
+
"{bar}", "<bar/>")
|
| 136 |
+
msg = self.format_meter(**d)
|
| 137 |
+
if '<bar/>' in msg:
|
| 138 |
+
msg = "".join(re.split(r'\|?<bar/>\|?', msg, maxsplit=1))
|
| 139 |
+
self._tk_text_var.set(msg)
|
| 140 |
+
if not self._tk_dispatching:
|
| 141 |
+
self._tk_window.update()
|
| 142 |
+
|
| 143 |
+
def set_description(self, desc=None, refresh=True):
|
| 144 |
+
self.set_description_str(desc, refresh)
|
| 145 |
+
|
| 146 |
+
def set_description_str(self, desc=None, refresh=True):
|
| 147 |
+
self.desc = desc
|
| 148 |
+
if not self.disable:
|
| 149 |
+
self._tk_window.wm_title(desc)
|
| 150 |
+
if refresh and not self._tk_dispatching:
|
| 151 |
+
self._tk_window.update()
|
| 152 |
+
|
| 153 |
+
def cancel(self):
|
| 154 |
+
"""
|
| 155 |
+
`cancel_callback()` followed by `close()`
|
| 156 |
+
when close/cancel buttons clicked.
|
| 157 |
+
"""
|
| 158 |
+
if self._cancel_callback is not None:
|
| 159 |
+
self._cancel_callback()
|
| 160 |
+
self.close()
|
| 161 |
+
|
| 162 |
+
def reset(self, total=None):
|
| 163 |
+
"""
|
| 164 |
+
Resets to 0 iterations for repeated use.
|
| 165 |
+
|
| 166 |
+
Parameters
|
| 167 |
+
----------
|
| 168 |
+
total : int or float, optional. Total to use for the new bar.
|
| 169 |
+
"""
|
| 170 |
+
if hasattr(self, '_tk_pbar'):
|
| 171 |
+
if total is None:
|
| 172 |
+
self._tk_pbar.configure(maximum=100, mode="indeterminate")
|
| 173 |
+
else:
|
| 174 |
+
self._tk_pbar.configure(maximum=total, mode="determinate")
|
| 175 |
+
super().reset(total=total)
|
| 176 |
+
|
| 177 |
+
@staticmethod
|
| 178 |
+
def _tk_dispatching_helper():
|
| 179 |
+
"""determine if Tkinter mainloop is dispatching events"""
|
| 180 |
+
codes = {tkinter.mainloop.__code__, tkinter.Misc.mainloop.__code__}
|
| 181 |
+
for frame in sys._current_frames().values():
|
| 182 |
+
while frame:
|
| 183 |
+
if frame.f_code in codes:
|
| 184 |
+
return True
|
| 185 |
+
frame = frame.f_back
|
| 186 |
+
return False
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
def ttkrange(*args, **kwargs):
|
| 190 |
+
"""Shortcut for `tqdm.tk.tqdm(range(*args), **kwargs)`."""
|
| 191 |
+
return tqdm_tk(range(*args), **kwargs)
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
# Aliases
|
| 195 |
+
tqdm = tqdm_tk
|
| 196 |
+
trange = ttkrange
|
parrot/lib/python3.10/site-packages/tqdm/tqdm.1
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.\" Automatically generated by Pandoc 1.19.2
|
| 2 |
+
.\"
|
| 3 |
+
.TH "TQDM" "1" "2015\-2021" "tqdm User Manuals" ""
|
| 4 |
+
.hy
|
| 5 |
+
.SH NAME
|
| 6 |
+
.PP
|
| 7 |
+
tqdm \- fast, extensible progress bar for Python and CLI
|
| 8 |
+
.SH SYNOPSIS
|
| 9 |
+
.PP
|
| 10 |
+
tqdm [\f[I]options\f[]]
|
| 11 |
+
.SH DESCRIPTION
|
| 12 |
+
.PP
|
| 13 |
+
See <https://github.com/tqdm/tqdm>.
|
| 14 |
+
Can be used as a pipe:
|
| 15 |
+
.IP
|
| 16 |
+
.nf
|
| 17 |
+
\f[C]
|
| 18 |
+
$\ #\ count\ lines\ of\ code
|
| 19 |
+
$\ cat\ *.py\ |\ tqdm\ |\ wc\ \-l
|
| 20 |
+
327it\ [00:00,\ 981773.38it/s]
|
| 21 |
+
327
|
| 22 |
+
|
| 23 |
+
$\ #\ find\ all\ files
|
| 24 |
+
$\ find\ .\ \-name\ "*.py"\ |\ tqdm\ |\ wc\ \-l
|
| 25 |
+
432it\ [00:00,\ 833842.30it/s]
|
| 26 |
+
432
|
| 27 |
+
|
| 28 |
+
#\ ...\ and\ more\ info
|
| 29 |
+
$\ find\ .\ \-name\ \[aq]*.py\[aq]\ \-exec\ wc\ \-l\ \\{}\ \\;\ \\
|
| 30 |
+
\ \ |\ tqdm\ \-\-total\ 432\ \-\-unit\ files\ \-\-desc\ counting\ \\
|
| 31 |
+
\ \ |\ awk\ \[aq]{\ sum\ +=\ $1\ };\ END\ {\ print\ sum\ }\[aq]
|
| 32 |
+
counting:\ 100%|█████████|\ 432/432\ [00:00<00:00,\ 794361.83files/s]
|
| 33 |
+
131998
|
| 34 |
+
\f[]
|
| 35 |
+
.fi
|
| 36 |
+
.SH OPTIONS
|
| 37 |
+
.TP
|
| 38 |
+
.B \-h, \-\-help
|
| 39 |
+
Print this help and exit.
|
| 40 |
+
.RS
|
| 41 |
+
.RE
|
| 42 |
+
.TP
|
| 43 |
+
.B \-v, \-\-version
|
| 44 |
+
Print version and exit.
|
| 45 |
+
.RS
|
| 46 |
+
.RE
|
| 47 |
+
.TP
|
| 48 |
+
.B \-\-desc=\f[I]desc\f[]
|
| 49 |
+
str, optional.
|
| 50 |
+
Prefix for the progressbar.
|
| 51 |
+
.RS
|
| 52 |
+
.RE
|
| 53 |
+
.TP
|
| 54 |
+
.B \-\-total=\f[I]total\f[]
|
| 55 |
+
int or float, optional.
|
| 56 |
+
The number of expected iterations.
|
| 57 |
+
If unspecified, len(iterable) is used if possible.
|
| 58 |
+
If float("inf") or as a last resort, only basic progress statistics are
|
| 59 |
+
displayed (no ETA, no progressbar).
|
| 60 |
+
If \f[C]gui\f[] is True and this parameter needs subsequent updating,
|
| 61 |
+
specify an initial arbitrary large positive number, e.g.
|
| 62 |
+
9e9.
|
| 63 |
+
.RS
|
| 64 |
+
.RE
|
| 65 |
+
.TP
|
| 66 |
+
.B \-\-leave
|
| 67 |
+
bool, optional.
|
| 68 |
+
If [default: True], keeps all traces of the progressbar upon termination
|
| 69 |
+
of iteration.
|
| 70 |
+
If \f[C]None\f[], will leave only if \f[C]position\f[] is \f[C]0\f[].
|
| 71 |
+
.RS
|
| 72 |
+
.RE
|
| 73 |
+
.TP
|
| 74 |
+
.B \-\-ncols=\f[I]ncols\f[]
|
| 75 |
+
int, optional.
|
| 76 |
+
The width of the entire output message.
|
| 77 |
+
If specified, dynamically resizes the progressbar to stay within this
|
| 78 |
+
bound.
|
| 79 |
+
If unspecified, attempts to use environment width.
|
| 80 |
+
The fallback is a meter width of 10 and no limit for the counter and
|
| 81 |
+
statistics.
|
| 82 |
+
If 0, will not print any meter (only stats).
|
| 83 |
+
.RS
|
| 84 |
+
.RE
|
| 85 |
+
.TP
|
| 86 |
+
.B \-\-mininterval=\f[I]mininterval\f[]
|
| 87 |
+
float, optional.
|
| 88 |
+
Minimum progress display update interval [default: 0.1] seconds.
|
| 89 |
+
.RS
|
| 90 |
+
.RE
|
| 91 |
+
.TP
|
| 92 |
+
.B \-\-maxinterval=\f[I]maxinterval\f[]
|
| 93 |
+
float, optional.
|
| 94 |
+
Maximum progress display update interval [default: 10] seconds.
|
| 95 |
+
Automatically adjusts \f[C]miniters\f[] to correspond to
|
| 96 |
+
\f[C]mininterval\f[] after long display update lag.
|
| 97 |
+
Only works if \f[C]dynamic_miniters\f[] or monitor thread is enabled.
|
| 98 |
+
.RS
|
| 99 |
+
.RE
|
| 100 |
+
.TP
|
| 101 |
+
.B \-\-miniters=\f[I]miniters\f[]
|
| 102 |
+
int or float, optional.
|
| 103 |
+
Minimum progress display update interval, in iterations.
|
| 104 |
+
If 0 and \f[C]dynamic_miniters\f[], will automatically adjust to equal
|
| 105 |
+
\f[C]mininterval\f[] (more CPU efficient, good for tight loops).
|
| 106 |
+
If > 0, will skip display of specified number of iterations.
|
| 107 |
+
Tweak this and \f[C]mininterval\f[] to get very efficient loops.
|
| 108 |
+
If your progress is erratic with both fast and slow iterations (network,
|
| 109 |
+
skipping items, etc) you should set miniters=1.
|
| 110 |
+
.RS
|
| 111 |
+
.RE
|
| 112 |
+
.TP
|
| 113 |
+
.B \-\-ascii=\f[I]ascii\f[]
|
| 114 |
+
bool or str, optional.
|
| 115 |
+
If unspecified or False, use unicode (smooth blocks) to fill the meter.
|
| 116 |
+
The fallback is to use ASCII characters " 123456789#".
|
| 117 |
+
.RS
|
| 118 |
+
.RE
|
| 119 |
+
.TP
|
| 120 |
+
.B \-\-disable
|
| 121 |
+
bool, optional.
|
| 122 |
+
Whether to disable the entire progressbar wrapper [default: False].
|
| 123 |
+
If set to None, disable on non\-TTY.
|
| 124 |
+
.RS
|
| 125 |
+
.RE
|
| 126 |
+
.TP
|
| 127 |
+
.B \-\-unit=\f[I]unit\f[]
|
| 128 |
+
str, optional.
|
| 129 |
+
String that will be used to define the unit of each iteration [default:
|
| 130 |
+
it].
|
| 131 |
+
.RS
|
| 132 |
+
.RE
|
| 133 |
+
.TP
|
| 134 |
+
.B \-\-unit\-scale=\f[I]unit_scale\f[]
|
| 135 |
+
bool or int or float, optional.
|
| 136 |
+
If 1 or True, the number of iterations will be reduced/scaled
|
| 137 |
+
automatically and a metric prefix following the International System of
|
| 138 |
+
Units standard will be added (kilo, mega, etc.) [default: False].
|
| 139 |
+
If any other non\-zero number, will scale \f[C]total\f[] and \f[C]n\f[].
|
| 140 |
+
.RS
|
| 141 |
+
.RE
|
| 142 |
+
.TP
|
| 143 |
+
.B \-\-dynamic\-ncols
|
| 144 |
+
bool, optional.
|
| 145 |
+
If set, constantly alters \f[C]ncols\f[] and \f[C]nrows\f[] to the
|
| 146 |
+
environment (allowing for window resizes) [default: False].
|
| 147 |
+
.RS
|
| 148 |
+
.RE
|
| 149 |
+
.TP
|
| 150 |
+
.B \-\-smoothing=\f[I]smoothing\f[]
|
| 151 |
+
float, optional.
|
| 152 |
+
Exponential moving average smoothing factor for speed estimates (ignored
|
| 153 |
+
in GUI mode).
|
| 154 |
+
Ranges from 0 (average speed) to 1 (current/instantaneous speed)
|
| 155 |
+
[default: 0.3].
|
| 156 |
+
.RS
|
| 157 |
+
.RE
|
| 158 |
+
.TP
|
| 159 |
+
.B \-\-bar\-format=\f[I]bar_format\f[]
|
| 160 |
+
str, optional.
|
| 161 |
+
Specify a custom bar string formatting.
|
| 162 |
+
May impact performance.
|
| 163 |
+
[default: \[aq]{l_bar}{bar}{r_bar}\[aq]], where l_bar=\[aq]{desc}:
|
| 164 |
+
{percentage:3.0f}%|\[aq] and r_bar=\[aq]| {n_fmt}/{total_fmt}
|
| 165 |
+
[{elapsed}<{remaining}, \[aq] \[aq]{rate_fmt}{postfix}]\[aq] Possible
|
| 166 |
+
vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, percentage,
|
| 167 |
+
elapsed, elapsed_s, ncols, nrows, desc, unit, rate, rate_fmt,
|
| 168 |
+
rate_noinv, rate_noinv_fmt, rate_inv, rate_inv_fmt, postfix,
|
| 169 |
+
unit_divisor, remaining, remaining_s, eta.
|
| 170 |
+
Note that a trailing ": " is automatically removed after {desc} if the
|
| 171 |
+
latter is empty.
|
| 172 |
+
.RS
|
| 173 |
+
.RE
|
| 174 |
+
.TP
|
| 175 |
+
.B \-\-initial=\f[I]initial\f[]
|
| 176 |
+
int or float, optional.
|
| 177 |
+
The initial counter value.
|
| 178 |
+
Useful when restarting a progress bar [default: 0].
|
| 179 |
+
If using float, consider specifying \f[C]{n:.3f}\f[] or similar in
|
| 180 |
+
\f[C]bar_format\f[], or specifying \f[C]unit_scale\f[].
|
| 181 |
+
.RS
|
| 182 |
+
.RE
|
| 183 |
+
.TP
|
| 184 |
+
.B \-\-position=\f[I]position\f[]
|
| 185 |
+
int, optional.
|
| 186 |
+
Specify the line offset to print this bar (starting from 0) Automatic if
|
| 187 |
+
unspecified.
|
| 188 |
+
Useful to manage multiple bars at once (eg, from threads).
|
| 189 |
+
.RS
|
| 190 |
+
.RE
|
| 191 |
+
.TP
|
| 192 |
+
.B \-\-postfix=\f[I]postfix\f[]
|
| 193 |
+
dict or *, optional.
|
| 194 |
+
Specify additional stats to display at the end of the bar.
|
| 195 |
+
Calls \f[C]set_postfix(**postfix)\f[] if possible (dict).
|
| 196 |
+
.RS
|
| 197 |
+
.RE
|
| 198 |
+
.TP
|
| 199 |
+
.B \-\-unit\-divisor=\f[I]unit_divisor\f[]
|
| 200 |
+
float, optional.
|
| 201 |
+
[default: 1000], ignored unless \f[C]unit_scale\f[] is True.
|
| 202 |
+
.RS
|
| 203 |
+
.RE
|
| 204 |
+
.TP
|
| 205 |
+
.B \-\-write\-bytes
|
| 206 |
+
bool, optional.
|
| 207 |
+
Whether to write bytes.
|
| 208 |
+
If (default: False) will write unicode.
|
| 209 |
+
.RS
|
| 210 |
+
.RE
|
| 211 |
+
.TP
|
| 212 |
+
.B \-\-lock\-args=\f[I]lock_args\f[]
|
| 213 |
+
tuple, optional.
|
| 214 |
+
Passed to \f[C]refresh\f[] for intermediate output (initialisation,
|
| 215 |
+
iterating, and updating).
|
| 216 |
+
.RS
|
| 217 |
+
.RE
|
| 218 |
+
.TP
|
| 219 |
+
.B \-\-nrows=\f[I]nrows\f[]
|
| 220 |
+
int, optional.
|
| 221 |
+
The screen height.
|
| 222 |
+
If specified, hides nested bars outside this bound.
|
| 223 |
+
If unspecified, attempts to use environment height.
|
| 224 |
+
The fallback is 20.
|
| 225 |
+
.RS
|
| 226 |
+
.RE
|
| 227 |
+
.TP
|
| 228 |
+
.B \-\-colour=\f[I]colour\f[]
|
| 229 |
+
str, optional.
|
| 230 |
+
Bar colour (e.g.
|
| 231 |
+
\[aq]green\[aq], \[aq]#00ff00\[aq]).
|
| 232 |
+
.RS
|
| 233 |
+
.RE
|
| 234 |
+
.TP
|
| 235 |
+
.B \-\-delay=\f[I]delay\f[]
|
| 236 |
+
float, optional.
|
| 237 |
+
Don\[aq]t display until [default: 0] seconds have elapsed.
|
| 238 |
+
.RS
|
| 239 |
+
.RE
|
| 240 |
+
.TP
|
| 241 |
+
.B \-\-delim=\f[I]delim\f[]
|
| 242 |
+
chr, optional.
|
| 243 |
+
Delimiting character [default: \[aq]\\n\[aq]].
|
| 244 |
+
Use \[aq]\\0\[aq] for null.
|
| 245 |
+
N.B.: on Windows systems, Python converts \[aq]\\n\[aq] to
|
| 246 |
+
\[aq]\\r\\n\[aq].
|
| 247 |
+
.RS
|
| 248 |
+
.RE
|
| 249 |
+
.TP
|
| 250 |
+
.B \-\-buf\-size=\f[I]buf_size\f[]
|
| 251 |
+
int, optional.
|
| 252 |
+
String buffer size in bytes [default: 256] used when \f[C]delim\f[] is
|
| 253 |
+
specified.
|
| 254 |
+
.RS
|
| 255 |
+
.RE
|
| 256 |
+
.TP
|
| 257 |
+
.B \-\-bytes
|
| 258 |
+
bool, optional.
|
| 259 |
+
If true, will count bytes, ignore \f[C]delim\f[], and default
|
| 260 |
+
\f[C]unit_scale\f[] to True, \f[C]unit_divisor\f[] to 1024, and
|
| 261 |
+
\f[C]unit\f[] to \[aq]B\[aq].
|
| 262 |
+
.RS
|
| 263 |
+
.RE
|
| 264 |
+
.TP
|
| 265 |
+
.B \-\-tee
|
| 266 |
+
bool, optional.
|
| 267 |
+
If true, passes \f[C]stdin\f[] to both \f[C]stderr\f[] and
|
| 268 |
+
\f[C]stdout\f[].
|
| 269 |
+
.RS
|
| 270 |
+
.RE
|
| 271 |
+
.TP
|
| 272 |
+
.B \-\-update
|
| 273 |
+
bool, optional.
|
| 274 |
+
If true, will treat input as newly elapsed iterations, i.e.
|
| 275 |
+
numbers to pass to \f[C]update()\f[].
|
| 276 |
+
Note that this is slow (~2e5 it/s) since every input must be decoded as
|
| 277 |
+
a number.
|
| 278 |
+
.RS
|
| 279 |
+
.RE
|
| 280 |
+
.TP
|
| 281 |
+
.B \-\-update\-to
|
| 282 |
+
bool, optional.
|
| 283 |
+
If true, will treat input as total elapsed iterations, i.e.
|
| 284 |
+
numbers to assign to \f[C]self.n\f[].
|
| 285 |
+
Note that this is slow (~2e5 it/s) since every input must be decoded as
|
| 286 |
+
a number.
|
| 287 |
+
.RS
|
| 288 |
+
.RE
|
| 289 |
+
.TP
|
| 290 |
+
.B \-\-null
|
| 291 |
+
bool, optional.
|
| 292 |
+
If true, will discard input (no stdout).
|
| 293 |
+
.RS
|
| 294 |
+
.RE
|
| 295 |
+
.TP
|
| 296 |
+
.B \-\-manpath=\f[I]manpath\f[]
|
| 297 |
+
str, optional.
|
| 298 |
+
Directory in which to install tqdm man pages.
|
| 299 |
+
.RS
|
| 300 |
+
.RE
|
| 301 |
+
.TP
|
| 302 |
+
.B \-\-comppath=\f[I]comppath\f[]
|
| 303 |
+
str, optional.
|
| 304 |
+
Directory in which to place tqdm completion.
|
| 305 |
+
.RS
|
| 306 |
+
.RE
|
| 307 |
+
.TP
|
| 308 |
+
.B \-\-log=\f[I]log\f[]
|
| 309 |
+
str, optional.
|
| 310 |
+
CRITICAL|FATAL|ERROR|WARN(ING)|[default: \[aq]INFO\[aq]]|DEBUG|NOTSET.
|
| 311 |
+
.RS
|
| 312 |
+
.RE
|
| 313 |
+
.SH AUTHORS
|
| 314 |
+
tqdm developers <https://github.com/tqdm>.
|