Your IP : 3.145.64.210


Current Path : /opt/alt/python312/lib64/python3.12/logging/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/logging/__pycache__/config.cpython-312.opt-1.pyc

�

�Q�f�����dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZdZej Zdadd�Zd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zej6d
ej8�Zd�ZGd�de�Z Gd�de!e �Z"Gd�de#e �Z$Gd�de%e �Z&Gd�de�Z'd�Z(Gd�de'�Z)e)Z*d�Z+edfd�Z,d�Z-y) a
Configuration functions for the logging package for Python. The core package
is based on PEP 282 and comments thereto in comp.lang.python, and influenced
by Apache's log4j system.

Copyright (C) 2001-2022 Vinay Sajip. All Rights Reserved.

To use, simply 'import logging' and log away!
�N)�ThreadingTCPServer�StreamRequestHandleriF#c���ddl}t|t�rZtjj|�st
|�d���tjj|�st|�d���t||j�r|}nX	|j|�}t|d�r|j|�n(tj|�}|j||��t#|�}t%j&�	t)�t+||�}t-|||�t%j.�y#|j $r}t|�d|����d}~wwxYw#t%j.�wxYw)aD
    Read the logging configuration from a ConfigParser-format file.

    This can be called several times from an application, allowing an end user
    the ability to select from various pre-canned configurations (if the
    developer provides a mechanism to present the choices and load the chosen
    configuration).
    rNz doesn't existz is an empty file�readline)�encodingz
 is invalid: )�configparser�
isinstance�str�os�path�exists�FileNotFoundError�getsize�RuntimeError�RawConfigParser�ConfigParser�hasattr�	read_file�io�
text_encoding�read�ParsingError�_create_formatters�logging�_acquireLock�_clearExistingHandlers�_install_handlers�_install_loggers�_releaseLock)	�fname�defaults�disable_existing_loggersrr�cp�e�
formatters�handlerss	         �5/opt/alt/python312/lib64/python3.12/logging/config.py�
fileConfigr(5s?����%����w�w�~�~�e�$�#�u�g�^�$<�=�=�������'��%��(9�:�;�;��%��5�5�6�
��	;��*�*�8�4�B��u�j�)����U�#��+�+�H�5��������1�$�B�'�J������� �%�R��4����X�'?�@�������(�(�	;��%��
�a�S�9�:�:��	;��	����s%�	AD8�#E�8E�E�E�E5c���|jd�}|jd�}t|�}|D]}|dz|z}	t||�}�|S#t$rt|�t||�}Y�>wxYw)z)Resolve a dotted name to a global object.�.r)�split�pop�
__import__�getattr�AttributeError)�name�used�found�ns    r'�_resolver4asz���:�:�c�?�D��8�8�A�;�D��t��E�
���c�z�A�~��	&��E�1�%�E���L���	&��t���E�1�%�E�	&�s�A� A/�.A/c�6�ttj|�S�N)�mapr
�strip)�alists r'�
_strip_spacesr:os���s�y�y�%� � �c��|dd}t|�siS|jd�}t|�}i}|D]�}d|z}|j|ddd��}|j|d	dd��}|j|d
dd��}|j|ddd��}tj
}	||jd
�}
|
rt
|
�}	|�&t|tt��}|	||||��}n
|	|||�}|||<��|S)zCreate and return formattersr%�keys�,zformatter_%s�formatTN)�raw�fallback�datefmt�style�%r!�class)r!)	�lenr+r:�getr�	Formatterr4�eval�vars)r#�flistr%�form�sectname�fs�dfs�stlr!�c�
class_name�fs            r'rrrs���|��V�$�E��u�:��	��K�K���E��%� �E��J���!�D�(��
�V�V�H�h�D�4�V�
@���f�f�X�y�d�T�f�B���f�f�X�w�D�3�f�?���6�6�(�J�D�4�6�H��������\�%�%�g�.�
����$�A����H�d�7�m�4�H��"�c�3��2�A��"�c�3��A��
�4��#�$�r;c�`�|dd}t|�siS|jd�}t|�}i}g}|D�]3}|d|z}|d}|jdd�}	t	|tt��}|jdd	�}	t	|	tt��}	|jd
d�}
t	|
tt��}
||	i|
��}||_
d|vr|d}|j|�t|�r|j||�t|tjj�r0|jd
d�}
t|
�r|j!||
f�|||<��6|D]\}}|j#||��|S#ttf$rt|�}Y��7wxYw)zInstall and return handlersr&r=r>z
handler_%srE�	formatter��args�()�kwargsz{}�level�target)rFr+r:rGrIrJrr/�	NameErrorr4r0�setLevel�setFormatter�
issubclassr&�
MemoryHandler�append�	setTarget)r#r%�hlistr&�fixups�hand�section�klass�fmtrWrY�hrZr[�ts               r'rr�s����z�N�6�"�E��u�:��	��K�K���E��%� �E��H�
�F����\�D�(�)���� ���k�k�+�r�*��	$����W�
�.�E��{�{�6�4�(���D�$�w�-�(�����X�t�,���f�d�7�m�,���4�"�6�"������g���G�$�E�
�J�J�u���s�8�
�N�N�:�c�?�+��e�W�-�-�;�;�<��[�[��2�.�F��6�{��
�
�q�&�k�*�����/�2���1�	���H�Q�K� ���O��+�	�*�	$��U�O�E�	$�s�F�F-�,F-c��tj}|D]o}|jj|}||vrIt	|tj
�r�;|j
tj�g|_d|_	�i||_
�qy)a�
    When (re)configuring logging, handle loggers which were in the previous
    configuration but are not in the new configuration. There's no point
    deleting them as other threads may continue to hold references to them;
    and by disabling them, you stop them doing any logging.

    However, don't disable children of named loggers, as that's probably not
    what was intended by the user. Also, allow existing loggers to NOT be
    disabled if disable_existing is false.
    TN)r�root�manager�
loggerDictr	�PlaceHolderr]�NOTSETr&�	propagate�disabled)�existing�
child_loggers�disable_existingrl�log�loggers      r'�_handle_existing_loggersrx�si���<�<�D������(�(��-���-���f�g�&9�&9�:�������/�"$���#'�� �.�F�O�r;c���|dd}|jd�}tt|��}|jd�|d}tj
}|}d|vr|d}|j
|�|jddD]}|j|��|d}	t|	�r7|	jd�}	t|	�}	|	D]}
|j||
��t|jjj��}|j�g}|D�]A}|d	|z}|d
}
|jdd�
�}t	j |
�}|
|vro|j#|
�dz}|
dz}t|�}t|�}||kr*||d||k(r|j%||�|dz
}||kr�*|j|
�d|vr|d}|j
|�|jddD]}|j|��||_d|_|d}	t|	�s��|	jd�}	t|	�}	|	D]}
|j||
����Dt+|||�y)zCreate and install loggers�loggersr=r>rl�logger_rootrZNr&z	logger_%s�qualnamerq�)rAr*r)r+�listr:�removerrlr]r&�
removeHandlerrF�
addHandlerrmrnr=�sort�getint�	getLogger�indexrarqrrrx)r#r&ru�llistrfrlrvrZrircrersrt�qnrqrw�i�prefixed�pflen�num_existings                    r'rr�sq��
�y�M�&�!�E��K�K���E���u�%�&�E�	�L�L������G��<�<�D�
�C��'���� �����U��
�]�]�1�
�����1����J��E�
�5�z����C� ���e�$���D��N�N�8�D�>�*���D�L�L�+�+�0�0�2�3�H�

