[Python-modules-commits] [tqdm] 01/06: Import tqdm_4.11.1.orig.tar.gz

Sandro Tosi morph at moszumanska.debian.org
Sun Jan 22 21:17:10 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 48d0c611b7fbb135c3773c6e8da868ad94a89123
Author: Sandro Tosi <morph at debian.org>
Date:   Sun Jan 22 15:53:51 2017 -0500

    Import tqdm_4.11.1.orig.tar.gz
---
 CONTRIBUTE => CONTRIBUTING.md |   0
 MANIFEST.in                   |   4 +-
 Makefile                      |   1 +
 PKG-INFO                      |  78 +++++++++++++++++++++++------
 README.rst                    |  71 +++++++++++++++++++++-----
 examples/7zx.py               | 114 ++++++++++++++++++++++++++++++++++++++++++
 logo.png                      | Bin 4982 -> 10215 bytes
 setup.py                      |  12 +++--
 tox.ini                       |  46 ++++++++++++++++-
 tqdm.egg-info/PKG-INFO        |  78 +++++++++++++++++++++++------
 tqdm.egg-info/SOURCES.txt     |   3 +-
 tqdm/_main.py                 |   6 +--
 tqdm/_tqdm.py                 |  69 +++++++++++++++++++------
 tqdm/_utils.py                |  81 +++++++++++++++++++++++++++++-
 tqdm/_version.py              |   2 +-
 tqdm/tests/tests_perf.py      |   2 +-
 tqdm/tests/tests_tqdm.py      |  40 +++++++++++++++
 17 files changed, 530 insertions(+), 77 deletions(-)

diff --git a/CONTRIBUTE b/CONTRIBUTING.md
similarity index 100%
rename from CONTRIBUTE
rename to CONTRIBUTING.md
diff --git a/MANIFEST.in b/MANIFEST.in
index b2d0577..9810bbf 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,13 +1,13 @@
 # Misc
 include .coveragerc
-include CONTRIBUTE
+include CONTRIBUTING.md
 include LICENCE
 include logo.png
+# include images/logo.gif
 include Makefile
 include README.rst
 include RELEASE
 include tox.ini
-# include tqdm.gif # too big...
 
 # Test suite
 recursive-include tqdm/tests *.py
diff --git a/Makefile b/Makefile
index 7135760..70b4c72 100644
--- a/Makefile
+++ b/Makefile
@@ -96,6 +96,7 @@ clean:
 	@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('*.py[co]')]"
 	@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('tqdm/*.py[co]')]"
 	@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('tqdm/tests/*.py[co]')]"
+	@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('tqdm/examples/*.py[co]')]"
 
 installdev:
 	python setup.py develop --uninstall
diff --git a/PKG-INFO b/PKG-INFO
index 33e1f38..0a3612a 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,11 +1,11 @@
 Metadata-Version: 1.1
 Name: tqdm
-Version: 4.10.0
-Summary: A Fast, Extensible Progress Meter
+Version: 4.11.1
+Summary: Fast, Extensible Progress Meter
 Home-page: https://github.com/tqdm/tqdm
 Author: tqdm developers
 Author-email: python.tqdm at gmail.com
-License: MPLv2.0, MIT Licenses
+License: MPLv2.0, MIT Licences
 Description: |Logo|
         
         tqdm
@@ -27,18 +27,16 @@ Description: |Logo|
         .. code:: python
         
             from tqdm import tqdm
-            for i in tqdm(range(9)):
+            for i in tqdm(range(10000)):
                 ...
         
-        Here's what the output looks like:
-        
         ``76%|████████████████████████████         | 7568/10000 [00:33<00:10, 229.00it/s]``
         
         ``trange(N)`` can be also used as a convenient shortcut for
         ``tqdm(xrange(N))``.
         
         |Screenshot|
-            Screenshot using `bpython <http://www.bpython-interpreter.org/>`__
+            REPL: `ptpython <https://github.com/jonathanslenders/ptpython>`__
         
         It can also be executed as a module with pipes:
         
@@ -47,6 +45,9 @@ Description: |Logo|
             $ seq 9999999 | tqdm --unit_scale | wc -l
             10.0Mit [00:02, 3.58Mit/s]
             9999999
+            $ 7z a -bd -r backup.7z docs/ | grep Compressing | \
+                tqdm --total $(find docs/ -type f | wc -l) --unit files >> backup.log
+            100%|███████████████████████████████▉| 8014/8014 [01:37<00:00, 82.29files/s]
         
         Overhead is low -- about 60ns per iteration (80ns with ``tqdm_gui``), and is
         unit tested against performance regression.
@@ -213,8 +214,8 @@ Description: |Logo|
             100%|███████████████████████████████▉| 8014/8014 [01:37<00:00, 82.29files/s]
         
         
-        Help!
-        -----
+        FAQ and Known Issues
+        --------------------
         
         The most common issues relate to excessive output on multiple lines, instead
         of a neat one-line progress bar.
@@ -222,12 +223,20 @@ Description: |Logo|
         - Consoles in general: require support for carriage return (``CR``, ``\r``).
         - Nested progress bars:
             * Consoles in general: require support for moving cursors up to the
