Hacked By AnonymousFox

Current Path : /opt/alt/python310/lib64/python3.10/logging/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/logging/__pycache__/config.cpython-310.opt-1.pyc

o

6��f���@sNdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZdZ
ejZdad+dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Ze�dej�Zdd�ZGdd�de�ZGdd�dee�Z Gdd�de!e�Z"Gdd �d e#e�Z$Gd!d"�d"e�Z%Gd#d$�d$e%�Z&e&Z'd%d&�Z(e
dfd'd(�Z)d)d*�Z*dS),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-2019 Vinay Sajip. All Rights Reserved.

To use, simply 'import logging' and log away!
�N)�ThreadingTCPServer�StreamRequestHandleriF#TcCs�ddl}t||j�r
|}n|�|�}t|d�r|�|�nt�|�}|j||d�t	|�}t
��zt�t
||�}t|||�Wt
��dSt
��w)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).
    rN�readline)�encoding)�configparser�
isinstanceZRawConfigParserZConfigParser�hasattrZ	read_file�io�
text_encoding�read�_create_formatters�logging�_acquireLock�_clearExistingHandlers�_install_handlers�_install_loggers�_releaseLock)Zfname�defaults�disable_existing_loggersrr�cp�
formatters�handlers�r�5/opt/alt/python310/lib64/python3.10/logging/config.py�
fileConfig3s	



rc	Csh|�d�}|�d�}t|�}|D]!}|d|}zt||�}Wqty1t|�t||�}Yqw|S)z)Resolve a dotted name to a global object.�.r)�split�pop�
__import__�getattr�AttributeError)�name�used�found�nrrr�_resolveVs

�r%cCsttj|�S�N)�map�str�strip)Zalistrrr�
_strip_spacesdsr*cCs�|dd}t|�siS|�d�}t|�}i}|D];}d|}|j|dddd�}|j|d	ddd�}|j|d
ddd�}tj}||�d�}	|	rJt|	�}||||�}
|
||<q|S)
zCreate and return formattersr�keys�,zformatter_%s�formatTN)�raw�fallback�datefmt�style�%�class)�lenrr*�getr
�	Formatterr%)rZflistrZformZsectnameZfsZdfsZstl�c�
class_name�frrrrgs$

rc
Cs^|dd}t|�siS|�d�}t|�}i}g}|D]�}|d|}|d}|�dd�}z	t|tt��}WnttfyEt	|�}Ynw|�dd	�}	t|	tt��}	|�d
d�}
t|
tt��}
||	i|
��}||_
d|vrw|d}|�|�t|�r�|�||�t
|tjj�r�|�d
d�}
t|
�r�|�||
f�|||<q|D]\}}|�||�q�|S)zInstall and return handlersrr+r,z
handler_%sr3�	formatter��args�()�kwargsz{}�level�target)r4rr*r5�eval�varsr
r �	NameErrorr%r!�setLevel�setFormatter�
issubclassr�
MemoryHandler�appendZ	setTarget)rr�hlistrZfixups�hand�section�klass�fmtr<r>�hr?r@�trrrr}sF
�

rcCsTtj}|D]"}|jj|}||vr$t|tj�s#|�tj�g|_d|_	q||_
qdS)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�
loggerDictrZPlaceHolderrDZNOTSETr�	propagate�disabled)�existing�
child_loggers�disable_existingrP�log�loggerrrr�_handle_existing_loggers�s��rZcCs|dd}|�d�}tt|��}|�d�|d}tj}|}d|vr,|d}|�|�|jdd�D]}|�|�q3|d}	t	|	�rX|	�d�}	t|	�}	|	D]	}
|�
||
�qNt|jj�
��}|��g}|D]�}|d	|}|d
}
|jddd
�}t�|
�}|
|vr�|�|
�d}|
d}t	|�}t	|�}||kr�||d|�|kr�|�||�|d7}||ks�|�|
�d|vr�|d}|�|�|jdd�D]}|�|�q�||_d|_|d}	t	|	�r�|	�d�}	t|	�}	|	D]	}
|�
||
�q�qht|||�dS)zCreate and install loggers�loggersr+r,rPZlogger_rootr?Nrz	logger_%s�qualnamerS�)r/rr)r�listr*�remover
rPrDr�
removeHandlerr4�
addHandlerrQrRr+�sortZgetint�	getLogger�indexrHrSrTrZ)rrrWZllistrKrPrXr?rNrIrJrUrVZqnrSrY�i�prefixed�pflen�num_existingrrrr�sh