�M�M�O��M����[�3�&�'��
�Z�
 ���N�N�;��N�;�	��"�"�2�&��
��>����r�"�Q�&�A��C�x�H���M�E��x�=�L��l�"��A�;�v��&�(�2�!�(�(��!��5��Q����l�"�
�O�O�B���g���G�$�E��O�O�E�"�����#�A�� � ��#�$�$�������
�#���u�:��K�K��$�E�!�%�(�E����!�!�(�4�.�1��5�T�X�}�6F�Gr;c��tjj�tjtjdd�tjdd�=y)z!Clear and close existing handlersN)r�	_handlers�clear�shutdown�_handlerList�r;r'rr"s;�����������W�)�)�!�,�-����Q�r;z^[a-z_][a-z0-9_]*$c�N�tj|�}|std|z��y)Nz!Not a valid Python identifier: %rT)�
IDENTIFIER�match�
ValueError)�s�ms  r'�valid_identr�,s)�������A���<�q�@�A�A�r;c��eZdZdZdd�Zd�Zy)�ConvertingMixinz?For ConvertingXXX's, this mixin class provides common functionsc��|jj|�}||ur1|r|||<t|�ttt
fvr||_||_|Sr6)�configurator�convert�type�ConvertingDict�ConvertingList�ConvertingTuple�parent�key)�selfr��value�replace�results     r'�convert_with_keyz ConvertingMixin.convert_with_key6sW���"�"�*�*�5�1������"��S�	��F�|���.� 0�0� $��
� ��
��
r;c��|jj|�}||ur#t|�ttt
fvr||_|Sr6)r�r�r�r�r�r�r�)r�r�r�s   r'r�zConvertingMixin.convertBsD���"�"�*�*�5�1������F�|���.� 0�0� $��
��
r;N)T)�__name__�
__module__�__qualname__�__doc__r�r�r�r;r'r�r�3s��I�
�r;r�c�&�eZdZdZd�Zdd�Zdd�Zy)r�z A converting dictionary wrapper.c�R�tj||�}|j||�Sr6)�dict�__getitem__r��r�r�r�s   r'r�zConvertingDict.__getitem__W�'��� � ��s�+���$�$�S�%�0�0r;Nc�T�tj|||�}|j||�Sr6)r�rGr��r�r��defaultr�s    r'rGzConvertingDict.get[s'������s�G�,���$�$�S�%�0�0r;c�X�tj|||�}|j||d��S�NF)r�)r�r,r�r�s    r'r,zConvertingDict.pop_s,������s�G�,���$�$�S�%��$�?�?r;r6)r�r�r�r�r�rGr,r�r;r'r�r�Ts��*�1�1�@r;r�c��eZdZdZd�Zdd�Zy)r�zA converting list wrapper.c�R�tj||�}|j||�Sr6)r~r�r�r�s   r'r�zConvertingList.__getitem__er�r;c�P�tj||�}|j|�Sr6)r~r,r�)r��idxr�s   r'r,zConvertingList.popis!������s�#���|�|�E�"�"r;N)���)r�r�r�r�r�r,r�r;r'r�r�cs��$�1�#r;r�c��eZdZdZd�Zy)r�zA converting tuple wrapper.c�V�tj||�}|j||d��Sr�)�tupler�r�r�s   r'r�zConvertingTuple.__getitem__os,���!�!�$��,���$�$�S�%��$�?�?r;N)r�r�r�r�r�r�r;r'r�r�ms��%�@r;r�c��eZdZdZej
d�Zej
d�Zej
d�Zej
d�Z	ej
d�Z
ddd	�Zee
�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zy)�BaseConfiguratorzI
    The configurator base class which defines some useful defaults.
    z%^(?P<prefix>[a-z]+)://(?P<suffix>.*)$z^\s*(\w+)\s*z^\.\s*(\w+)\s*z^\[\s*(\w+)\s*\]\s*z^\d+$�ext_convert�cfg_convert)�ext�cfgc�F�t|�|_||j_yr6)r��configr�)r�r�s  r'�__init__zBaseConfigurator.__init__�s��$�V�,���#'���� r;c�H�|jd�}|jd�}	|j|�}|D]}|d|zz
}	t||�}�|S#t$r |j|�t||�}Y�DwxYw#t
$r}t
d|�d|���}||�d}~wwxYw)z`
        Resolve strings to objects using standard import and attribute
        syntax.
        r*rzCannot resolve z: N)r+r,�importerr.r/�ImportErrorr�)r�r�r0r1r2�fragr$�vs        r'�resolvezBaseConfigurator.resolve�s���
�w�w�s�|���x�x��{��	��M�M�$�'�E�����d�
�"��1�#�E�4�0�E���L��&�1��M�M�$�'�#�E�4�0�E�1���	��a��;�<�A���N��	�s;�A?�A�A?�&A<�9A?�;A<�<A?�?	B!�B�B!c�$�|j|�S)z*Default converter for the ext:// protocol.)r��r�r�s  r'r�zBaseConfigurator.ext_convert�s���|�|�E�"�"r;c�r�|}|jj|�}|�td|z��||j�d}|j|j�d}|r�|jj|�}|r||j�d}nb|jj|�}|rE|j�d}|jj|�s||}n	t|�}||}|r||j�d}ntd|�d|����|r��|S#t$r||}Y�<wxYw)z*Default converter for the cfg:// protocol.NzUnable to convert %rrzUnable to convert z at )�WORD_PATTERNr�r��endr��groups�DOT_PATTERN�
INDEX_PATTERN�
DIGIT_PATTERN�int�	TypeError)r�r��restr��dr�r3s       r'r�zBaseConfigurator.cfg_convert�s>�������#�#�D�)���9��3�e�;�<�<�������>�D����A�H�H�J�q�M�*�A���$�$�*�*�4�0����!�(�(�*�Q�-�(�A��*�*�0�0��6�A���h�h�j��m��#�1�1�7�7��<� !�#��A�+�$'��H��$%�a�D���������>�D�$�38�$�&@�A�A�'�,���$-�+�$%�c�F��+�s�)D%�%D6�5D6c�H�t|t�s$t|t�rt|�}||_|St|t�s$t|t
�rt	|�}||_|St|t�s0t|t�r t|d�st
|�}||_|St|t�ri|jj|�}|rL|j�}|d}|jj|d�}|r|d}t||�}||�}|S)z�
        Convert values to an appropriate type. dicts, lists and tuples are
        replaced by their converting alternatives. Strings are checked to
        see if they have a conversion format and are converted if they do.
        �_fields�prefixN�suffix)r	r�r�r�r�r~r�r�rr
�CONVERT_PATTERNr��	groupdict�value_convertersrGr.)r�r�r�r�r��	converterr�s       r'r�zBaseConfigurator.convert�s���%��0�Z��t�5L�"�5�)�E�!%�E��$��#�E�>�2�z�%��7N�"�5�)�E�!%�E�����E�?�3��E�5�)�'�%��2K�#�E�*�E�!%�E������s�
#��$�$�*�*�5�1�A���K�K�M���8��� �1�1�5�5�f�d�C�	���x�[�F� '��i� 8�I�%�f�-�E��r;c�6�|jd�}t|�s|j|�}|D�cic]}|dk7s�	t|�s�|||��}}|di|��}|jdd�}|r%|j	�D]\}}t|||��|Scc}w)z1Configure an object with a user-supplied factory.rXr*Nr�)r,�callabler�r��items�setattr)	r�r�rQ�krYr��propsr0r�s	         r'�configure_customz!BaseConfigurator.configure_custom�s����J�J�t�����{����Q��A�(.�P��1�1��8��A��!�V�A�Y�,���P���V����
�
�3��%���$�{�{�}���e����e�,� -��
��
Qs�
B�B�	Bc�<�t|t�rt|�}|S)z0Utility function which converts lists to tuples.)r	r~r�r�s  r'�as_tuplezBaseConfigurator.as_tuple�s���e�T�"��%�L�E��r;N)r�r�r�r��re�compiler�r�r�r�r�r��staticmethodr-r�r�r�r�r�r�r�r�r�r;r'r�r�ts����!�b�j�j�!I�J�O��2�:�:�o�.�L��"�*�*�.�/�K��B�J�J�5�6�M��B�J�J�x�(�M������J�'�H�(��*#� �D�8�r;r�c���t�tj�ryddlm}t�|�rygd�}t	�fd�|D��S)z*Check that *obj* implements the Queue API.Tr)�Queue)	�empty�fullrG�
get_nowait�put�
put_nowait�join�qsize�	task_donec3�J�K�|]}tt�|d�����y�wr6)r�r.)�.0�method�objs  �r'�	<genexpr>z(_is_queue_like_object.<locals>.<genexpr>s'�����.�,�6����V�T�2�3�,�s� #)r	�queuer��multiprocessing.queues�all)r��MPQueue�queue_interfaces`  r'�_is_queue_like_objectr�sG����#�u�{�{�#��7��#�w����O�
�.�,�.�.�.r;c�R�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d
d	�Zd
d
�Zd
d�Z
y)�DictConfiguratorz]
    Configure logging using a dictionary-like object to describe the
    configuration.
    c�	�|j}d|vrtd��|ddk7rtd|dz��|jdd�}i}tj�	|r�|jd|�}|D]s}|tjvrtd|z��	tj|}||}|jd	d
