CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
logging.cpython-310.pyc122 linesDownload Raw Back to __pycache__
1o

2��Yi�0�	@s�ddlZddlmZddlmZmZddlmZddlmZddlm	Z	m3Z4mZmZm
Z
mZddlmZdd	lmZdd5lmZmZddlmZmZddlmZmZdd
lmZddlmZGdd�de�Z e!dkr�ddl"m#Z#dZ$ej%de$de ddd�gd�e�&d�Z'e'�(d�e'�(d�e#d�e'�(d�e'�(d�e'�(d�e'�)d�e#d�e'�*d d!d"gd#�d$gd%d&�d!ddd%d'��e'�*d(�e'�+d)�e'�(d*�e'�(d+�e'�)d,�d5d.d/�Z,e,�e#d�e'�-d0�e'�(d1�e'j(d2e.dd3�d4�dSdS)6�N)�datetime)�Handler�	LogRecord)�Path)�6ModuleType)�ClassVar�Iterable�List�Optional�Type�Union)�NullFile�)�get_console)�FormatTimeCallable�	LogRender)�Console�ConsoleRenderable)�Highlighter�ReprHighlighter)�Text)�	Tracebackc0steZdZUdZgd�Zeeeee	d<e7Zeee
e	d<ejdfddddddddddd	dddd8ddd
ddd�deeefdeededededededee
dededeedeededeededed eeeefd!ed"ed#ed$eeefd%eeed&df.�fd'd(�Zd)ed&efd*d+�Zd)ed&dfd,d-�Zd)ed.ed&d/fd0d1�Zd)ed2eed3d/d&d/fd4d5�Z�ZS)6�RichHandlera�A logging handler that renders output with Rich. The time / level / message and file are displayed in columns.9    The level is color coded, and the message is syntax highlighted.10 11    Note:12        Be careful when enabling console markup in log messages if you have configured logging for libraries not13        under your control. If a dependency writes messages containing square brackets, it may not produce the intended output.14 15    Args:16        level (Union[int, str], optional): Log level. Defaults to logging.NOTSET.17        console (:class:`~rich.console.Console`, optional): Optional console instance to write logs.18            Default will use a global console instance writing to stdout.19        show_time (bool, optional): Show a column for the time. Defaults to True.20        omit_repeated_times (bool, optional): Omit repetition of the same time. Defaults to True.21        show_level (bool, optional): Show a column for the level. Defaults to True.22        show_path (bool, optional): Show the path to the original log call. Defaults to True.23        enable_link_path (bool, optional): Enable terminal link of path column to file. Defaults to True.24        highlighter (Highlighter, optional): Highlighter to style log messages, or None to use ReprHighlighter. Defaults to None.25        markup (bool, optional): Enable console markup in log messages. Defaults to False.26        rich_tracebacks (bool, optional): Enable rich tracebacks with syntax highlighting and formatting. Defaults to False.27        tracebacks_width (Optional[int], optional): Number of characters used to render tracebacks, or None for full width. Defaults to None.28        tracebacks_code_width (int, optional): Number of code characters used to render tracebacks, or None for full width. Defaults to 88.29        tracebacks_extra_lines (int, optional): Additional lines of code to render tracebacks, or None for full width. Defaults to None.30        tracebacks_theme (str, optional): Override pygments theme used in traceback.31        tracebacks_word_wrap (bool, optional): Enable word wrapping of long tracebacks lines. Defaults to True.32        tracebacks_show_locals (bool, optional): Enable display of locals in tracebacks. Defaults to False.33        tracebacks_suppress (Sequence[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback.34        tracebacks_max_frames (int, optional): Optional maximum number of frames returned by traceback.35        locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.36            Defaults to 10.37        locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80.38        log_time_format (Union[str, TimeFormatterCallable], optional): If ``log_time`` is enabled, either string for strftime or callable that formats the time. Defaults to "[%x %X] ".39        keywords (List[str], optional): List of words to highlight instead of ``RichHandler.KEYWORDS``.40    )�GET�POST�HEAD�PUT�DELETE�OPTIONS�TRACE�PATCH�KEYWORDS�HIGHLIGHTER_CLASSNTF�X���d�41�Pz[%x %X])�	show_time�omit_repeated_times�42show_level�	show_path�enable_link_path�highlighter�markup�rich_tracebacks�tracebacks_width�tracebacks_code_width�tracebacks_extra_lines�tracebacks_theme�tracebacks_word_wrap�tracebacks_show_locals�tracebacks_suppress�tracebacks_max_frames�locals_max_length�locals_max_string�log_time_format�keywords�level�consoler)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<�returncs�t�j|d�|pt�|_|p|��|_t|||||dd�|_||_|	|_	|43|_44||_|
|_||_
||_||_||_||_||_||_||_||_dS)N)r=)r)r+r,�time_formatr*�level_width)�super�__init__rr>r"r.r�_log_renderr-r/r0r1r3r4r5r6r7r8r2r9r:r<)�selfr=r>r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<��	__class__r%��E:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\pip/_vendor/rich/logging.pyrCAs2�45zRichHandler.__init__�recordcCs&|j}t�|�d�d|�����}|S)z�Get the level name from the record.46 47        Args:48            record (LogRecord): LogRecord instance.49 50        Returns:51            Text: A tuple of the style and level name.52        �zlogging.level.)�	levelnamer�styled�ljust�lower)rErI�53level_name�54level_textr%r%rH�get_level_textus55	�zRichHandler.get_level_textc56Cs4|�|�}d}|jre|jre|jdkre|j\}}}|dusJ�|dus$J�tj||||j|j|j|j|j	|j57|j|j|j
|jd�
}|��}|jre|��|_|j}t|d�r`|��r`|�||j�|_|�|�}|�||�}|j|||d�}	t|jjt�r�|�|�dSz	|j�|	�WdSt y�|�|�YdSw)zInvoked by logging.N)NNN)58�width�59code_width�extra_lines�theme�	word_wrap�show_localsr9r:�suppress�60max_frames�usesTime)rI�	traceback�message_renderable)!�formatr0�exc_infor�from_exceptionr1r2r3r4r5r6r9r:r7r8�61getMessage�	formatter�message�hasattrrZ�62formatTime�datefmt�asctime�
formatMessage�render_message�render�63isinstancer>�filer
�handleError�print�	Exception)64rErIrbr[�exc_type�	exc_value�
exc_tracebackrar\�log_renderabler%r%rH�emit�sV65��66�6768��zRichHandler.emitrbrcCsht|d|j�}|rt�|�nt|�}t|d|j�}|r||�}|jdur(|j|_|jr2|�|jd�|S)z�Render message text in to Text.69 70        Args:71            record (LogRecord): logging Record.72            message (str): String containing log message.73 74        Returns:75            ConsoleRenderable: Renderable to display log message.76        r/r.Nzlogging.keyword)�getattrr/r�from_markupr.r<r!�highlight_words)rErIrb�77use_markup�message_textr.r%r%rHrh�s7879zRichHandler.render_messager[r\c	80Cstt|j�j}|�|�}|jdurdn|jj}t�|j�}|j	|j81|s%|gn||g|||||j|jr4|jndd�}|S)avRender log for display.82 83        Args:84            record (LogRecord): logging Record.85            traceback (Optional[Traceback]): Traceback instance or None for no Traceback.86            message_renderable (ConsoleRenderable): Renderable (typically Text) containing log message contents.87 88        Returns:89            ConsoleRenderable: Renderable to display log.90        N)�log_timer@r=�path�line_no�	link_path)
r�pathname�namerQrarer�
fromtimestamp�createdrDr>�linenor-)	rErIr[r\rzr=r@ryrrr%r%rHri�s91�92zRichHandler.render) �__name__�93__module__�__qualname__�__doc__r!rr94r	�str�__annotations__rr"rr�logging�NOTSETr�intr�boolrrrrCrrrQrsrhrri�
__classcell__r%r%rFrHrs�95"96��97������	�98���
����������99�100��42����r�__main__)�sleepz%(message)sr�z[%X]T)r0r6)r=r]re�handlers�richzServer starting...z"Listening on http://127.0.0.1:8080zGET /index.html 200 1298z)GET /imgs/backgrounds/back1.jpg 200 54386zGET /css/styles.css 200 54386zGET /favicon.ico 404 242zJSONRPC request101--> %r102<-- %rz1.1ZconfirmFruitPurchase)�appleZorangeZmangoesZpomelog+�����?Z	194521489)�version�method�params�id)r��result�errorr�zrLoading configuration file /adasd/asdasd/qeqwe/qwrqwrqwr/sdgsdgsdg/werwerwer/dfgerert/ertertert/ertetert/werwerwerz$Unable to find 'pomelo' in database!zPOST /jsonrpc/ 200 65532zPOST /admin/ 401 42234z%password was rejected for admin site.r?cCsBd}d}dgd}t�d�z||WdSt�d�YdS)NrrZfoor&z	in dividezAn error of some kind occurred!)�log�debug�	exception)�numberZdivisorZfoosr%r%rH�divides103104r�zOut of memory!zServer exited with code=-1z[bold]EXITING...[/bold])r/)�extra)r?N)/r�rrr�pathlibr�typesr�typingrrr	r105rr�pip._vendor.rich._null_filer
�rrDrrr>rrr.rr�textrr[rrr��timer�ZFORMAT�basicConfig�	getLoggerr��info�warningr�r�r��critical�dictr%r%r%rH�<module>sp a�106107108109110111112113��114�115116117118119120121122