-              previous line. For example, `IDLE won't work <https://github.com/tqdm/tqdm/issues/191#issuecomment-230168030>`__.
+              previous line. For example, `IDLE <https://github.com/tqdm/tqdm/issues/191#issuecomment-230168030>`__,
+              `ConEmu <https://github.com/tqdm/tqdm/issues/254>`__ and
+              `PyCharm <https://github.com/tqdm/tqdm/issues/203>`__ (also
+              `here <https://github.com/tqdm/tqdm/issues/208>`__ and
+              `here <https://github.com/tqdm/tqdm/issues/307>`__)
+              lack full support.
             * Windows: additionally may require the python module ``colorama``.
         - Wrapping enumerated iterables: use ``enumerate(tqdm(...))`` instead of
-          ``tqdm(enumerate(...))``. The same applies to ``numpy.ndenumerate``.
+          ``tqdm(enumerate(...))`. The same applies to ``numpy.ndenumerate``.
           This is because enumerate functions tend to hide the length of iterables.
           ``tqdm`` does not.
+        - Wrapping zipped iterables has similar issues due to internal optimisations.
+          ``tqdm(zip(a, b))`` should be replaced with ``zip(tqdm(a), b)`` or even
+          ``zip(tqdm(a), tqdm(b))``
         
         If you come across any other difficulties, browse/open issues
         `here <https://github.com/tqdm/tqdm/issues?q=is%3Aissue>`__.
@@ -250,7 +259,8 @@ Description: |Logo|
                            file=sys.stderr, ncols=None, mininterval=0.1,
                            maxinterval=10.0, miniters=None, ascii=None, disable=False,
                            unit='it', unit_scale=False, dynamic_ncols=False,
-                           smoothing=0.3, bar_format=None, initial=0, position=None):
+                           smoothing=0.3, bar_format=None, initial=0, position=None,
+                           postfix=None):
         
         Parameters
         ~~~~~~~~~~
@@ -320,7 +330,7 @@ Description: |Logo|
             Specify a custom bar string formatting. May impact performance.
             If unspecified, will use '{l_bar}{bar}{r_bar}', where l_bar is
             '{desc}{percentage:3.0f}%|' and r_bar is
-            '| {n_fmt}/{total_fmt} [{elapsed_str}<{remaining_str}, {rate_fmt}]'
+            '| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_fmt}]'
             Possible vars: bar, n, n_fmt, total, total_fmt, percentage,
             rate, rate_fmt, elapsed, remaining, l_bar, r_bar, desc.
         * initial  : int, optional  
@@ -330,6 +340,8 @@ Description: |Logo|
             Specify the line offset to print this bar (starting from 0)
             Automatic if unspecified.
             Useful to manage multiple bars at once (eg, from threads).
+        * postfix  : dict, optional  
+            Specify additional stats to display at the end of the bar.
         
         Extra CLI Options
         ~~~~~~~~~~~~~~~~~
@@ -391,6 +403,17 @@ Description: |Logo|
                   Print a message via tqdm (without overlap with bars)
                   """
         
+              def set_description(self, desc=None):
+                  """
+                  Set/modify description of the progress bar.
+                  """
+        
+              def set_postfix(self, **kwargs):
+                  """
+                  Set/modify postfix (additional stats)
+                  with automatic formatting based on datatype.
+                  """
+        
             def trange(*args, **kwargs):
                 """
                 A shortcut for tqdm(xrange(*args), **kwargs).
@@ -427,6 +450,27 @@ Description: |Logo|
         - consult the `wiki <https://github.com/tqdm/tqdm/wiki>`__.
             - this has an `excellent article <https://github.com/tqdm/tqdm/wiki/How-to-make-a-great-Progress-Bar>`__ on how to make a **great** progressbar.
         
+        Description and additional stats
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        
+        Custom information can be displayed and updated dynamically on ``tqdm`` bars
+        with the ``desc`` and ``postfix`` arguments:
+        
+        .. code:: python
+        
+            from tqdm import trange
+            from random import random, randint
+            from time import sleep
+        
+            t = trange(100)
+            for i in t:
+                # Description will be displayed on the left
+                t.set_description('GEN %i' % i)
+                # Postfix will be displayed on the right, and will format automatically 
+                # based on argument's datatype
+                t.set_postfix(loss=random(), gen=randint(1,999), str='h', lst=[1, 2])
+                sleep(0.1)
+        
         Nested progress bars
         ~~~~~~~~~~~~~~~~~~~~
         
@@ -690,7 +734,7 @@ Description: |Logo|
         Contributions are welcome.
         
         See the
-        `CONTRIBUTE <https://raw.githubusercontent.com/tqdm/tqdm/master/CONTRIBUTE>`__
+        `CONTRIBUTING <https://raw.githubusercontent.com/tqdm/tqdm/master/CONTRIBUTING.md>`__
         file for more information.
         
         
@@ -718,7 +762,7 @@ Description: |Logo|
         
         |README-Hits| (Since 19 May 2016)
         
-        .. |Logo| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/logo.png
+        .. |Logo| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/logo.gif
         .. |Screenshot| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm.gif
         .. |Build-Status| image:: https://travis-ci.org/tqdm/tqdm.svg?branch=master
            :target: https://travis-ci.org/tqdm/tqdm
@@ -749,7 +793,8 @@ Description: |Logo|
         .. |Screenshot-Jupyter1| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-1.gif
         .. |Screenshot-Jupyter2| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-2.gif
         .. |Screenshot-Jupyter3| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-3.gif