�}|r$|jtj|���u|jd|�}
|
D]}	|j||
|d
��|jdd
�}|�r$	|j|d
��n|jdd
�}t�|jd|�}
|
D]}	|j|
|�|
|<�|jd|�}|D]}	|j||�||<�|jd|�}g}t|�D]#}	|j!||�}||_|||<�%|D]#}	|j!||�}||_|||<�%tj*}t-|j.j0j3��}|j5�g}|jd|�}
|
D]�}||vro|j7|�dz}|dz}t9|�}t9|�}||kr*||d
||k(r|j)||�|dz
}||kr�*|j;|�	|j||
|���t=|||�|jdd
�}|r	|j|�tj>�y
#t$r}	td|z�|	�d
}	~	wwxYw#t$r}	td|z�|	�d
}	~	wwxYw#t$r}	td�|	�d
}	~	wwxYw#t$r}	td|z�|	�d
}	~	wwxYw#t$r}	td|z�|	�d
}	~	wwxYw#t$rC}	dt%|	j&�vr|j)|�ntd|z�|	�Yd
}	~	��kd
}	~	wwxYw#t$r}	td|z�|	�d
}	~	wwxYw#t$r}	td|z�|	�d
}	~	wwxYw#t$r}	td�|	�d
}	~	wwxYw#tj>�wxYw)zDo the configuration.�versionz$dictionary doesn't specify a versionr}zUnsupported version: %s�incrementalFr&zNo handler found with name %rrZNzUnable to configure handler %rrzTzUnable to configure logger %rrlzUnable to configure root loggerr"r%z Unable to configure formatter %r�filterszUnable to configure filter %rz not configured yetr*) r�r�r,rrrGr�r]�_checkLevel�	Exception�configure_logger�configure_rootr�configure_formatter�configure_filter�sorted�configure_handlerr0r
�	__cause__rarlr~rmrnr=r�r�rFrrxr)r�r�r
�
EMPTY_DICTr&r0�handler�handler_configrZr$rzrlrur%r�deferredrsrtr�r�r�r�s                      r'�	configurezDictConfigurator.configures�������F�"��C�D�D��)���!��6��	�9J�J�K�K��j�j���6���
�����Q	#��!�:�:�j�*�=��$�D��7�#4�#4�4�(�*3�6:�*;�<�<�A�&-�&7�&7��&=�G�-5�d�^�N�$2�$6�$6�w��$E�E�$� '� 0� 0��1D�1D�U�1K� L��%�!�*�*�Y�
�;��#�D�=��-�-�d�G�D�M�4�H�$��z�z�&�$�/���:��+�+�D�$�7�
$*�:�:�.H�$�#O� �&�(�$�Z�Z��j�A�
�&�D�G�+/�+C�+C�<F�t�<L�,N�
�4�(�'�!�*�*�Y�
�;��#�D�D�(,�(=�(=�g�d�m�(L���
�$�"�:�:�j�*�=����"�8�,�D�	A�"&�"8�"8��$��"H��'+���)0����	-�%�D�=�"&�"8�"8��$��"H��'+���)0����	%�&�|�|������ 7� 7� <� <� >�?��
�
�
��!#�
� �*�*�Y�
�;��#�D��x�'�$�N�N�4�0�1�4��#'�#�:�� #�H�
��'*�8�}���,�.�'��{�6�E�2�h�>� -� 4� 4�X�a�[� A���F�A� �,�.�!����-�=��-�-�d�G�D�M�B�$�<)��=�)9�;��z�z�&�$�/���:��+�+�D�1�

� � �"��G )�A�",�.2�48�.9�#:�?@�A��A��%�=�(�*.�04�*5�6�;<�=��=��%�:�(�*2�3�89�:��:��%�G�(�*8�:>�*?�@�EF�G��G��%�D�(�*5�7;�*<�=�BC�D��D��%�A�0�C����4D�D�$�O�O�D�1�",�.2�48�.9�#:�?@�A�2��A��%�=�(�*.�04�*5�6�;<�=��=��N%�=�(�*.�04�*5�6�;<�=��=��2%�:�(�*2�3�89�:��:��
� � �"�sX�9R1�AM(�(R1�N�R1�0N(�5R1�8O�R1�)O%�$R1�% P�R1�
 Q�-C	R1�7R1�	Q4�#R1�R�(	N�1N�N�R1�	N%�N � N%�%R1�(	O�1N=�=O�R1�	O"�O�O"�"R1�%	P�.O=�=P�R1�	Q�8Q�R1�Q�R1�	Q1�Q,�,Q1�1R1�4	R�=R�R�R1�	R.�R)�)R.�.R1�1Sc� �d|vr|d}	|j|�}|S|j	dd�}|j	dd�}|j	dd�}|j	d	d�}|j	d
d�}	|st
j}
nt|�}
i}|	�|	|d
<d|vr|
||||dfi|��}|S|
|||fi|��}|S#t$rC}dt|�vr�|jd�|d<||d<|j|�}Yd}~|Sd}~wwxYw)z(Configure a formatter from a dictionary.rXz'format'r?rhNrBrCrDrEr!�validate)r�r�r
r,rGrrHr4)r�r��factoryr��terh�dfmtrC�cnamer!rQrYs            r'rz$DictConfigurator.configure_formatter�sK���6�>��T�l�G�
7��.�.�v�6��L�
�5�*�*�X�t�,�C��:�:�i��.�D��J�J�w��,�E��J�J�w��-�E��z�z�*�d�3�H���%�%���U�O���F�
�#�%-��z�"��V�#��3��e�V�J�-?�J�6�J���
��3��e�6�v�6���
��K�	
7��S��W�,��
!'�
�
�8� 4��u�
�&��t���.�.�v�6��8�
��K	
7�s�C�	D
�
8D�D
c��d|vr|j|�}|S|jdd�}tj|�}|S)z%Configure a filter from a dictionary.rXr0rV)r�rGr�Filter)r�r�r�r0s    r'rz!DictConfigurator.configure_filter�sE���6�>��*�*�6�2�F��
��:�:�f�b�)�D��^�^�D�)�F��
r;c���|D]J}	t|�stt|dd��r|}n|jd|}|j|��Ly#t$r}td|z�|�d}~wwxYw)z/Add filters to a filterer from a list of names.�filterNrzUnable to add filter %r)r�r.r��	addFilterr
r�)r��filtererrrS�filter_r$s      r'�add_filterszDictConfigurator.add_filters�sv���A�
G��A�;�(�7�1�h��+E�"F��G�"�k�k�)�4�Q�7�G��"�"�7�+�
���
G� �!:�Q�!>�?�Q�F��
G�s�AA�	A.�A)�)A.c�.�d|vr|jd�}ntj�}|jdd�}|jdtjj
�}|jdg�}||g|��d|i�}||fi|��}||_|S)Nr�respect_handler_levelF�listenerr&)r,rr�rr&�
QueueListenerr*)	r�rgrY�q�rhl�lklassr&r*rs	         r'�_configure_queue_handlerz)DictConfigurator._configure_queue_handler�s����f���
�
�7�#�A����
�A��j�j�0�%�8�����J��(8�(8�(F�(F�G���:�:�j�"�-���!�B�h�B�c�B����$�V�$��#����r;c��t|�}|jdd�}|r	|jd|}|jdd�}|jdd�}d|vr1|jd�}t|�s|j
|�}|}�n�|jd�}	t|	�r|	}
n|j
|	�}
t|
tjj�ryd	|vrtj|d	�|d	<d
|v�r,	|d
}|jd|}t|tj�s|j|�td��||d
<�n�t|
tjj ��r3d|vr�|d}
t|
t"�r5|j
|
�}t|�std|
z��|�|d<nYt|
t�r0d|
vrtd|
z��|j%t|
��|d<nt'|
�std|
z��d|v�r|d}t|t(�r2t|tjj*�s�td|z��t|t"�rS|j
|�}t|t(�r}t|tjj*�sYtd|z��t|t�r-d|vrtd|z��|j%t|��}ntd|z��t|�std|z��||d<d|vr�g}	|dD]^}|jd|}t|tj�s|j|�td|z��|j-|��`	||d<nt|
tjj.�rd|vr|j1|d�|d<n?t|
tjj2�rd|vr|j1|d�|d<t|
tjj �r!t5j6|j8|
�}n|
}|D�cic]}|dk7s�	t;|�s�|||��}}	|di|��}|r|j=|�|�$|j?tj|��|r|jA||�|jdd�}|r%|jC�D]\}}tE|||��|S#t$r}t	d|z�|�d}~wwxYw#t$r}t	d
z�|�d}~wwxYw#t$r}t	dz�|�d}~wwxYwcc}w#t$r5}dt#|�vr�|jd�|d<|di|��}Yd}~��&d}~wwxYw)z&Configure a handler from a dictionary.rUNr%zUnable to set formatter %rrZrrXrE�
flushLevelr[r&ztarget not configured yetzUnable to set target handler %rrzInvalid queue specifier %rr*zInvalid listener specifier %rz)Required handler %r is not configured yetz!Unable to set required handler %r�mailhost�addressr*z'stream'�stream�strmr�)#r�r,r�r
r�r�r�r_rr&r`rr	�Handler�updater��QueueHandlerr
r�rr�r+ra�SMTPHandlerr��
SysLogHandler�	functools�partialr/r�r^r]r'r�r�)r�r��config_copyrUr$rZrrQrrrg�tn�th�qspecr,�lspecr*rc�hnrir�rYr�rr�r0r�s                           r'rz"DictConfigurator.configure_handlers����6�l���J�J�{�D�1�	��
:� �K�K��5�i�@�	��
�
�7�D�)���*�*�Y��-���6�>��
�
�4� �A��A�;��L�L��O���G��J�J�w�'�E���������U�+���%��!1�!1�!?�!?�@��6�)�+2�+>�+>�v�l�?S�+T�F�<�(��v�%�X�#�H�-��!�[�[��4�R�8��)�"�g�o�o�>�"�M�M�+�6�"+�,G�"H�H�+-��x�(��E�7�#3�#3�#@�#@�A��f�$�"�7�O�E�!�%��-� �L�L��/��'��{�"+�,H�5�,P�"Q�Q�*+�#��w��#�E�4�0��u�,�"+�,H�5�,P�"Q�Q�*.�*?�*?��U��*L��w��2�5�9�'�(D�u�(L�M�M���'�"�:�.�E�!�%��.�)�%��1A�1A�1O�1O�P�"+�,K�e�,S�"T�T�%�e�S�1�'+�|�|�E�':�H�)�(�D�9�$.�x��9I�9I�9W�9W�$X�&/�0O�RW�0W�&X� X�'��t�4�#�5�0�&/�0O�RW�0W�&X� X�'+�'<�'<�T�%�[�'I�H�"+�,K�e�,S�"T�T�'��1�"+�,K�e�,S�"T�T�-5��z�*���'��E�	Z�"(��"4�B� $���J� 7�� ;�A�#-�a����#A� &�
�
�k� :�&/�1H�JL�1M�'N�!N�!�L�L��O�
#5�*/�F�:�&��E�7�#3�#3�#?�#?�@��f�$�%)�]�]�6�*�3E�%F��z�"��E�7�#3�#3�#A�#A�B��V�#�$(�M�M�&��2C�$D��y�!��%��!1�!1�!>�!>�?�#�+�+�D�,I�,I�5�Q����(.�P��1�1��8��A��!�V�A�Y�,���P�
	'��&�v�&�F�����	�*����O�O�G�/�/��6�7�����V�W�-��
�
�3��%���$�{�{�}���e����e�,� -��
��e�
:� �"&�(1�"2�3�89�:��
:��8%�X�(�)J�R�)O�P�VW�W��X��f%�Z�(�)L�r�)Q�R�XY�Y��Z��Q���	'���R��(��
$�Z�Z��1�F�6�N��&�v�&�F��	'�ss�T-�AU
�A&U-�;
V
�V
�V
�V�-	U
�6U�U
�
	U*�U%�%U*�-	V