�


�rcCs.tj��t�tjdd��tjdd�=dS)z!Clear and close existing handlersN)r
�	_handlers�clearZshutdownZ_handlerListrrrrrs
rz^[a-z_][a-z0-9_]*$cCst�|�}|s
td|��dS)Nz!Not a valid Python identifier: %rT)�
IDENTIFIER�match�
ValueError)�s�mrrr�valid_idents
rpc@s"eZdZdZddd�Zdd�ZdS)	�ConvertingMixinz?For ConvertingXXX's, this mixin class provides common functionsTcCsB|j�|�}||ur|r|||<t|�tttfvr||_||_|Sr&)�configurator�convert�type�ConvertingDict�ConvertingList�ConvertingTuple�parent�key)�selfry�value�replace�resultrrr�convert_with_key$s
�z ConvertingMixin.convert_with_keycCs0|j�|�}||urt|�tttfvr||_|Sr&)rrrsrtrurvrwrx)rzr{r}rrrrs0s
�zConvertingMixin.convertN)T)�__name__�
__module__�__qualname__�__doc__r~rsrrrrrq!s
rqc@s,eZdZdZdd�Zd	dd�Zd	dd�ZdS)
ruz A converting dictionary wrapper.cC�t�||�}|�||�Sr&)�dict�__getitem__r~�rzryr{rrrr�E�zConvertingDict.__getitem__NcCst�|||�}|�||�Sr&)r�r5r~�rzry�defaultr{rrrr5IszConvertingDict.getcCst�|||�}|j||dd�S�NF)r|)r�rr~r�rrrrMszConvertingDict.popr&)rr�r�r�r�r5rrrrrruBs

