Commit Graph

60 Commits

Author SHA1 Message Date
Casper da Costa-Luis 6cb00522d2
cli: warn on positional arg 2022-02-27 22:59:26 +00:00
Casper da Costa-Luis 6c930f5d84
fix deps & tests 2021-10-03 17:20:09 +01:00
Casper da Costa-Luis 4c7ad3a65a
add `__reversed__()` 2021-10-03 16:50:31 +01:00
Casper da Costa-Luis 983b66c132
add efficient `__contains__` 2021-10-03 16:50:31 +01:00
Casper da Costa-Luis a7e717dc53
misc linting/refactoring 2021-09-19 10:52:08 +01:00
Casper da Costa-Luis 83ce8b9d68
linter config udpates 2021-09-18 17:24:50 +01:00
Steffan Karger f99bcb479b logging: inherit output stream from existing handler
When using the logging redirection, logs will currently always be printed
to stdout, while the logging module default is to print to stderr.

Fix this by trying to inherit the stream from the existing handler, like
the code already does for the formatter.

Consider the following example:

    import logging
    import time

    from tqdm.contrib.logging import tqdm_logging_redirect

    log = logging.getLogger()
    log.warning("start")

    with tqdm_logging_redirect(range(int(4))) as pbar:
        for i in pbar:
            time.sleep(0.1)
            log.warning(f"Step {i}")

    log.warning("done")

Running this while redirecting stdout (`$ python3 log.py > /dev/null`)
without this patch will print:

    $ venv/bin/python log.py > /dev/null
    start
    100%|████████████████████████████████████████████| 4/4 [00:00<00:00,  9.87it/s]
    done

After this patch:

    $ venv/bin/python log.py > /dev/null
    start
    Step 0
    Step 1
    Step 2
    Step 3
    100%|████████████████████████████████████████████| 4/4 [00:00<00:00,  9.83it/s]
    done

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
2021-08-14 21:16:54 +01:00
MapleCCC 223561a83b
`asyncio.gather` API consistency with stdlib
- closes #1212
2021-07-30 21:33:05 +01:00
Casper da Costa-Luis 74ec622661
keras: fix resume from `initial_epoch`
- set initial epochs
- update tests
2021-05-03 01:00:11 +01:00
Gonzalo Tixilima 3f899b9f77
fix: display wrong epoch on keras resume training 2021-05-03 00:26:50 +01:00
Daniel Armbruster d9372a2d47 tests: fix typo 2021-05-03 00:16:25 +01:00
Casper da Costa-Luis 7458666698
contrib.logging: cleanup & docs 2021-04-06 00:51:48 +01:00
Daniel Ecer e86b9b18a0
added logging sub-module
added logging sub-module

python 2 compatibility

fixed python 2 fix

added test for custom tqdm class

python 2 absolute imports

(due to otherwise conflicting `logging` module)

isort

more tests relating to _get_first_found_console_formatter

isort

minor simplification

test handleError

test logging formatter being used

minor rename to _get_first_found_console_logging_formatter

test that certain exceptions are not swallowed

avoid using mock.assert_called (py 3.5)

moved to tqdm.contrib.logging

added "Redirecting console logging to tqdm" readme

removed no longer necessary absolute_import declaration