-        .. |README-Hits| image:: http://hitt.herokuapp.com/tqdm/tqdm.svg
+        .. |README-Hits| image:: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://caspersci.uk.to/images/tqdm.png&f=https://raw.githubusercontent.com/tqdm/tqdm/master/images/logo.gif
+           :target: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://caspersci.uk.to/images/tqdm.png&f=https://raw.githubusercontent.com/tqdm/tqdm/master/images/logo.gif&style=social
         
 Keywords: progressbar progressmeter progress bar meter rate eta console terminal time
 Platform: any
@@ -774,6 +819,7 @@ Classifier: Programming Language :: Python :: 3.2
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Programming Language :: Python :: Implementation :: IronPython
 Classifier: Topic :: Software Development :: Libraries
diff --git a/README.rst b/README.rst
index 77cda1b..862810a 100644
--- a/README.rst
+++ b/README.rst
@@ -19,18 +19,16 @@ iterable with ``tqdm(iterable)``, and you're done!
 .. code:: python
 
     from tqdm import tqdm
-    for i in tqdm(range(9)):
+    for i in tqdm(range(10000)):
         ...
 
-Here's what the output looks like:
-
 ``76%|████████████████████████████         | 7568/10000 [00:33<00:10, 229.00it/s]``
 
 ``trange(N)`` can be also used as a convenient shortcut for
 ``tqdm(xrange(N))``.
 
 |Screenshot|
-    Screenshot using `bpython <http://www.bpython-interpreter.org/>`__
+    REPL: `ptpython <https://github.com/jonathanslenders/ptpython>`__
 
 It can also be executed as a module with pipes:
 
@@ -39,6 +37,9 @@ It can also be executed as a module with pipes:
     $ seq 9999999 | tqdm --unit_scale | wc -l
     10.0Mit [00:02, 3.58Mit/s]
     9999999
+    $ 7z a -bd -r backup.7z docs/ | grep Compressing | \
+        tqdm --total $(find docs/ -type f | wc -l) --unit files >> backup.log
+    100%|███████████████████████████████▉| 8014/8014 [01:37<00:00, 82.29files/s]
 
 Overhead is low -- about 60ns per iteration (80ns with ``tqdm_gui``), and is
 unit tested against performance regression.
@@ -205,8 +206,8 @@ Backing up a large directory?
     100%|███████████████████████████████▉| 8014/8014 [01:37<00:00, 82.29files/s]
 
 
-Help!
------
+FAQ and Known Issues
+--------------------
 
 The most common issues relate to excessive output on multiple lines, instead
 of a neat one-line progress bar.
@@ -214,12 +215,20 @@ of a neat one-line progress bar.
 - Consoles in general: require support for carriage return (``CR``, ``\r``).
 - Nested progress bars:
     * Consoles in general: require support for moving cursors up to the
-      previous line. For example, `IDLE won't work <https://github.com/tqdm/tqdm/issues/191#issuecomment-230168030>`__.
+      previous line. For example, `IDLE <https://github.com/tqdm/tqdm/issues/191#issuecomment-230168030>`__,
+      `ConEmu <https://github.com/tqdm/tqdm/issues/254>`__ and
+      `PyCharm <https://github.com/tqdm/tqdm/issues/203>`__ (also
+      `here <https://github.com/tqdm/tqdm/issues/208>`__ and
+      `here <https://github.com/tqdm/tqdm/issues/307>`__)
+      lack full support.
     * Windows: additionally may require the python module ``colorama``.
 - Wrapping enumerated iterables: use ``enumerate(tqdm(...))`` instead of
-  ``tqdm(enumerate(...))``. The same applies to ``numpy.ndenumerate``.
+  ``tqdm(enumerate(...))`. The same applies to ``numpy.ndenumerate``.
   This is because enumerate functions tend to hide the length of iterables.
   ``tqdm`` does not.
+- Wrapping zipped iterables has similar issues due to internal optimisations.
+  ``tqdm(zip(a, b))`` should be replaced with ``zip(tqdm(a), b)`` or even
+  ``zip(tqdm(a), tqdm(b))``
 
 If you come across any other difficulties, browse/open issues
 `here <https://github.com/tqdm/tqdm/issues?q=is%3Aissue>`__.
@@ -242,7 +251,8 @@ Documentation
                    file=sys.stderr, ncols=None, mininterval=0.1,
                    maxinterval=10.0, miniters=None, ascii=None, disable=False,
                    unit='it', unit_scale=False, dynamic_ncols=False,
-                   smoothing=0.3, bar_format=None, initial=0, position=None):
+                   smoothing=0.3, bar_format=None, initial=0, position=None,
+                   postfix=None):
 
 Parameters
 ~~~~~~~~~~
@@ -312,7 +322,7 @@ Parameters
     Specify a custom bar string formatting. May impact performance.
     If unspecified, will use '{l_bar}{bar}{r_bar}', where l_bar is
     '{desc}{percentage:3.0f}%|' and r_bar is
-    '| {n_fmt}/{total_fmt} [{elapsed_str}<{remaining_str}, {rate_fmt}]'
+    '| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_fmt}]'
     Possible vars: bar, n, n_fmt, total, total_fmt, percentage,
     rate, rate_fmt, elapsed, remaining, l_bar, r_bar, desc.
 * initial  : int, optional  
@@ -322,6 +332,8 @@ Parameters
     Specify the line offset to print this bar (starting from 0)
     Automatic if unspecified.
     Useful to manage multiple bars at once (eg, from threads).