ruc@s"eZdZdZdd�Zddd�ZdS)	rvzA converting list wrapper.cCr�r&)r^r�r~r�rrrr�Sr�zConvertingList.__getitem__���cCst�||�}|�|�Sr&)r^rrs)rz�idxr{rrrrWs
zConvertingList.popN)r�)rr�r�r�r�rrrrrrvQsrvc@�eZdZdZdd�ZdS)rwzA converting tuple wrapper.cCst�||�}|j||dd�Sr�)�tupler�r~r�rrrr�]szConvertingTuple.__getitem__N)rr�r�r�r�rrrrrw[srwc@s�eZdZdZe�d�Ze�d�Ze�d�Ze�d�Z	e�d�Z
ddd	�Zee
�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS)�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)ZextZcfgcCst|�|_||j_dSr&)ru�configrr)rzr�rrr�__init__vs
zBaseConfigurator.__init__c		Cs�|�d�}|�d�}z-|�|�}|D]"}|d|7}zt||�}Wqty4|�|�t||�}Yqw|WStyYt��dd�\}}td||f�}|||_	|_
|�w)z`
        Resolve strings to objects using standard import and attribute
        syntax.
        rrr]NzCannot resolve %r: %s)rr�importerrr �ImportError�sys�exc_inform�	__cause__�
__traceback__)	rzrnr!r"r#Zfrag�e�tb�vrrr�resolvezs&



��zBaseConfigurator.resolvecCs
|�|�S)z*Default converter for the ext:// protocol.)r��rzr{rrrr��s
zBaseConfigurator.ext_convertcCs�|}|j�|�}|durtd|��||��d�}|j|��d}|r||j�|�}|r6||��d}n1|j�|�}|rg|��d}|j�|�sO||}nz
t	|�}||}Wn
t
yf||}Ynw|rr||��d�}ntd||f��|s%|S)z*Default converter for the cfg:// protocol.NzUnable to convert %rrzUnable to convert %r at %r)�WORD_PATTERNrlrm�endr��groups�DOT_PATTERN�
INDEX_PATTERN�
DIGIT_PATTERN�int�	TypeError)rzr{�restro�dr�r$rrrr��s8
���zBaseConfigurator.cfg_convertcCs�t|t�st|t�rt|�}||_|St|t�s&t|t�r&t|�}||_|St|t�s>t|t�r>t|d�s>t|�}||_|St|t	�ri|j
�|�}|ri|��}|d}|j
�|d�}|ri|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)rrur�rrrvr^rwr�rr(�CONVERT_PATTERNrl�	groupdict�value_convertersr5r)rzr{ror�r�Z	converterr�rrrrs�s6�
���
�
zBaseConfigurator.convertcsn��d�}t|�s|�|�}��dd�}�fdd��D�}|di|��}|r5|��D]
\}}t|||�q*|S)z1Configure an object with a user-supplied factory.r=rNc�i|]}t|�r|�|�qSr�rp��.0�k�r�rr�
<dictcomp>��z5BaseConfigurator.configure_custom.<locals>.<dictcomp>r)r�callabler��items�setattr)rzr�r7�propsr>r}r!r{rr�r�configure_custom�s

z!BaseConfigurator.configure_customcCst|t�r	t|�}|S)z0Utility function which converts lists to tuples.)rr^r�r�rrr�as_tuple�s
zBaseConfigurator.as_tupleN)rr�r�r��re�compiler�r�r�r�r�r��staticmethodrr�r�r�r�r�rsr�r�rrrrr�bs$




�"r�c@s^eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	ddd�Z
ddd�Zddd�ZdS)�DictConfiguratorz]
    Configure logging using a dictionary-like object to describe the
    configuration.
    cCs�|j}d|vrtd��|ddkrtd|d��|�dd�}i}t���z |r�|�d|�}|D];}|tjvr>td|��ztj|}||}|�d	d
�}|rX|�t�|��Wq1t	yl}	ztd|�|	�d
}	~	ww|�d|�}
|
D] }z|�
||
|d
�Wqut	y�}	ztd|�|	�d
}	~	ww|�dd
�}|r�z	|�|d
�W�n�t	y�}	ztd�|	�d
}	~	ww�np|�dd
�}t�|�d|�}
|
D] }z|�
|
|�|
|<Wq�t	y�}	ztd|�|	�d
}	~	ww|�d|�}|D]!}z|�||�||<Wq�t	�y}	ztd|�|	�d
}	~	ww|�d|�}g}t|�D]<}z|�||�}||_|||<W�q#t	�y_}	zdt|	j�v�rM|�|�ntd|�|	�WYd
}	~	�q#d
}	~	ww|D]'}z|�||�}||_|||<W�qbt	�y�}	ztd|�|	�d
}	~	wwtj}t|jj���}|��g}|�d|�}
|
D]^}||v�r�|�|�d}|d}t|�}t|�}||k�r�||d
|�|k�r�|�||�|d7}||k�s�|�|�z|�
||
|�W�q�t	�y}	ztd|�|	�d
}	~	wwt|||�|�dd
�}|�r9z|�|�Wn't	�y*}	ztd�|	�d
}	~	wwWt��d
SWt��d
SWt��d
SWt��d
St��w)zDo the configuration.�versionz$dictionary doesn't specify a versionr]zUnsupported version: %s�incrementalFrzNo handler found with name %rr?NzUnable to configure handler %rr[TzUnable to configure logger %rrPzUnable to configure root loggerrrz Unable to configure formatter %r�filterszUnable to configure filter %r�target not configured yetr) r�rmrr
rr5rirD�_checkLevel�	Exception�configure_logger�configure_rootr�configure_formatter�configure_filter�sorted�configure_handlerr!r(r�rHrPr^rQrRr+rbrdr4r_rZr)rzr�r�Z
EMPTY_DICTrr!�handlerZhandler_configr?r�r[rPrWrr�ZdeferredrUrVrerfrgrhrrr�	configure�sB
�
�������������������������������


�
���������x�v��zDictConfigurator.configurec

Cs�d|vr;|d}z|�|�}W|Sty:}zdt|�vr�|�d�|d<||d<|�|�}WYd}~|Sd}~ww|�dd�}|�dd�}|�dd�}|�d	d�}|sYtj}	nt|�}	d
|vrl|	||||d
�}|S|	|||�}|S)z(Configure a formatter from a dictionary.r=z'format'r-rMNr0r1r2r3Zvalidate)r�r�r(rr5r
r6r%)
rzr��factoryr}�terMZdfmtr1�cnamer7rrrr��s4����z$DictConfigurator.configure_formattercCs0d|vr|�|�}|S|�dd�}t�|�}|S)z%Configure a filter from a dictionary.r=r!r;)r�r5r
ZFilter)rzr�r}r!rrrr��s
�
z!DictConfigurator.configure_filtercC�L|D]!}z|�|jd|�Wqty#}ztd|�|�d}~wwdS)z/Add filters to a filterer from a list of names.r�zUnable to add filter %rN)Z	addFilterr�r�rm)rzZfiltererr�r9r�rrr�add_filters�����zDictConfigurator.add_filtersc
sbt��}��dd�}|r)z	|jd|}Wnty(}ztd|�|�d}~ww��dd�}��dd�}d�vrJ��d�}t|�sG|�|�}|}nt��d�}	|�|	�}
t|
tj	j
�r�d	�vr�z|jd
�d	}t|tj�sx��
|�td��|�d	<Wn>ty�}z	td�d	�|�d}~wwt|
tj	j�r�d
�vr�|��d
��d
<nt|
tj	j�r�d�vr�|��d��d<|
}��dd�}�fdd��D�}
z	|di|
��}Wn'ty�}zdt|�vr�|
�d�|
d<|di|
��}WYd}~nd}~ww|�r|�|�|du�r|�t�|��|�r|�||�|�r/|��D]\}}t|||��q#|S)z&Configure a handler from a dictionary.r:NrzUnable to set formatter %rr?r�r=r3r@rr�zUnable to set target handler %rZmailhostZaddressrcr�rr�r�r�rrr��r�z6DictConfigurator.configure_handler.<locals>.<dictcomp>z'stream'�streamZstrmr)r�rr�r�rmr�r�rFr
rrGrZHandler�updater�ZSMTPHandlerr�Z
SysLogHandlerr(rErDr�r�r�r�)rzr�Zconfig_copyr:r�r?r�r7r�r�rLZthr�r>r}r�r!r{rr�rr��s�����




������	

z"DictConfigurator.configure_handlercCr�)z.Add handlers to a logger from a list of names.rzUnable to add handler %rN)rar�r�rm)rzrYrrNr�rrr�add_handlers�r�zDictConfigurator.add_handlersFcCs�|�dd�}|dur|�t�|��|sA|jdd�D]}|�|�q|�dd�}|r1|�||�|�dd�}|rC|�||�dSdSdS)zU
        Perform configuration which is common to root and non-root loggers.
        r?Nrr�)r5rDr
r�rr`r�r�)rzrYr�r�r?rNrr�rrr�common_logger_configs�z%DictConfigurator.common_logger_configcCs@t�|�}|�|||�d|_|�dd�}|dur||_dSdS)z.Configure a non-root logger from a dictionary.FrSN)r
rcr�rTr5rS)rzr!r�r�rYrSrrrr�s

