-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
try: | ||
from IPython import get_ipython | ||
if 'IPKernelApp' not in get_ipython().config: | ||
raise ImportError("console") | ||
except: | ||
from .._tqdm import tqdm, trange | ||
else: | ||
from .._tqdm_notebook import tqdm_notebook as tqdm | ||
from .._tqdm_notebook import tnrange as trange | ||
from .._tqdm import TqdmExperimentalWarning | ||
from warnings import warn | ||
warn("Using `tqdm.autonotebook.tqdm` in notebook mode." | ||
" Use `tqdm.tqdm` instead to force console mode" | ||
" (e.g. in jupyter console)", TqdmExperimentalWarning) | ||
__all__ = ["tqdm", "trange"] |
97a9393
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 The name is too long :(
2 IMHO this mode should be used by default
97a9393
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
97a9393
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You already shorten with being vague:
trange
,tnrange
IMHO adding prefixes to functions is not a good idea.
Anyway, in most cases user needs the solution working for both notebooks and console. Warning is unneeded and harmful. Instead problem description should be put into the faq.
BTW, the module doesn't go into a wheel.
97a9393
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO,
tqdm.auto
is better thantqdm.autonotebook
.Similarly,
tqdm.auto.trange
andtqdm.auto.tqdm
can be used.