[Python-modules-commits] [tqdm] 01/05: Import tqdm_4.11.2.orig.tar.gz
Sandro Tosi
morph at moszumanska.debian.org
Tue Jan 24 00:33:03 UTC 2017
This is an automated email from the git hooks/post-receive script.
morph pushed a commit to branch master
in repository tqdm.
commit c0ff03647b7b53f3c2fe041995c31cd83e1f7134
Author: Sandro Tosi <morph at debian.org>
Date: Mon Jan 23 19:27:52 2017 -0500
Import tqdm_4.11.2.orig.tar.gz
---
.coveragerc | 2 ++
PKG-INFO | 2 +-
examples/7zx.py | 2 ++
setup.py | 3 ++-
tqdm.egg-info/PKG-INFO | 2 +-
tqdm/_tqdm.py | 9 ++++---
tqdm/_utils.py | 9 +++----
tqdm/_version.py | 65 ++++++++++++++++++++++++++++++---------------
tqdm/tests/tests_perf.py | 2 ++
tqdm/tests/tests_tqdm.py | 6 +++--
tqdm/tests/tests_version.py | 10 +++----
11 files changed, 72 insertions(+), 40 deletions(-)
diff --git a/.coveragerc b/.coveragerc
index ed240c1..867b767 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -4,3 +4,5 @@ omit =
tqdm/tests/*
tqdm/_tqdm_gui.py
tqdm/_tqdm_notebook.py
+[report]
+show_missing = True
diff --git a/PKG-INFO b/PKG-INFO
index 0a3612a..cd4a4e8 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: tqdm
-Version: 4.11.1
+Version: 4.11.2
Summary: Fast, Extensible Progress Meter
Home-page: https://github.com/tqdm/tqdm
Author: tqdm developers
diff --git a/examples/7zx.py b/examples/7zx.py
index 2e9f4c3..5af53ec 100644
--- a/examples/7zx.py
+++ b/examples/7zx.py
@@ -107,6 +107,8 @@ def main():
else:
t.write(l)
ex.wait()
+
+
main.__doc__ = __doc__
diff --git a/setup.py b/setup.py
index a692976..b3c262b 100755
--- a/setup.py
+++ b/setup.py
@@ -113,7 +113,8 @@ def execute_makefile_commands(commands, alias, verbose=False):
if verbose:
print("Running command: " + cmd)
# Launch the command and wait to finish (synchronized call)
- check_call(parsed_cmd, cwd=os.path.dirname(os.path.abspath(__file__)))
+ check_call(parsed_cmd,
+ cwd=os.path.dirname(os.path.abspath(__file__)))
# Main setup.py config #
diff --git a/tqdm.egg-info/PKG-INFO b/tqdm.egg-info/PKG-INFO
index 0a3612a..cd4a4e8 100644
--- a/tqdm.egg-info/PKG-INFO
+++ b/tqdm.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: tqdm
-Version: 4.11.1
+Version: 4.11.2
Summary: Fast, Extensible Progress Meter
Home-page: https://github.com/tqdm/tqdm
Author: tqdm developers
diff --git a/tqdm/_tqdm.py b/tqdm/_tqdm.py
index a5a265d..09636bf 100644
--- a/tqdm/_tqdm.py
+++ b/tqdm/_tqdm.py
@@ -63,7 +63,9 @@ class TMonitor(Thread):
_sleep = None
def __init__(self, tqdm_cls, sleep_interval):
- sys.setcheckinterval(100)
+ # setcheckinterval is deprecated
+ getattr(sys, 'setswitchinterval',
+ getattr(sys, 'setcheckinterval'))(100)
Thread.__init__(self)
self.daemon = True # kill thread when main killed (KeyboardInterrupt)
self.was_killed = False
@@ -100,7 +102,8 @@ class TMonitor(Thread):
# Then monitor!
cur_t = self._time()
# Check for each tqdm instance if one is waiting too long to print
- for instance in self.tqdm_cls._instances:
+ # NB: copy avoids size change during iteration RuntimeError
+ for instance in self.tqdm_cls._instances.copy():
# Only if mininterval > 1 (else iterations are just slow)
# and last refresh was longer than maxinterval in this instance
if instance.miniters > 1 and \
@@ -434,7 +437,7 @@ class tqdm(object):
# Force refresh display of bars we cleared
for inst in inst_cleared:
# Avoid race conditions by checking that the instance started
- if hasattr(inst, 'start_t'):
+ if hasattr(inst, 'start_t'): # pragma: nocover
inst.refresh()
# TODO: make list of all instances incl. absolutely positioned ones?
diff --git a/tqdm/_utils.py b/tqdm/_utils.py
index 3ac5d08..5a570d3 100644
--- a/tqdm/_utils.py
+++ b/tqdm/_utils.py
@@ -52,11 +52,13 @@ if True: # pragma: no cover
except ImportError: # older Python versions without ordereddict lib
# Py2.6,3.0 compat, from PEP 372
from collections import MutableMapping
+
class _OrderedDict(dict, MutableMapping):
# Methods with direct access to underlying attributes
def __init__(self, *args, **kwds):
if len(args) > 1:
- raise TypeError('expected at 1 argument, got %d', len(args))
+ raise TypeError('expected at 1 argument, got %d',
+ len(args))
if not hasattr(self, '_keys'):
self._keys = []
self.update(*args, **kwds)
@@ -203,8 +205,3 @@ def _environ_cols_linux(fp): # pragma: no cover
def _term_move_up(): # pragma: no cover
return '' if (os.name == 'nt') and (colorama is None) else '\x1b[A'
-
-
-def _sh(*cmd, **kwargs):
- return subprocess.Popen(cmd, stdout=subprocess.PIPE,
- **kwargs).communicate()[0].decode('utf-8')
diff --git a/tqdm/_version.py b/tqdm/_version.py
index fdc909a..e73184a 100644
--- a/tqdm/_version.py
+++ b/tqdm/_version.py
@@ -1,32 +1,55 @@
# Definition of the version number
-try:
- from ._utils import _sh
-except: # pragma: no cover
- _sh = None
+import os
+from io import open as io_open
-from subprocess import STDOUT
__all__ = ["__version__"]
# major, minor, patch, -extra
-version_info = 4, 11, 1
+version_info = 4, 11, 2
# Nice string for the version
__version__ = '.'.join(map(str, version_info))
# auto -extra based on commit hash (if not tagged as release)
-if (_sh is not None) and (len(version_info) < 4): # pragma: no cover
- def commit_hash(*args):
- try:
- res = _sh('git', 'log', '-n', '1', '--oneline', *args,
- stderr=STDOUT).lstrip().split()[0]
- return None if res.startswith('fatal') else res
- except:
- return None
-
- cur_hash = commit_hash()
- if cur_hash is not None:
- last_release = commit_hash('v' + __version__)
-
- if (last_release is None) or (cur_hash not in last_release):
- __version__ += '-' + cur_hash
+scriptdir = os.path.dirname(__file__)
+gitdir = os.path.abspath(os.path.join(scriptdir, "..", ".git"))
+if os.path.isdir(gitdir): # pragma: nocover
+ extra = None
+ # Open config file to check if we are in tqdm project
+ with io_open(os.path.join(gitdir, "config"), 'r') as fh_config:
+ if 'tqdm' in fh_config.read():
+ # Open the HEAD file
+ with io_open(os.path.join(gitdir, "HEAD"), 'r') as fh_head:
+ extra = fh_head.readline().strip()
+ # in a branch => HEAD points to file containing last commit
+ if 'ref:' in extra:
+ # reference file path
+ ref_file = extra[5:]
+ branch_name = ref_file.rsplit('/', 1)[-1]
+
+ ref_file_path = os.path.abspath(os.path.join(gitdir, ref_file))
+ # check that we are in git folder
+ # (by stripping the git folder from the ref file path)
+ if os.path.relpath(
+ ref_file_path, gitdir).replace('\\', '/') != ref_file:
+ # out of git folder
+ extra = None
+ else:
+ # open the ref file
+ with io_open(ref_file_path, 'r') as fh_branch:
+ commit_hash = fh_branch.readline().strip()
+ extra = commit_hash[:8]
+ if branch_name != "master":
+ extra += '.' + branch_name
+
+ # detached HEAD mode, already have commit hash
+ else:
+ extra = extra[:8]
+
+ # Append commit hash (and branch) to version string if not tagged
+ if extra is not None:
+ with io_open(os.path.join(gitdir, "refs", "tags",
+ 'v' + __version__)) as fdv:
+ if fdv.readline().strip()[:8] != extra[:8]:
+ __version__ += '-' + extra
diff --git a/tqdm/tests/tests_perf.py b/tqdm/tests/tests_perf.py
index 5febe24..ce48dff 100644
--- a/tqdm/tests/tests_perf.py
+++ b/tqdm/tests/tests_perf.py
@@ -48,6 +48,8 @@ def checkCpuTime(sleeptime=0.2):
if (abs(t1) < 0.0001 and (t1 < t2 / 10)):
return True
raise SkipTest
+
+
checkCpuTime.passed = False
diff --git a/tqdm/tests/tests_tqdm.py b/tqdm/tests/tests_tqdm.py
index 1a51efb..cf1eee2 100644
--- a/tqdm/tests/tests_tqdm.py
+++ b/tqdm/tests/tests_tqdm.py
@@ -28,6 +28,7 @@ from io import IOBase # to support unicode strings
class DeprecationError(Exception):
pass
+
# Ensure we can use `with closing(...) as ... :` syntax
if getattr(StringIO, '__exit__', False) and \
getattr(StringIO, '__enter__', False):
@@ -1515,9 +1516,10 @@ def test_monitoring_thread():
def test_postfix():
"""Test postfix"""
postfix = {'float': 0.321034, 'gen': 543, 'str': 'h', 'lst': [2]}
- postfix_order = (('w', 'w'), ('a', 0)) # no need for a OrderedDict, set is OK
+ postfix_order = (('w', 'w'), ('a', 0)) # no need for OrderedDict
expected = ['float=0.321', 'gen=543', 'lst=[2]', 'str=h']
- expected_order = ['w=w', 'a=0', 'float=0.321', 'gen=543', 'lst=[2]', 'str=h']
+ expected_order = ['w=w', 'a=0', 'float=0.321', 'gen=543', 'lst=[2]',
+ 'str=h']
# Test postfix set at init
with closing(StringIO()) as our_file:
diff --git a/tqdm/tests/tests_version.py b/tqdm/tests/tests_version.py
index 97aa6ff..6334442 100644
--- a/tqdm/tests/tests_version.py
+++ b/tqdm/tests/tests_version.py
@@ -4,9 +4,9 @@ import re
def test_version():
""" Test version string """
from tqdm import __version__
- Mmpe = re.split('[.-]', __version__)
- assert 3 <= len(Mmpe) <= 4
+ version_parts = re.split('[.-]', __version__)
+ assert 3 <= len(version_parts) # must have at least Major.minor.patch
try:
- map(int, Mmpe[:3])
- except:
- raise TypeError('Version major, minor, patch must be integers')
+ map(int, version_parts[:3])
+ except ValueError:
+ raise TypeError('Version Major.minor.patch must be 3 integers')
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/tqdm.git
More information about the Python-modules-commits
mailing list