+* postfix  : dict, optional  
+    Specify additional stats to display at the end of the bar.
 
 Extra CLI Options
 ~~~~~~~~~~~~~~~~~
@@ -383,6 +395,17 @@ Returns
           Print a message via tqdm (without overlap with bars)
           """
 
+      def set_description(self, desc=None):
+          """
+          Set/modify description of the progress bar.
+          """
+
+      def set_postfix(self, **kwargs):
+          """
+          Set/modify postfix (additional stats)
+          with automatic formatting based on datatype.
+          """
+
     def trange(*args, **kwargs):
         """
         A shortcut for tqdm(xrange(*args), **kwargs).
@@ -419,6 +442,27 @@ Examples and Advanced Usage
 - consult the `wiki <https://github.com/tqdm/tqdm/wiki>`__.
     - this has an `excellent article <https://github.com/tqdm/tqdm/wiki/How-to-make-a-great-Progress-Bar>`__ on how to make a **great** progressbar.
 
+Description and additional stats
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Custom information can be displayed and updated dynamically on ``tqdm`` bars
+with the ``desc`` and ``postfix`` arguments:
+
+.. code:: python
+
+    from tqdm import trange
+    from random import random, randint
+    from time import sleep
+
+    t = trange(100)
+    for i in t:
+        # Description will be displayed on the left
+        t.set_description('GEN %i' % i)
+        # Postfix will be displayed on the right, and will format automatically 
+        # based on argument's datatype
+        t.set_postfix(loss=random(), gen=randint(1,999), str='h', lst=[1, 2])
+        sleep(0.1)
+
 Nested progress bars
 ~~~~~~~~~~~~~~~~~~~~
 
@@ -682,7 +726,7 @@ All source code is hosted on `GitHub <https://github.com/tqdm/tqdm>`__.
 Contributions are welcome.
 
 See the
-`CONTRIBUTE <https://raw.githubusercontent.com/tqdm/tqdm/master/CONTRIBUTE>`__
+`CONTRIBUTING <https://raw.githubusercontent.com/tqdm/tqdm/master/CONTRIBUTING.md>`__
 file for more information.
 
 
@@ -710,7 +754,7 @@ Ranked by contributions.
 
 |README-Hits| (Since 19 May 2016)
 
-.. |Logo| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/logo.png
+.. |Logo| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/logo.gif
 .. |Screenshot| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm.gif
 .. |Build-Status| image:: https://travis-ci.org/tqdm/tqdm.svg?branch=master
    :target: https://travis-ci.org/tqdm/tqdm
@@ -741,4 +785,5 @@ Ranked by contributions.
 .. |Screenshot-Jupyter1| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-1.gif
 .. |Screenshot-Jupyter2| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-2.gif
 .. |Screenshot-Jupyter3| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-3.gif