�6V�V
�	W�*W�Wc��|D]$}	|j|jd|��&y#t$r}td|z�|�d}~wwxYw)z.Add handlers to a logger from a list of names.r&zUnable to add handler %rN)r�r�r
r�)r�rwr&rir$s     r'�add_handlerszDictConfigurator.add_handlers�sU���A�
H��!�!�$�+�+�j�"9�!�"<�=����
H� �!;�a�!?�@�a�G��
H�s�!+�	A�A�Ac�^�|jdd�}|�$|jtj|��|ss|jddD]}|j|��|jdd�}|r|j
||�|jdd�}|r|j||�yyy)zU
        Perform configuration which is common to root and non-root loggers.
        rZNr&r)rGr]rrr&r�rDr')r�rwr�r
rZrir&rs        r'�common_logger_configz%DictConfigurator.common_logger_config�s����
�
�7�D�)�����O�O�G�/�/��6�7���_�_�Q�'���$�$�Q�'�(��z�z�*�d�3�H���!�!�&�(�3��j�j��D�1�G��� � ���1��r;c��tj|�}|j|||�d|_|j	dd�}|�||_yy)z.Configure a non-root logger from a dictionary.FrqN)rr�rFrrrGrq)r�r0r�r
rwrqs      r'rz!DictConfigurator.configure_logger�sN���"�"�4�(���!�!�&�&�+�>�����J�J�{�D�1�	�� �(�F��!r;c�R�tj�}|j|||�y)z*Configure a root logger from a dictionary.N)rr�rF)r�r�r
rls    r'rzDictConfigurator.configure_root�s"��� � �"���!�!�$���<r;N)F)r�r�r�r�rrrr'r/rrDrFrrr�r;r'rrs@���
\#�|+�Z�
G�
�y�vH�2�$)�=r;rc�6�t|�j�y)z%Configure logging using a dictionary.N)�dictConfigClassr)r�s r'�
dictConfigrK�s���F��%�%�'r;c���Gd�dt�}Gd�dt�}G�fd�dtj���||||�S)au
    Start up a socket server on the specified port, and listen for new
    configurations.

    These will be sent as a file suitable for processing by fileConfig().
    Returns a Thread object on which you can call start() to start the server,
    and which you can join() when appropriate. To stop the server, call
    stopListening().

    Use the ``verify`` argument to verify any bytes received across the wire
    from a client. If specified, it should be a callable which receives a
    single argument - the bytes of configuration data received across the
    network - and it should return either ``None``, to indicate that the
    passed in bytes could not be verified and should be discarded, or a
    byte string which is then passed to the configuration machinery as
    normal. Note that you can return transformed bytes, e.g. by decrypting
    the bytes passed in.
    c��eZdZdZd�Zy)�#listen.<locals>.ConfigStreamHandlerz�
        Handler for a logging configuration request.

        It expects a completely new logging configuration and uses fileConfig
        to install it.
        c�~�	|j}|jd�}t|�dk(�rtjd|�d}|jj|�}t|�|kr/||j|t|�z
