mirror of https://github.com/tqdm/tqdm.git
remove warning, flake8
This commit is contained in:
parent
1cc3005f9c
commit
a432c3dacd
|
@ -128,7 +128,8 @@ def main(fp=sys.stderr):
|
|||
# sys.argv.pop(log)
|
||||
# logLevel = sys.argv.pop(log)
|
||||
logLevel = sys.argv[log + 1]
|
||||
logging.basicConfig(level=getattr(logging, logLevel),
|
||||
logging.basicConfig(
|
||||
level=getattr(logging, logLevel),
|
||||
format="%(levelname)s:%(module)s:%(lineno)d:%(message)s")
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -47,14 +47,17 @@ class TqdmWarning(Warning):
|
|||
"""
|
||||
def __init__(self, msg, fp_write=None, *a, **k):
|
||||
if fp_write is not None:
|
||||
fp_write("\n" + self.__class__.__name__ + ": " + str(msg).rstrip() + '\n')
|
||||
fp_write("\n" + self.__class__.__name__ + ": " +
|
||||
str(msg).rstrip() + '\n')
|
||||
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
|
||||
pass
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from nose.plugins.skip import SkipTest
|
||||
import warnings
|
||||
|
||||
from tqdm import tqdm
|
||||
from tests_tqdm import with_setup, pretest, posttest, StringIO, closing
|
||||
from tests_tqdm import with_setup, pretest, posttest, SkipTest, \
|
||||
StringIO, closing
|
||||
|
||||
|
||||
@with_setup(pretest, posttest)
|
||||
def test_pandas_setup():
|
||||
|
@ -13,13 +12,6 @@ def test_pandas_setup():
|
|||
except ImportError:
|
||||
raise SkipTest
|
||||
|
||||
with warnings.catch_warnings(record=True) as res:
|
||||
warnings.simplefilter("always")
|
||||
# set total in tqdm.pandas shall cause a warning
|
||||
tqdm.pandas(total=100)
|
||||
assert len(res) == 1
|
||||
assert all([i in str(res[-1].message) for i in ['total','not recommended']])
|
||||
|
||||
with closing(StringIO()) as our_file:
|
||||
tqdm.pandas(file=our_file, leave=True, ascii=True, total=123)
|
||||
series = pd.Series(randint(0, 50, (100,)))
|
||||
|
|
Loading…
Reference in New Issue