-.. |README-Hits| image:: http://hitt.herokuapp.com/tqdm/tqdm.svg
+.. |README-Hits| image:: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://caspersci.uk.to/images/tqdm.png&f=https://raw.githubusercontent.com/tqdm/tqdm/master/images/logo.gif
+   :target: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://caspersci.uk.to/images/tqdm.png&f=https://raw.githubusercontent.com/tqdm/tqdm/master/images/logo.gif&style=social
diff --git a/examples/7zx.py b/examples/7zx.py
new file mode 100644
index 0000000..2e9f4c3
--- /dev/null
+++ b/examples/7zx.py
@@ -0,0 +1,114 @@
+# -*- coding: utf-8 -*-
+"""Usage:
+  7zx.py [--help | options] <zipfiles>...
+
+Options:
+  -h, --help     Print this help and exit
+  -v, --version  Print version and exit
+  -c, --compressed       Use compressed (instead of uncompressed) file sizes
+  -s, --silent   Do not print one row per zip file
+  -y, --yes      Assume yes to all queries (for extraction)
+  -D=<level>, --debug=<level>
+                 Print various types of debugging information. Choices:
+                         CRITICAL|FATAL
+                         ERROR
+                         WARN(ING)
+                         [default: INFO]
+                         DEBUG
+                         NOTSET
+  -d, --debug-trace      Print lots of debugging information (-D NOTSET)
+"""
+from __future__ import print_function
+from docopt import docopt
+import logging as log
+import subprocess
+import re
+from tqdm import tqdm
+import pty
+import os
+import io
+__author__ = "Casper da Costa-Luis <casper.dcl at physics.org>"
+__licence__ = "MPLv2.0"
+__version__ = "0.2.0"
+__license__ = __licence__
+
+
+RE_SCN = re.compile("([0-9]+)\s+([0-9]+)\s+(.*)$", flags=re.M)
+
+
+def main():
+    args = docopt(__doc__, version=__version__)
+    if args.pop('--debug-trace', False):
+        args['--debug'] = "NOTSET"
+    log.basicConfig(level=getattr(log, args['--debug'], log.INFO),
+                    format='%(levelname)s: %(message)s')
+    log.debug(args)
+
+    # Get compressed sizes
+    zips = {}
+    for fn in args['<zipfiles>']:
+        info = subprocess.check_output(["7z", "l", fn]).strip()
+        finfo = RE_SCN.findall(info)
+
+        # builtin test: last line should be total sizes
+        log.debug(finfo)
+        totals = map(int, finfo[-1][:2])
+        # log.debug(totals)
+        for s in range(2):
+            assert(sum(map(int, (inf[s] for inf in finfo[:-1]))) == totals[s])
+        fcomp = dict((n, int(c if args['--compressed'] else u))
+                     for (u, c, n) in finfo[:-1])
+        # log.debug(fcomp)
+        # zips  : {'zipname' : {'filename' : int(size)}}
+        zips[fn] = fcomp
+
+    # Extract
+    cmd7zx = ["7z", "x", "-bd"]
+    if args['--yes']:
+        cmd7zx += ["-y"]
+    log.info("Extracting from {:d} file(s)".format(len(zips)))
+    with tqdm(total=sum(sum(fcomp.values()) for fcomp in zips.values()),
+              unit="B", unit_scale=True) as tall:
+        for fn, fcomp in zips.items():
+            md, sd = pty.openpty()
+            ex = subprocess.Popen(cmd7zx + [fn],
+                                  bufsize=1,
+                                  stdout=md,  # subprocess.PIPE,
+                                  stderr=subprocess.STDOUT)
+            os.close(sd)
+            with io.open(md, mode="rU", buffering=1) as m:
+                with tqdm(total=sum(fcomp.values()), disable=len(zips) < 2,
+                          leave=False, unit="B", unit_scale=True) as t:
+                    while True:
+                        try:
+                            l_raw = m.readline()
+                        except IOError:
+                            break
+                        l = l_raw.strip()
+                        if l.startswith("Extracting"):
+                            exname = l.lstrip("Extracting").lstrip()
+                            s = fcomp.get(exname, 0)  # 0 is likely folders
+                            t.update(s)
+                            tall.update(s)
+                        elif l:
+                            if not any(l.startswith(i) for i in
+                                       ("7-Zip ",
+                                        "p7zip Version ",
+                                        "Everything is Ok",
+                                        "Folders: ",
+                                        "Files: ",
+                                        "Size: ",
+                                        "Compressed: ")):
+                                if l.startswith("Processing archive: "):
+                                    if not args['--silent']:
+                                        t.write(t.format_interval(
+                                            t.start_t - tall.start_t) + ' ' +
+                                            l.lstrip("Processing archive: "))
+                                else:
+                                    t.write(l)
+            ex.wait()
+main.__doc__ = __doc__
+
+
+if __name__ == "__main__":
+    main()
diff --git a/logo.png b/logo.png
index f5969ee..ea3cb31 100644
Binary files a/logo.png and b/logo.png differ
diff --git a/setup.py b/setup.py
index 8a77bb5..a692976 100755
--- a/setup.py
+++ b/setup.py
@@ -113,7 +113,7 @@ 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)
+            check_call(parsed_cmd, cwd=os.path.dirname(os.path.abspath(__file__)))
 
 
 # Main setup.py config #
@@ -127,7 +127,7 @@ with io_open(version_file, mode='r') as fd:
 # Executing makefile commands if specified
 if sys.argv[1].lower().strip() == 'make':
     # Filename of the makefile
-    fpath = 'Makefile'
+    fpath = os.path.join(os.path.dirname(__file__), 'Makefile')
     # Parse the makefile, substitute the aliases and extract the commands
     commands = parse_makefile_aliases(fpath)
 
@@ -157,14 +157,15 @@ if sys.argv[1].lower().strip() == 'make':
 # Python package config #
 
 README_rst = ''
