remove warning, flake8

This commit is contained in:
Casper da Costa-Luis 2018-04-15 01:16:33 +01:00
parent 1cc3005f9c
commit a432c3dacd
No known key found for this signature in database
GPG Key ID: 986B408043AE090D
3 changed files with 9 additions and 13 deletions

View File

@ -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__)

View File

@ -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

View File

@ -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,)))