fix & update API docs

This commit is contained in:
Casper da Costa-Luis 2023-08-05 22:56:07 +01:00
parent 17482374a5
commit 4f54ec0f8b
No known key found for this signature in database
GPG Key ID: F5126E5FBD2512AD
4 changed files with 17 additions and 16 deletions

View File

@ -345,12 +345,14 @@ Documentation
class tqdm():
"""{DOC_tqdm}"""
@envwrap("TQDM_", is_method=True) # override defaults via env vars
def __init__(self, iterable=None, desc=None, total=None, leave=True,
file=None, 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,
postfix=None, unit_divisor=1000):
postfix=None, unit_divisor=1000, write_bytes=False,
lock_args=None, nrows=None, colour=None, delay=0):
Parameters
~~~~~~~~~~

View File

@ -2,11 +2,10 @@
Auto-generate README.rst from .meta/.readme.rst and docstrings.
"""
import sys
from io import open as io_open
from os import path
from pathlib import Path
from textwrap import dedent
sys.path.insert(0, path.dirname(path.dirname(__file__)))
sys.path.insert(0, str(Path(__file__).parent.parent))
import tqdm # NOQA
import tqdm.cli # NOQA
@ -42,13 +41,13 @@ def doc2rst(doc, arglist=True, raw=False):
return doc
src_dir = path.abspath(path.dirname(__file__))
README_rst = path.join(src_dir, '.readme.rst')
with io_open(README_rst, mode='r', encoding='utf-8') as fd:
README_rst = fd.read()
DOC_tqdm = doc2rst(tqdm.tqdm.__doc__, False).replace('\n', '\n ')
DOC_tqdm_init = doc2rst(tqdm.tqdm.__init__.__doc__)
DOC_tqdm_init_args = DOC_tqdm_init.partition(doc2rst(HEAD_ARGS))[-1].replace('\n ', '\n ')
src_dir = Path(__file__).parent.resolve()
README_rst = (src_dir / '.readme.rst').read_text("utf-8")
class_doc, init_doc = tqdm.tqdm.__doc__.split('\n\n', 1)
DOC_tqdm = doc2rst(class_doc + '\n', False).replace('\n', '\n ')
DOC_tqdm_init = doc2rst('\n' + init_doc)
DOC_tqdm_init_args = DOC_tqdm_init.partition(doc2rst(HEAD_ARGS))[-1].replace(
'\n ', '\n ').replace('\n ', '\n ')
DOC_tqdm_init_args, _, DOC_tqdm_init_rets = DOC_tqdm_init_args.partition(doc2rst(HEAD_RETS))
DOC_cli = doc2rst(tqdm.cli.CLI_EXTRA_DOC).partition(doc2rst(HEAD_CLI))[-1]
DOC_tqdm_tqdm = {}
@ -70,6 +69,4 @@ for k, v in DOC_tqdm_tqdm.items():
README_rst = README_rst.replace('{DOC_tqdm.tqdm.%s}' % k, v)
if __name__ == "__main__":
fndoc = path.join(path.dirname(src_dir), 'README.rst')
with io_open(fndoc, mode='w', encoding='utf-8') as fd:
fd.write(README_rst)
(src_dir.parent / 'README.rst').write_text(README_rst, encoding='utf-8')

View File

@ -349,12 +349,14 @@ Documentation
progressbar every time a value is requested.
"""
@envwrap("TQDM_", is_method=True) # override defaults via env vars
def __init__(self, iterable=None, desc=None, total=None, leave=True,
file=None, 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,
postfix=None, unit_divisor=1000):
postfix=None, unit_divisor=1000, write_bytes=False,
lock_args=None, nrows=None, colour=None, delay=0):
Parameters
~~~~~~~~~~

View File

@ -949,7 +949,7 @@ class tqdm(Comparable):
elif _Rolling_and_Expanding is not None:
_Rolling_and_Expanding.progress_apply = inner_generator()
@envwrap("TQDM_", is_method=True)
@envwrap("TQDM_", is_method=True) # override defaults via env vars
def __init__(self, iterable=None, desc=None, total=None, leave=True, file=None,
ncols=None, mininterval=0.1, maxinterval=10.0, miniters=None,
ascii=None, disable=False, unit='it', unit_scale=False,