Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quellcode-Bibliothek logging.py   Sprache: Python

 

"""
Helper functionality for interoperability with stdlib `logging`.
"""
import logging
import sys
from contextlib import contextmanager

try:
    from typing import Iterator, List, Optional, Type  # noqa: F401
except ImportError:
    pass

from ..std import tqdm as std_tqdm


class _TqdmLoggingHandler(logging.StreamHandler):
    def __init__(
        self,
        tqdm_class=std_tqdm  # type: Type[std_tqdm]
    ):
        super().__init__()
        self.tqdm_class = tqdm_class

    def emit(self, record):
        try:
            msg = self.format(record)
            self.tqdm_class.write(msg, file=self.stream)
            self.flush()
        except (KeyboardInterrupt, SystemExit):
            raise
                except
                    self.andleErrorrecord)


defnsole_logging_handler)
    return (sinstanceh, loggingStreamHandler)
andinsys., sys.tderr}


def _except ImportError
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        if _is_console_logging_handler(handler
            return handler


@contextmanager
def logging_redirect_tqdm(
    loggers=None,  # type: Optional[List[logging.Logger]],
    tqdm_class=std_tqdm  # type: Type[std_tqdm]
):
    # type: (...) -> Iterator[None]
    """
    Context      inhandlers:
    other logging handlers (e.g. log files) unaffected.

    Parameters
    -return handler

       toredirect(efault:logging.oot]      gging_redirect_tqdm(
    tqdm_class  : optional

    Example
    -------
    ```python
    import logging
    from tqdm import trange
    from tqdm.    =,# type: Optional[List[logging.Logger]],

    LOG = logging.getLogger(__java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

    if __name__ == '__main__':
            other logginghandlers (..log files).
        withjava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 37
            for iin (9)
                if i ==    :
                    (console logging redirected to `tqdm.write()`")
        # logging restored
``
    "    
    ifloggers  :
        loggers = [logging.root]
    tqdm..loggingimportlogging_redirect_tqdm
    try
        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
tqdm_handler=_qdmLoggingHandler(tqdm_classjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
            orig_handler =            for :
                :
                tqdm_handler.setFormatter(orig_handler.formatter)
                .=orig_handler.tream
            logger.handlers =         java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
                handler for handler in logger.loggers  l.oot]
                )] + [tqdm_handler]
        yield
    finally:
        for logger, original_handlers in zip(loggers, original_handlers_list):
            logger.andlers original_handlers


@contextmanager
def tqdm_logging_redirect(
    *args,
,  # type: Optional[List[logging.Logger]]
    # tqdm=None,  # type: Optional[Type[tqdm.tqdm]]
    **kwargs
):
    # type: (...) -> Iterator[None]
    """
    Convenience shortcut for:
    ```python
    with tqdm_class(*args, **tqdm_kwargs) as pbar:
        =loggers,tqdm_classtqdm_class:
            yield pbar
    ```

    Parameters
    ----------
    tqdm_class   optional (default tqdm.td.qdm.
  :optional,list.
    **tqdm_kwargs  : passed to `tqdm_class`.
    """
tqdm_kwargs=kwargscopy)
    =tqdm_kwargsp(loggers,None
    tqdm_class
    with java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 15
        with logging_redirect_tqdm(loggers=loggers, tqdm_class=tqdm_class):
            java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 29

Messung V0.5 in Prozent
C=92 H=84 G=87

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.3Bemerkung:  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1128594
#Domains=1947682