�z}t|�|kr�/|j
j�|j
j
|�}|�2|jd�}	ddl}|j|�}t|�|j
j"r%|j
j"j%�yyy#t$rHtj|�}	t|�n##t$rtj �YnwxYwY��wxYw#t&$r}|j(t*k7r�Yd}~yd}~wwxYw)z�
            Handle a request.

            Each request is expected to be a 4-byte length, packed using
            struct.pack(">L", n), followed by the config file.
            Uses fileConfig() to do the grunt work.
            �z>LrNzutf-8)�
connection�recvrF�struct�unpack�server�verify�decode�json�loadsrKr
r�StringIOr(�	traceback�	print_exc�ready�set�OSError�errno�RESET_ERROR)r��conn�chunk�slenrXr��filer$s        r'�handlez*listen.<locals>.ConfigStreamHandler.handle�sy��
������	�	�!����u�:��?�!�=�=��u�5�a�8�D� �O�O�0�0��6�E��e�*�t�+� %��	�	�$��U��2C�(D� D���e�*�t�+��{�{�)�)�5� $��� 2� 2�5� 9���(� %���W� 5��6�'�#�z�z�%�0�A�&�q�M��{�{�(�(����)�)�-�-�/�)�-#�� )�6�$&�;�;�u�#5�D�6� *�4� 0��#,�6� )� 3� 3� 5�6��
6���
��7�7�k�)��*��
�sg�BF�AF�$ E�:F�F� E,�+F�,F�	F�F�F�F�F�F�	F<�F7�7F<N)r�r�r�r�rfr�r;r'�ConfigStreamHandlerrN�s��	�%	r;rgc�,�eZdZdZdZdedddfd�Zd�Zy)�$listen.<locals>.ConfigSocketReceiverzD
        A simple TCP socket-based logging config receiver.
        r}�	localhostNc��tj|||f|�tj�d|_tj