�z!DictConfigurator.configure_loggercCst��}|�|||�dS)z*Configure a root logger from a dictionary.N)r
rcr�)rzr�r�rPrrrr�"szDictConfigurator.configure_rootN)F)
rr�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s$	?

	r�cCst|���dS)z%Configure logging using a dictionary.N)�dictConfigClassr�r�rrr�
dictConfig)sr�csDGdd�dt�}Gdd�dt�}G�fdd�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@r�)z#listen.<locals>.ConfigStreamHandlerz�
        Handler for a logging configuration request.

        It expects a completely new logging configuration and uses fileConfig
        to install it.
        cSsNz�|j}|�d�}t|�dkr�t�d|�d}|j�|�}t|�|kr4||�|t|��}t|�|ks#|jjdur@|j�|�}|dur{|�d�}zddl}|�	|�}t
|�Wn"tyzt�
|�}zt|�Wn
tywt��YnwYnw|jjr�|jj��WdSWdSWdSty�}z
|jtkr��WYd}~dSd}~ww)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)Z
connectionZrecvr4�structZunpack�server�verify�decode�json�loadsr�r�r	�StringIOr�	traceback�	print_exc�ready�set�OSError�errno�RESET_ERROR)rzZconn�chunkZslenr�r��filer�rrr�handleIsH
�


����
���z*listen.<locals>.ConfigStreamHandler.handleN)rr�r�r�r�rrrr�ConfigStreamHandlerBsr�c@s0eZdZdZdZdedddfdd�Zdd�ZdS)	z$listen.<locals>.ConfigSocketReceiverzD
        A simple TCP socket-based logging config receiver.
        r]Z	localhostNcSs>t�|||f|�t��d|_t��d|_||_||_dS)Nrr])	rr�r
r�abortr�timeoutr�r�)rzZhost�portr�r�r�rrrr�ws
z-listen.<locals>.ConfigSocketReceiver.__init__cSsbddl}d}|s+|�|j��ggg|j�\}}}|r|��t��|j}t��|r|�	�dS)Nr)
�selectZsocket�filenor�Zhandle_requestr
rr�rZserver_close)rzr�r�ZrdZwrZexrrr�serve_until_stopped�s
��	z8listen.<locals>.ConfigSocketReceiver.serve_until_stopped)rr�r�r�Zallow_reuse_address�DEFAULT_LOGGING_CONFIG_PORTr�r�rrrr�ConfigSocketReceiverps
�
r�cs&eZdZ��fdd�Zdd�Z�ZS)zlisten.<locals>.Servercs4t�|���||_||_||_||_t��|_dSr&)	�superr��rcvr�hdlrr�r��	threadingZEventr�)rzr�r�r�r�)�Server�	__class__rrr��szlisten.<locals>.Server.__init__cSsZ|j|j|j|j|jd�}|jdkr|jd|_|j��t��|a	t�
�|��dS)N)r�r�r�r�rr])r�r�r�r�r�Zserver_addressr�r
r�	_listenerrr�)rzr�rrr�run�s�

zlisten.<locals>.Server.run)rr�r�r�r��
__classcell__r�r�)r�rr��sr�)rrr�ZThread)r�r�r�r�rr�r�listen.s.rcCs>t��ztrdt_daWt��dSWt��dSt��w)zN
    Stop the listening server which was created with a call to listen().
    r]N)r
rr�r�rrrrr�
stopListening�s�r)NTN)+r�r�r	r
Zlogging.handlersr�r�r�r�r�Zsocketserverrrr�Z
ECONNRESETr�r�rr%r*rrrZrrr��Irkrp�objectrqr�rur^rvr�rwr�r�r�r�rrrrrr�<module>sJ

#&W!
Bz

Hacked By AnonymousFox1.0, Coded By AnonymousFox