minor: updated package of example in docstring
2021-04-05 23:45:31 +01:00
Gregor Sturm c633fc59b1 Fix flake8 2021-03-16 18:59:55 +01:00
Gregor Sturm ea92a0b5fb Fix that tqdm_class cannot be passed to `tmap` and `tzip` 2021-03-16 18:51:58 +01:00
Casper da Costa-Luis 299789b910
tests: test kwargs for `keras`, `dask` 2021-03-05 14:13:33 +00:00
Casper da Costa-Luis 3cab8835ad
tests: add `dask` 2021-03-05 13:44:56 +00:00
Casper da Costa-Luis 8fdcddb446
asyncio: fix, tidy & update `gather` & tests 2021-03-03 11:43:13 +00:00
Joshua Coales 644fd81bce Adding a test case for tqdm_asyncio.gather, mirroring tqdm_asyncio.as_completed 2021-03-02 10:05:52 +00:00
Casper da Costa-Luis 90cb341e8e
rename `waituntil` => `delay` 2021-02-25 16:08:12 +00:00
Antony Lee 90774d36a4
Allow hiding progressbar until some time interval has elapsed.
This avoids printing the progressbar for very short loops.
2021-02-25 15:48:29 +00:00
Casper da Costa-Luis bbf40d242b
lint: fix some warnings 2021-02-22 22:42:24 +00:00
Casper da Costa-Luis f2f47d5f90
minor codacy fixes 2021-02-22 22:25:17 +00:00
Casper da Costa-Luis 16ef703660
fix some codacy issues 2021-02-17 16:32:58 +00:00
Antony Lee 8e139fcf53
Don't insert spurious newlines in DummyTqdmFile.
Only call `tqdm.write` (which inserts a newline) if
`DummyTqdmFile.write` is itself called with a string containing a
newline; otherwise buffer the rest of the string.

See changes in test_tqdm.py for the patterns this allows.
2021-02-17 14:59:59 +00:00
Casper da Costa-Luis bf2a5e701d
tests: reset/unpause when disabled 2021-02-10 14:00:31 +00:00
Casper da Costa-Luis b2245bf5b6
tests: add disabled repr, misc docstrings 2021-02-09 17:56:51 +00:00
Casper da Costa-Luis daf36893ee
add `rich` 2021-01-10 23:49:17 +00:00
Casper da Costa-Luis 469a08008b
tests: gui & tk import 2021-01-10 18:08:06 +00:00
github-actions[bot] ab97437755
format: isort 2021-01-09 17:00:18 +00:00
Casper da Costa-Luis fd0ca187f0
fix more formatting and potential minor bugs 2021-01-09 16:53:06 +00:00
Casper da Costa-Luis 839e672748
tests: fix py2.7 2021-01-09 03:19:36 +00:00
Casper da Costa-Luis 32dc63552b
tests: lots of tidying 2021-01-04 03:32:03 +00:00
Casper da Costa-Luis 99fa82df08
tests: mark slow 2021-01-04 03:00:27 +00:00
Casper da Costa-Luis ca50e49343
style fixes 2021-01-04 02:35:03 +00:00
Casper da Costa-Luis 3511353ff7
tests: fix py27 2021-01-04 02:25:28 +00:00
Casper da Costa-Luis 3aea875b07
tests: upgrade CLI 2021-01-04 01:39:27 +00:00
Casper da Costa-Luis 40d59c2ec4
tests: fix py38, py39 2021-01-04 01:03:38 +00:00
Casper da Costa-Luis 841090491a
tests: warnings and timeout 2021-01-03 22:07:45 +00:00
Casper da Costa-Luis 0f95bedeae
codacy fixes 2020-12-25 02:19:27 +00:00
Casper da Costa-Luis ebea958110
tests:perf:capsys upgrades 2020-12-24 22:46:19 +00:00
Casper da Costa-Luis 31367d0a7a
test:cleanup pytest config 2020-12-24 22:22:52 +00:00
Casper da Costa-Luis 638e889a08
tests: add EMA 2020-12-24 21:28:14 +00:00
Casper da Costa-Luis 8ae4fc86d1
fix EMA estimates 2020-12-24 18:56:30 +00:00
Casper da Costa-Luis e7d1359027
revert test changes
- partially reverts e9bf3cd
2020-12-24 14:26:07 +00:00
Casper da Costa-Luis e9bf3cde2b
better EMA accuracy for early iterations
- fixes #1101
2020-12-24 14:20:39 +00:00
Casper da Costa-Luis e225d9a894
test:allow slower asyncio if platform=="darwin" 2020-12-20 19:36:05 +00:00
Casper da Costa-Luis 3c581208d6
manually lint everything 2020-12-20 19:18:01 +00:00
Casper da Costa-Luis a35529157d
use pytest-asyncio 2020-11-21 00:58:49 +00:00
Casper da Costa-Luis ee5f8d21e8
fix nested `asyncio`, document async `break` hazard
- fixes #1074
2020-11-21 00:51:50 +00:00