�d|_||_||_y)Nrr})	rr�rr�abortr�timeoutr]rV)r��host�portrr]rVs      r'r�z-listen.<locals>.ConfigSocketReceiver.__init__�sL���'�'��t�T�l�G�D�� � �"��D�J�� � �"��D�L��D�J� �D�Kr;c�<�ddl}d}|s�|j|jj�ggg|j�\}}}|r|j	�tj�|j}tj�|s��|j�y)Nr)
�select�socket�filenorm�handle_requestrrrlr�server_close)r�rqrl�rd�wr�exs      r'�serve_until_stoppedz8listen.<locals>.ConfigSocketReceiver.serve_until_stoppeds�����E��#�]�]�D�K�K�,>�,>�,@�+A�+-�r�+/�<�<�9�
��B����'�'�)��$�$�&��
�
���$�$�&��
���r;)r�r�r�r��allow_reuse_address�DEFAULT_LOGGING_CONFIG_PORTr�ryr�r;r'�ConfigSocketReceiverri�s&��	� �� +�2M�!��d�	!�	 r;r|c�(���eZdZ��fd�Zd�Z�xZS)�listen.<locals>.Serverc���t�|��||_||_||_||_t
j�|_yr6)	�superr��rcvr�hdlrrorV�	threading�Eventr])r�r�r�rorV�Server�	__class__s     ��r'r�zlisten.<locals>.Server.__init__s:����&�$�(�*��D�I��D�I��D�I� �D�K�"���*�D�Jr;c�l�|j|j|j|j|j��}|jdk(r|j
d|_|jj
�tj�|a	tj�|j�y)N)rorr]rVrr})r�ror�r]rV�server_addressr^rr�	_listenerrry)r�rUs  r'�runzlisten.<locals>.Server.runs����Y�Y�D�I�I�t�y�y�%)�Z�Z�&*�k�k��3�F��y�y�A�~�"�1�1�!�4��	��J�J�N�N��� � �"��I�� � �"��&�&�(r;)r�r�r�r�r��
__classcell__)r�r�s@�r'r�r~s
���	+�	)r;r�)rrr��Thread)rorVrgr|r�s    @r'�listenr��sE���(,�2�,�\ �1� �>)��!�!�)�.�&�(;�T�6�J�Jr;c��tj�	tr
dt_datj�y#tj�wxYw)zN
    Stop the listening server which was created with a call to listen().
    r}N)rrr�rlrr�r;r'�
stopListeningr�+s=��
�������I�O��I����������s	�>�A)NTN).r�r`r;rr�logging.handlersrrr�rSr�r[�socketserverrrr{�
ECONNRESETrar�r(r4r:rrrxrrr��Ir�r��objectr�r�r�r~r�r�r�r�rrrJrKr�r�r�r;r'�<module>r�s��"�
��	���	��	�
���A�#������
�	�)�X�!��:$�L/�,TH�n ��R�Z�Z�,�b�d�d�
3�
���f��B
@�T�?�
@�#�T�?�#�@�e�_�@�A�v�A�F.�6V=�'�V=�p#��(�
,�D�xK�tr;

?>