TqdmExperimentalWarning for GUI

This commit is contained in:
Casper da Costa-Luis 2018-04-06 17:28:28 +01:00
parent d7ccbbdabd
commit 3454cc86b2
No known key found for this signature in database
GPG Key ID: 986B408043AE090D
3 changed files with 13 additions and 6 deletions

View File

@ -6,13 +6,15 @@ from ._tqdm_pandas import tqdm_pandas
from ._main import main
from ._monitor import TMonitor, TqdmSynchronisationWarning
from ._version import __version__ # NOQA
from ._tqdm import TqdmTypeError, TqdmKeyError, \
TqdmWarning, TqdmDeprecationWarning, TqdmMonitorWarning
from ._tqdm import TqdmTypeError, TqdmKeyError, TqdmWarning, \
TqdmDeprecationWarning, TqdmExperimentalWarning, \
TqdmMonitorWarning
__all__ = ['tqdm', 'tqdm_gui', 'trange', 'tgrange', 'tqdm_pandas',
'tqdm_notebook', 'tnrange', 'main', 'TMonitor',
'TqdmTypeError', 'TqdmKeyError',
'TqdmWarning', 'TqdmDeprecationWarning',
'TqdmExperimentalWarning',
'TqdmMonitorWarning', 'TqdmSynchronisationWarning',
'__version__']

View File

@ -27,8 +27,9 @@ from warnings import warn
__author__ = {"github.com/": ["noamraph", "obiwanus", "kmike", "hadim",
"casperdcl", "lrq3000"]}
__all__ = ['tqdm', 'trange',
'TqdmTypeError', 'TqdmKeyError',
'TqdmWarning', 'TqdmDeprecationWarning', 'TqdmMonitorWarning']
'TqdmTypeError', 'TqdmKeyError', 'TqdmWarning',
'TqdmExperimentalWarning', 'TqdmDeprecationWarning',
'TqdmMonitorWarning']
class TqdmTypeError(TypeError):
@ -50,6 +51,9 @@ class TqdmWarning(Warning):
else:
super(TqdmWarning, self).__init__(msg, *a, **k)
class TqdmExperimentalWarning(TqdmWarning, FutureWarning):
"""beta feature, unstable API and behaviour"""
pass
class TqdmDeprecationWarning(TqdmWarning, DeprecationWarning):
# not suppressed if raised

View File

@ -15,7 +15,8 @@ from __future__ import division, absolute_import
from time import time
from ._utils import _range
# to inherit from the tqdm class
from ._tqdm import tqdm
from ._tqdm import tqdm, TqdmExperimentalWarning
from warnings import warn
__author__ = {"github.com/": ["casperdcl", "lrq3000"]}
@ -41,7 +42,7 @@ class tqdm_gui(tqdm): # pragma: no cover
if self.disable or not kwargs['gui']:
return
self.fp.write('Warning: GUI is experimental/alpha\n')
warn('GUI is experimental/alpha', TqdmExperimentalWarning)
self.mpl = mpl
self.plt = plt
self.sp = None