From 8cade97703045109b0ab02bd6cf21b72f6076807 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 31 Oct 2016 02:19:29 +0000 Subject: [PATCH] bump version, minor comments --- examples/pandas_progress_apply.py | 2 +- setup.py | 14 +++++++------- tqdm/_utils.py | 1 - tqdm/_version.py | 4 ++-- tqdm/tests/tests_tqdm.py | 4 ++-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/examples/pandas_progress_apply.py b/examples/pandas_progress_apply.py index 9c841531a..ae972872f 100644 --- a/examples/pandas_progress_apply.py +++ b/examples/pandas_progress_apply.py @@ -15,7 +15,7 @@ # df.groupby(0).progress_apply(lambda x: x**2) -""" Source code for `tqdm_pandas` (really simple!) """ +# -- Source code for `tqdm_pandas` (really simple!) # def tqdm_pandas(t): # from pandas.core.frame import DataFrame # def inner(df, func, *args, **kwargs): diff --git a/setup.py b/setup.py index 3b880b2ef..8a77bb5a7 100755 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ from distutils.core import setup import sys from subprocess import check_call -from io import open +from io import open as io_open # For Makefile parsing import shlex @@ -21,7 +21,7 @@ import re -""" Makefile auxiliary functions """ +# Makefile auxiliary functions # RE_MAKE_CMD = re.compile('^\t(@\+?)(make)?', flags=re.M) @@ -37,7 +37,7 @@ def parse_makefile_aliases(filepath): # -- Parsing the Makefile using ConfigParser # Adding a fake section to make the Makefile a valid Ini file ini_str = '[root]\n' - with open(filepath, mode='r') as fd: + with io_open(filepath, mode='r') as fd: ini_str = ini_str + RE_MAKE_CMD.sub('\t', fd.read()) ini_fp = StringIO.StringIO(ini_str) # Parse using ConfigParser @@ -116,12 +116,12 @@ def execute_makefile_commands(commands, alias, verbose=False): check_call(parsed_cmd) -""" Main setup.py config """ +# Main setup.py config # # Get version from tqdm/_version.py __version__ = None version_file = os.path.join(os.path.dirname(__file__), 'tqdm', '_version.py') -with open(version_file, mode='r') as fd: +with io_open(version_file, mode='r') as fd: exec(fd.read()) # Executing makefile commands if specified @@ -154,10 +154,10 @@ def execute_makefile_commands(commands, alias, verbose=False): sys.exit(0) -""" Python package config """ +# Python package config # README_rst = '' -with open('README.rst', mode='r', encoding='utf-8') as fd: +with io_open('README.rst', mode='r', encoding='utf-8') as fd: README_rst = fd.read() setup( diff --git a/tqdm/_utils.py b/tqdm/_utils.py index 40fb2b373..3d0dc75f9 100644 --- a/tqdm/_utils.py +++ b/tqdm/_utils.py @@ -95,7 +95,6 @@ def _environ_cols_windows(fp): # pragma: no cover def _environ_cols_tput(*args): # pragma: no cover """ cygwin xterm (windows) """ try: - import subprocess import shlex cols = int(subprocess.check_call(shlex.split('tput cols'))) # rows = int(subprocess.check_call(shlex.split('tput lines'))) diff --git a/tqdm/_version.py b/tqdm/_version.py index 63bf7bdfc..76de0054f 100644 --- a/tqdm/_version.py +++ b/tqdm/_version.py @@ -1,14 +1,14 @@ # Definition of the version number try: from ._utils import _sh -except: # pragma: no cover +except StandardError: # pragma: no cover _sh = None from subprocess import STDOUT __all__ = ["__version__"] # major, minor, patch, -extra -version_info = 4, 8, 4 +version_info = 4, 9, 0 # Nice string for the version __version__ = '.'.join(map(str, version_info)) diff --git a/tqdm/tests/tests_tqdm.py b/tqdm/tests/tests_tqdm.py index d8e1e6081..d970c3a23 100644 --- a/tqdm/tests/tests_tqdm.py +++ b/tqdm/tests/tests_tqdm.py @@ -50,7 +50,7 @@ def closing(arg): if os.name == 'nt': try: import colorama # NOQA - except: + except ImportError: nt_and_no_colorama = True # Regex definitions @@ -961,7 +961,7 @@ def test_position(): maxinterval=0, desc='pos1 bar', position=1) t3 = tqdm(total=2, file=our_file, miniters=1, mininterval=0, maxinterval=0, desc='pos2 bar', position=2) - for i in _range(2): + for _ in _range(2): t1.update() t3.update() t2.update()