-with io_open('README.rst', mode='r', encoding='utf-8') as fd:
+fndoc = os.path.join(os.path.dirname(__file__), 'README.rst')
+with io_open(fndoc, mode='r', encoding='utf-8') as fd:
     README_rst = fd.read()
 
 setup(
     name='tqdm',
     version=__version__,
-    description='A Fast, Extensible Progress Meter',
-    license='MPLv2.0, MIT Licenses',
+    description='Fast, Extensible Progress Meter',
+    license='MPLv2.0, MIT Licences',
     author='Noam Yorav-Raphael',
     author_email='noamraph at gmail.com',
     url='https://github.com/tqdm/tqdm',
@@ -198,6 +199,7 @@ setup(
         'Programming Language :: Python :: 3.3',
         'Programming Language :: Python :: 3.4',
         'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: Implementation :: PyPy',
         'Programming Language :: Python :: Implementation :: IronPython',
         'Topic :: Software Development :: Libraries',
diff --git a/tox.ini b/tox.ini
index f515b48..5a83132 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,8 @@
 # and then run "tox" from this directory.
 
 [tox]
-envlist = py26, py27, py32, py33, py34, py35, pypy, pypy3, flake8, setup.py, perf
+# deprecation warning: py26, py33
+envlist = py32, py33, py34, py26, py27, py35, py36, pypy, pypy3, pypy3.3-5.2-alpha1, flake8, setup.py, perf
 
 [testenv]
 passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
@@ -13,10 +14,53 @@ deps =
     nose-timer
     coverage<4
     coveralls
+    cython
+    numpy
+    pandas
 commands =
     nosetests --with-coverage --with-timer --cover-package=tqdm --ignore-files="tests_perf\.py" -d -v tqdm/
     - coveralls
 
+[testenv:pypy]
+passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
+deps =
+    nose
+    nose-timer
+    coverage<4
+    coveralls
+commands =
+    nosetests --with-coverage --with-timer --cover-package=tqdm --ignore-files="tests_p(erf|andas)\.py" -d -v tqdm/
+    - coveralls
+
+[testenv:pypy3]
+passenv = {[testenv:pypy]passenv}
+deps =
+    {[testenv:pypy]deps}
+commands =
+    {[testenv:pypy]commands}
+
+[testenv:pypy3.3-5.2-alpha1]
+passenv = {[testenv:pypy]passenv}
+deps =
+    {[testenv:pypy]deps}
+    virtualenv>=15.0.2
+commands =
+    {[testenv:pypy]commands}
+
+[testenv:py26]
+passenv = {[testenv:pypy]passenv}
+deps =
+    {[testenv:pypy]deps}
+commands =
+    {[testenv:pypy]commands}
+
+[testenv:py33]
+passenv = {[testenv:pypy]passenv}
+deps =
+    {[testenv:pypy]deps}
+commands =
+    {[testenv:pypy]commands}
+
 [testenv:flake8]
 deps = flake8
 commands =
diff --git a/tqdm.egg-info/PKG-INFO b/tqdm.egg-info/PKG-INFO
index 33e1f38..0a3612a 100644
--- a/tqdm.egg-info/PKG-INFO
+++ b/tqdm.egg-info/PKG-INFO
@@ -1,11 +1,11 @@
 Metadata-Version: 1.1
 Name: tqdm
-Version: 4.10.0
-Summary: A Fast, Extensible Progress Meter
+Version: 4.11.1
+Summary: Fast, Extensible Progress Meter
 Home-page: https://github.com/tqdm/tqdm
 Author: tqdm developers
 Author-email: python.tqdm at gmail.com
-License: MPLv2.0, MIT Licenses
+License: MPLv2.0, MIT Licences
 Description: |Logo|
         
         tqdm
@@ -27,18 +27,16 @@ Description: |Logo|
         .. code:: python
         
             from tqdm import tqdm
-            for i in tqdm(range(9)):
+            for i in tqdm(range(10000)):
                 ...
         
-        Here's what the output looks like:
-        
         ``76%|████████████████████████████         | 7568/10000 [00:33<00:10, 229.00it/s]``
         
         ``trange(N)`` can be also used as a convenient shortcut for
         ``tqdm(xrange(N))``.
         
         |Screenshot|
-            Screenshot using `bpython <http://www.bpython-interpreter.org/>`__
+            REPL: `ptpython <https://github.com/jonathanslenders/ptpython>`__
         
         It can also be executed as a module with pipes:
         
@@ -47,6 +45,9 @@ Description: |Logo|
             $ seq 9999999 | tqdm --unit_scale | wc -l
             10.0Mit [00:02, 3.58Mit/s]
             9999999
+            $ 7z a -bd -r backup.7z docs/ | grep Compressing | \
+                tqdm --total $(find docs/ -type f | wc -l) --unit files >> backup.log
+            100%|███████████████████████████████▉| 8014/8014 [01:37<00:00, 82.29files/s]
         
         Overhead is low -- about 60ns per iteration (80ns with ``tqdm_gui``), and is
         unit tested against performance regression.
@@ -213,8 +214,8 @@ Description: |Logo|
             100%|███████████████████████████████▉| 8014/8014 [01:37<00:00, 82.29files/s]
         
         
-        Help!
-        -----
+        FAQ and Known Issues
+        --------------------
         
         The most common issues relate to excessive output on multiple lines, instead
         of a neat one-line progress bar.
@@ -222,12 +223,20 @@ Description: |Logo|
         - Consoles in general: require support for carriage return (``CR``, ``\r``).
         - Nested progress bars:
             * Consoles in general: require support for moving cursors up to the
-              previous line. For example, `IDLE won't work <https://github.com/tqdm/tqdm/issues/191#issuecomment-230168030>`__.
+              previous line. For example, `IDLE <https://github.com/tqdm/tqdm/issues/191#issuecomment-230168030>`__,
+              `ConEmu <https://github.com/tqdm/tqdm/issues/254>`__ and
+              `PyCharm <https://github.com/tqdm/tqdm/issues/203>`__ (also
+              `here <https://github.com/tqdm/tqdm/issues/208>`__ and
+              `here <https://github.com/tqdm/tqdm/issues/307>`__)
+              lack full support.
             * Windows: additionally may require the python module ``colorama``.
         - Wrapping enumerated iterables: use ``enumerate(tqdm(...))`` instead of
-          ``tqdm(enumerate(...))``. The same applies to ``numpy.ndenumerate``.
+          ``tqdm(enumerate(...))`. The same applies to ``numpy.ndenumerate``.
           This is because enumerate functions tend to hide the length of iterables.
           ``tqdm`` does not.
+        - Wrapping zipped iterables has similar issues due to internal optimisations.
+          ``tqdm(zip(a, b))`` should be replaced with ``zip(tqdm(a), b)`` or even
+          ``zip(tqdm(a), tqdm(b))``
         
         If you come across any other difficulties, browse/open issues
         `here <https://github.com/tqdm/tqdm/issues?q=is%3Aissue>`__.
@@ -250,7 +259,8 @@ Description: |Logo|
                            file=sys.stderr, ncols=None, mininterval=0.1,
                            maxinterval=10.0, miniters=None, ascii=None, disable=False,
                            unit='it', unit_scale=False, dynamic_ncols=False,
-                           smoothing=0.3, bar_format=None, initial=0, position=None):
+                           smoothing=0.3, bar_format=None, initial=0, position=None,
+                           postfix=None):
         
         Parameters
         ~~~~~~~~~~
