aboutsummaryrefslogtreecommitdiffhomepage
path: root/libs/tqdm/autonotebook.py
diff options
context:
space:
mode:
Diffstat (limited to 'libs/tqdm/autonotebook.py')
-rw-r--r--libs/tqdm/autonotebook.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/libs/tqdm/autonotebook.py b/libs/tqdm/autonotebook.py
new file mode 100644
index 000000000..0bcd42a13
--- /dev/null
+++ b/libs/tqdm/autonotebook.py
@@ -0,0 +1,18 @@
+import os
+
+try:
+ from IPython import get_ipython
+ if 'IPKernelApp' not in get_ipython().config: # pragma: no cover
+ raise ImportError("console")
+ if 'VSCODE_PID' in os.environ: # pragma: no cover
+ raise ImportError("vscode")
+except:
+ from .std import tqdm, trange
+else: # pragma: no cover
+ from .notebook import tqdm, trange
+ from .std 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, stacklevel=2)
+__all__ = ["tqdm", "trange"]