/usr/local/lib/python3.6/site-packages/tqdm/contrib/__pycache__
NameSizeModeActions
bells.cpython-36.pyc9800644editdlrm
concurrent.cpython-36.pyc41870644editdlrm
discord.cpython-36.pyc43700644editdlrm
itertools.cpython-36.pyc9430644editdlrm
logging.cpython-36.pyc37700644editdlrm
slack.cpython-36.pyc44060644editdlrm
telegram.cpython-36.pyc53270644editdlrm
utils_worker.cpython-36.pyc14780644editdlrm
__init__.cpython-36.pyc30420644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/tqdm/contrib/__pycache__/logging.cpython-36.pyc (3770B)
3 Eg @sdZddlmZddlZddlZddlmZyddlmZm Z m Z m Z Wne k r\YnXddl mZGdd d ejZd d Zd d ZedefddZeddZdS)zB Helper functionality for interoperability with stdlib `logging`. )absolute_importN)contextmanager)IteratorListOptionalType)tqdmcs(eZdZeffdd ZddZZS)_TqdmLoggingHandlercstt|j||_dS)N)superr __init__ tqdm_class)selfr ) __class__>/usr/local/lib/python3.6/site-packages/tqdm/contrib/logging.pyr sz_TqdmLoggingHandler.__init__c Cs\y(|j|}|jj||jd|jWn.ttfk rBYn|j|YnXdS)N)file)formatr writestreamflushKeyboardInterrupt SystemExit handleError)rrecordmsgrrremits  z_TqdmLoggingHandler.emit)__name__ __module__ __qualname__std_tqdmr r __classcell__rr)rrr sr cCst|tjo|jtjtjhkS)N) isinstancelogging StreamHandlerrsysstdoutstderr)handlerrrr_is_console_logging_handler%s r)cCsx|D]}t|r|SqWdS)N)r))handlersr(rrr(_get_first_found_console_logging_handler*s r+c cs|dkrtjg}dd|D}z^xR|D]J}t|}t|j}|dk rX|j|j|j|_dd|jD|g|_q&WdVWdxt||D]\}}||_qWXdS)a Context manager redirecting console logging to `tqdm.write()`, leaving other logging handlers (e.g. log files) unaffected. Parameters ---------- loggers : list, optional Which handlers to redirect (default: [logging.root]). tqdm_class : optional Example ------- ```python import logging from tqdm import trange from tqdm.contrib.logging import logging_redirect_tqdm LOG = logging.getLogger(__name__) if __name__ == '__main__': logging.basicConfig(level=logging.INFO) with logging_redirect_tqdm(): for i in trange(9): if i == 4: LOG.info("console logging redirected to `tqdm.write()`") # logging restored ``` NcSsg|] }|jqSr)r*).0loggerrrr Tsz)logging_redirect_tqdm..cSsg|]}t|s|qSr)r))r,r(rrrr.]s) r#rootr r+r* setFormatter formatterrzip)loggersr Zoriginal_handlers_listr-Z tqdm_handlerZ orig_handlerZoriginal_handlersrrrlogging_redirect_tqdm0s"    r4cosX|j}|jdd}|jdt}|||$}t||d |VWdQRXWdQRXdS)ap Convenience shortcut for: ```python with tqdm_class(*args, **tqdm_kwargs) as pbar: with logging_redirect_tqdm(loggers=loggers, tqdm_class=tqdm_class): yield pbar ``` Parameters ---------- tqdm_class : optional, (default: tqdm.std.tqdm). loggers : optional, list. **tqdm_kwargs : passed to `tqdm_class`. r3Nr )r3r )copypopr r4)argskwargsZ tqdm_kwargsr3r Zpbarrrrtqdm_logging_redirectes    r9)__doc__ __future__rr#r% contextlibrtypingrrrr ImportErrorZstdr r r$r r)r+r4r9rrrrs    2