@@ -320,7 +330,7 @@ Description: |Logo|
             Specify a custom bar string formatting. May impact performance.
             If unspecified, will use '{l_bar}{bar}{r_bar}', where l_bar is
             '{desc}{percentage:3.0f}%|' and r_bar is
-            '| {n_fmt}/{total_fmt} [{elapsed_str}<{remaining_str}, {rate_fmt}]'
+            '| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_fmt}]'
             Possible vars: bar, n, n_fmt, total, total_fmt, percentage,
             rate, rate_fmt, elapsed, remaining, l_bar, r_bar, desc.
         * initial  : int, optional  
@@ -330,6 +340,8 @@ Description: |Logo|
             Specify the line offset to print this bar (starting from 0)
             Automatic if unspecified.
             Useful to manage multiple bars at once (eg, from threads).
+        * postfix  : dict, optional  
+            Specify additional stats to display at the end of the bar.
         
         Extra CLI Options
         ~~~~~~~~~~~~~~~~~
@@ -391,6 +403,17 @@ Description: |Logo|
                   Print a message via tqdm (without overlap with bars)
                   """
         
+              def set_description(self, desc=None):
+                  """
+                  Set/modify description of the progress bar.
+                  """
+        
+              def set_postfix(self, **kwargs):
+                  """
+                  Set/modify postfix (additional stats)
+                  with automatic formatting based on datatype.
+                  """
+        
             def trange(*args, **kwargs):
                 """
                 A shortcut for tqdm(xrange(*args), **kwargs).
@@ -427,6 +450,27 @@ Description: |Logo|
         - consult the `wiki <https://github.com/tqdm/tqdm/wiki>`__.
             - this has an `excellent article <https://github.com/tqdm/tqdm/wiki/How-to-make-a-great-Progress-Bar>`__ on how to make a **great** progressbar.
         
+        Description and additional stats
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        
+        Custom information can be displayed and updated dynamically on ``tqdm`` bars
+        with the ``desc`` and ``postfix`` arguments:
+        
+        .. code:: python
+        
+            from tqdm import trange
+            from random import random, randint
+            from time import sleep
+        
+            t = trange(100)
+            for i in t:
+                # Description will be displayed on the left
+                t.set_description('GEN %i' % i)
+                # Postfix will be displayed on the right, and will format automatically 
+                # based on argument's datatype
+                t.set_postfix(loss=random(), gen=randint(1,999), str='h', lst=[1, 2])
+                sleep(0.1)
+        
         Nested progress bars
         ~~~~~~~~~~~~~~~~~~~~
         
@@ -690,7 +734,7 @@ Description: |Logo|
         Contributions are welcome.
         
         See the
-        `CONTRIBUTE <https://raw.githubusercontent.com/tqdm/tqdm/master/CONTRIBUTE>`__
+        `CONTRIBUTING <https://raw.githubusercontent.com/tqdm/tqdm/master/CONTRIBUTING.md>`__
         file for more information.
         
         
@@ -718,7 +762,7 @@ Description: |Logo|
         
         |README-Hits| (Since 19 May 2016)
         
-        .. |Logo| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/logo.png
+        .. |Logo| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/logo.gif
         .. |Screenshot| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm.gif
         .. |Build-Status| image:: https://travis-ci.org/tqdm/tqdm.svg?branch=master
            :target: https://travis-ci.org/tqdm/tqdm
@@ -749,7 +793,8 @@ Description: |Logo|
         .. |Screenshot-Jupyter1| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-1.gif
         .. |Screenshot-Jupyter2| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-2.gif
         .. |Screenshot-Jupyter3| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-3.gif
-        .. |README-Hits| image:: http://hitt.herokuapp.com/tqdm/tqdm.svg
+        .. |README-Hits| image:: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://caspersci.uk.to/images/tqdm.png&f=https://raw.githubusercontent.com/tqdm/tqdm/master/images/logo.gif
+           :target: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://caspersci.uk.to/images/tqdm.png&f=https://raw.githubusercontent.com/tqdm/tqdm/master/images/logo.gif&style=social
         
 Keywords: progressbar progressmeter progress bar meter rate eta console terminal time
 Platform: any
@@ -774,6 +819,7 @@ Classifier: Programming Language :: Python :: 3.2
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Programming Language :: Python :: Implementation :: IronPython
 Classifier: Topic :: Software Development :: Libraries
diff --git a/tqdm.egg-info/SOURCES.txt b/tqdm.egg-info/SOURCES.txt
index 6c1887f..f711b37 100644
--- a/tqdm.egg-info/SOURCES.txt
+++ b/tqdm.egg-info/SOURCES.txt
@@ -1,5 +1,5 @@
 .coveragerc
-CONTRIBUTE
+CONTRIBUTING.md
 LICENCE
 MANIFEST.in
 Makefile
@@ -9,6 +9,7 @@ setup.cfg
 setup.py
 tox.ini
 examples/.git
+examples/7zx.py
 examples/include_no_requirements.py
 examples/pandas_progress_apply.py
 examples/simple_examples.py
diff --git a/tqdm/_main.py b/tqdm/_main.py
index c9ae678..7925baa 100644
--- a/tqdm/_main.py
+++ b/tqdm/_main.py
@@ -117,7 +117,7 @@ def main(fp=sys.stderr):
     d = ''.join('\n  --{0}=<{0}>  : {1}{2}'.format(*otd)
                 for otd in opt_types_desc if otd[0] not in UNSUPPORTED_OPTS)
 
