minor docfixes, flake8 fixes, optimisations

This commit is contained in:
Casper da Costa-Luis 2015-12-17 20:53:39 +00:00
parent 3ae7a9f80b
commit 3dc5e2236a
3 changed files with 11 additions and 25 deletions

View File

@ -36,8 +36,8 @@ version is much more visually appealing.
``tqdm`` works on any platform (Linux/Windows/Mac), in any console or in a
GUI, and is also friendly with IPython/Jupyter notebooks.
``tqdm`` does not require any library nor curses to run, just a Python
interpreter.
``tqdm`` does not require any library (not even curses!) to run, just a
vanilla Python interpreter will do.
Installation
@ -187,6 +187,7 @@ Returns
Experimental GUI version of trange!
"""
Examples and Advanced Usage
---------------------------
@ -285,19 +286,8 @@ Nested progress bars
~~~~~~~~~~~~~~~~~~~~
``tqdm`` supports nested progress bars, you just need to specify the
`nested=True` argument for all tqdm instanciation except the most outer bar.
Here's an example:
.. code:: python
from tqdm import trange
from time import sleep
for i in trange(10, desc='1st loop', leave=True):
for j in trange(100, desc='2nd loop', leave=True, nested=True):
sleep(0.01)
You can of course use as many nested loops as you want, get funky:
`nested=True` argument for all tqdm instanciation except the **outermost**
bar. Here's an example:
.. code:: python
@ -309,10 +299,9 @@ You can of course use as many nested loops as you want, get funky:
for k in trange(100, desc='3nd loop', leave=True, nested=True):
sleep(0.01)
Note that on Windows, you need `colorama <https://github.com/tartley/colorama>`__
if you want to have a beautiful nested display. But in case you don't have
colorama, nested bars will still work without in-place replacement of parent
bars.
On Windows `colorama <https://github.com/tartley/colorama>`__ will be used if
available to produce a beautiful nested display.
Contributions
-------------

View File

@ -12,7 +12,7 @@ Usage:
from __future__ import division, absolute_import
# import compatibility functions and utilities
from ._utils import _supports_unicode, _environ_cols_wrapper, _range, _unich, \
_term_move_up
_term_move_up
import sys
from time import time

View File

@ -113,9 +113,6 @@ def _environ_cols_linux(fp): # pragma: no cover
def _term_move_up(): # pragma: no cover
if os.name == 'nt':
if colorama:
return '\x1b[A'
else:
if colorama is None:
return ''
else:
return '\x1b[A'
return '\x1b[A'