-    __doc__ = """Usage:
+    d = """Usage:
   tqdm [--help | options]
 
 Options:
@@ -126,12 +126,12 @@ Options:
 
 """ + d.strip('\n') + '\n'
 
-    # opts = docopt(__doc__, version=__version__)
+    # opts = docopt(d, version=__version__)
     if any(v in sys.argv for v in ('-v', '--version')):
         sys.stdout.write(__version__ + '\n')
         sys.exit(0)
     elif any(v in sys.argv for v in ('-h', '--help')):
-        sys.stdout.write(__doc__ + '\n')
+        sys.stdout.write(d + '\n')
         sys.exit(0)
 
     argv = RE_SHLEX.split(' '.join(sys.argv))
diff --git a/tqdm/_tqdm.py b/tqdm/_tqdm.py
index a21180c..a5a265d 100644
--- a/tqdm/_tqdm.py
+++ b/tqdm/_tqdm.py
@@ -8,13 +8,14 @@ Usage:
   ...     ...
 """
 from __future__ import absolute_import
-# future division is important to divide integers and get as
-# a result precise floating numbers (instead of truncated int)
+# integer division / : float, // : int
 from __future__ import division
-# import compatibility functions and utilities
+# compatibility functions and utilities
 from ._utils import _supports_unicode, _environ_cols_wrapper, _range, _unich, \
-    _term_move_up, _unicode, WeakSet
+    _term_move_up, _unicode, WeakSet, _basestring, _OrderedDict
+# native libraries
 import sys
+from numbers import Number
 from threading import Thread
 from time import time
 from time import sleep
@@ -199,7 +200,7 @@ class tqdm(object):
     @staticmethod
     def format_meter(n, total, elapsed, ncols=None, prefix='',
                      ascii=False, unit='it', unit_scale=False, rate=None,
-                     bar_format=None):
+                     bar_format=None, postfix=None):
         """
         Return a string-based progress bar given some parameters
 
@@ -237,9 +238,11 @@ class tqdm(object):
             Specify a custom bar string formatting. May impact performance.
             [default: '{l_bar}{bar}{r_bar}'], where l_bar is
             '{desc}{percentage:3.0f}%|' and r_bar is
-            '| {n_fmt}/{total_fmt} [{elapsed_str}<{remaining_str}, {rate_fmt}]'
+            '| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_fmt}]'
             Possible vars: bar, n, n_fmt, total, total_fmt, percentage,
             rate, rate_fmt, elapsed, remaining, l_bar, r_bar, desc.
+        postfix  : str, optional
+            Same as prefix but will be placed at the end as additional stats.
 
         Returns
         -------
@@ -284,8 +287,9 @@ class tqdm(object):
             # format the stats displayed to the left and right sides of the bar
             l_bar = (prefix if prefix else '') + \
                 '{0:3.0f}%|'.format(percentage)
-            r_bar = '| {0}/{1} [{2}<{3}, {4}]'.format(
-                    n_fmt, total_fmt, elapsed_str, remaining_str, rate_fmt)
+            r_bar = '| {0}/{1} [{2}<{3}, {4}{5}]'.format(
+                    n_fmt, total_fmt, elapsed_str, remaining_str, rate_fmt,
+                    ', '+postfix if postfix else '')
 
             if ncols == 0:
                 return l_bar[:-1] + r_bar[1:]
@@ -310,6 +314,7 @@ class tqdm(object):
                             'l_bar': l_bar,
                             'r_bar': r_bar,
                             'desc': prefix if prefix else '',
+                            'postfix': ', '+postfix if postfix else '',
                             # 'bar': full_bar  # replaced by procedure below
                             }
 
@@ -358,8 +363,9 @@ class tqdm(object):
 
         # no total: no progressbar, ETA, just progress stats
         else:
-            return (prefix if prefix else '') + '{0}{1} [{2}, {3}]'.format(
-                n_fmt, unit, elapsed_str, rate_fmt)
+            return (prefix if prefix else '') + '{0}{1} [{2}, {3}{4}]'.format(
+                n_fmt, unit, elapsed_str, rate_fmt,
+                ', '+postfix if postfix else '')
 
     def __new__(cls, *args, **kwargs):
         # Create a new instance
@@ -540,6 +546,7 @@ class tqdm(object):
                  maxinterval=10.0, miniters=None, ascii=None, disable=False,
                  unit='it', unit_scale=False, dynamic_ncols=False,
                  smoothing=0.3, bar_format=None, initial=0, position=None,
+                 postfix=None,
                  gui=False, **kwargs):
         """
         Parameters
@@ -609,7 +616,7 @@ class tqdm(object):
             Specify a custom bar string formatting. May impact performance.
             If unspecified, will use '{l_bar}{bar}{r_bar}', where l_bar is
             '{desc}{percentage:3.0f}%|' and r_bar is
-            '| {n_fmt}/{total_fmt} [{elapsed_str}<{remaining_str}, {rate_fmt}]'
+            '| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_fmt}]'
             Possible vars: bar, n, n_fmt, total, total_fmt, percentage,
             rate, rate_fmt, elapsed, remaining, l_bar, r_bar, desc.
         initial  : int, optional
@@ -619,6 +626,8 @@ class tqdm(object):
             Specify the line offset to print this bar (starting from 0)
... 274 lines suppressed ...

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