403Webshell
Server IP : 46.101.140.223  /  Your IP : 216.73.217.61
Web Server : nginx/1.22.1
System : Linux debian-s-1vcpu-1gb-fra1-01 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : deploy-others ( 1001)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/_pytest/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/_pytest/__pycache__/capture.cpython-311.pyc
�

��c&����dZddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddl	mZddl	mZddl	m
Z
dd	l	mZdd
l	mZddl	mZddl	mZdd
l	mZddl	mZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl m"Z"ddl m#Z#erddl$m%Z%e%dZ&deddfd�Z'dKd�Z(deddfd �Z)ed!�"��d#efd$���Z*Gd%�d&ej+��Z,Gd'�d(ej+��Z-Gd)�d*e-��Z.Gd+�d,��Z/d-d.d/d0�Z0Gd1�d2��Z1Gd3�d4��Z2Gd5�d6e2��Z3Gd7�d8��Z4Gd9�d:e4��Z5eej6Gd;�d<e
e������Z7Gd=�d>e
e��Z8d?d@de8e9fdA�Z:GdB�dC��Z;GdD�dEe
e��Z<edFedee<e9ddffdG���Z=edFedee<e>ddffdH���Z?edFedee<e9ddffdI���Z@edFedee<e>ddffdJ���ZAdS)Lz+Per-test stdout/stderr capturing mechanism.�N��UnsupportedOperation)�
TemporaryFile)�Any)�AnyStr)�	Generator)�Generic)�Iterator)�Optional)�TextIO)�Tuple)�
TYPE_CHECKING)�Union)�final)�Config)�hookimpl)�Parser)�check_ispytest)�fixture)�
SubRequest)�	Collector)�File)�Item)�Literal��fd�sys�no�tee-sys�parser�returnc��|�d��}|�ddddgd�d���|�d	d
ddd
���dS)N�generalz	--capture�storer�methodrz3Per-test capturing method: one of fd|sys|no|tee-sys)�action�default�metavar�choices�helpz-s�store_constr�capturezShortcut for --capture=no)r&�const�destr*)�getgroup�
_addoption)r �groups  �1/usr/lib/python3/dist-packages/_pytest/capture.py�pytest_addoptionr3%s����O�O�I�&�&�E�	�������.�.�.�
B�
����
������
�
(�������c�t�tj�d��r	ddl}dS#t$rYdSwxYwdS)aEnsure colorama is imported so that it attaches to the correct stdio
    handles on Windows.

    colorama uses the terminal on import time. So if something does the
    first import of colorama while I/O capture is active, colorama will
    fail in various ways.
    �win32rN)r�platform�
startswith�colorama�ImportError)r9s r2�_colorama_workaroundr;8sZ���|���w�'�'��	��O�O�O�O�O���	�	�	��D�D�	�����s�'�
5�5�streamc����tj�d��rttd��rdSt|d��sdSt|jd����r|jjn|j}t
|tj��sdS�fd�}|tj	d��t_	|tj
d��t_
|tjd��t_dS)	a�Workaround for Windows Unicode console handling.

    Python 3.6 implemented Unicode console handling for Windows. This works
    by reading/writing to the raw console handle using
    ``{Read,Write}ConsoleW``.

    The problem is that we are going to ``dup2`` over the stdio file
    descriptors when doing ``FDCapture`` and this will ``CloseHandle`` the
    handles used by Python to write to the console. Though there is still some
    weirdness and the console handle seems to only be closed randomly and not
    on the first call to ``CloseHandle``, or maybe it gets reopened with the
    same handle value when we suspend capturing.

    The workaround in this case will reopen stdio with a different fd which
    also means a different handle by replicating the logic in
    "Py_lifecycle.c:initstdio/create_stdio".

    :param stream:
        In practice ``sys.stdout`` or ``sys.stderr``, but given
        here as parameter for unittesting purposes.

    See https://github.com/pytest-dev/py/issues/103.
    r6�pypy_version_infoN�buffer�rawc�����s|ddkrd}nd}tjttj|�����||��|j|j|j|j	��S)Nr�w���)
�io�
TextIOWrapper�open�os�dup�fileno�encoding�errors�newlines�line_buffering)�f�mode�	buffering�buffereds   �r2�
_reopen_stdioz3_windowsconsoleio_workaround.<locals>._reopen_stdiolsn����	�D��G�s�N�N��I�I��I���������
�
�#�#�T�9�5�5�
�J�
�H�
�J�
��
�
�	
r4�rb�wb)rr7r8�hasattrr?r@�
isinstancerD�_WindowsConsoleIO�stdin�stdout�stderr)r<�
raw_stdoutrRrQs   @r2�_windowsconsoleio_workaroundr\Gs����0�<�"�"�7�+�+��w�s�<O�/P�/P�����6�8�$�$�����v�}�e�,�,�H�&.�A���"�"�F�M�J��j�"�"6�7�7����
�
�
�
�
��
�c�i��.�.�C�I���s�z�4�0�0�C�J���s�z�4�0�0�C�J�J�Jr4T��hookwrapper�early_configc#�&K�|j}|jdkrttj��t��|j}t|j��}|�|d��|�	|j
��|���dV�}|���|j
�W|���\}}tj�|��tj�|��dSdS)Nr�capturemanager)�known_args_namespacer,r\rrYr;�
pluginmanager�CaptureManager�register�add_cleanup�stop_global_capturing�start_global_capturing�suspend_global_capture�excinfo�read_global_capture�writerZ)r_�nsrc�capman�outcome�out�errs       r2�pytest_load_initial_conftestsrrs����	�	*�B�	�z�T���$�S�Z�0�0�0����� �.�M�
�B�J�
'�
'�F����6�#3�4�4�4����V�9�:�:�:��!�!�#�#�#��e�e�G�
�!�!�#�#�#���"��-�-�/�/���S��
��������
���������#�"r4c�J�eZdZdZedefd���Zedefd���ZdS)�EncodedFile�r!c�*�t|j��S�N)�reprr?��selfs r2�namezEncodedFile.name�s���D�K� � � r4c�B�|jj�dd��S)N�b�)r?rO�replacerys r2rOzEncodedFile.mode�s���{��'�'��R�0�0�0r4N)�__name__�
__module__�__qualname__�	__slots__�property�strr{rOrur4r2rtrt�se�������I�
�!�c�!�!�!��X�!�
�1�c�1�1�1��X�1�1�1r4rtc�,��eZdZd�fd�Zdefd�Z�xZS)�	CaptureIOr!Nc�t��t���tj��ddd���dS)N�UTF-8r~T)rJ�newline�
write_through)�super�__init__rD�BytesIO)rz�	__class__s �r2r�zCaptureIO.__init__�s1���
�����������SW��X�X�X�X�Xr4c��t|jtj��sJ�|j����d��S)Nr�)rVr?rDr��getvalue�decoderys r2r�zCaptureIO.getvalue�s>���$�+�r�z�2�2�2�2�2��{�#�#�%�%�,�,�W�5�5�5r4�r!N)r�r�r�r�r�r��
__classcell__�r�s@r2r�r��s^�������Y�Y�Y�Y�Y�Y�6�#�6�6�6�6�6�6�6�6r4r�c�<��eZdZdeddf�fd�Zdedef�fd�Z�xZS)�TeeCaptureIO�otherr!Nc�V��||_t�����dSrw)�_otherr�r�)rzr�r�s  �r2r�zTeeCaptureIO.__init__�s&������
���������r4�sc�z��t���|��|j�|��Srw)r�rlr�)rzr�r�s  �r2rlzTeeCaptureIO.write�s/���
���
�
�a�����{� � ��#�#�#r4)	r�r�r�rr�r��intrlr�r�s@r2r�r��sw��������f���������$�s�$�s�$�$�$�$�$�$�$�$�$�$r4r�c���eZdZdZd�ZeZeZeZd�Zde	fd�Z
dd�Zdefd�Z
dd�Zdefd	�Zd
e	de	fd�Zdefd�Zde	fd
�Zde	ddfd�Zdd�Zdd�Zdefd�Zed���ZdS)�DontReadFromInputNc� �td���)NzJpytest: reading from stdin while output is captured!  Consider using `-s`.)�OSError�rz�argss  r2�readzDontReadFromInput.read�s���X�
�
�	
r4c��|Srwrurys r2�__iter__zDontReadFromInput.__iter__�s���r4r!c� �td���)Nz/redirected stdin is pseudofile, has no fileno()rrys r2rIzDontReadFromInput.fileno�s��"�#T�U�U�Ur4c� �td���)Nz.redirected stdin is pseudofile, has no flush()rrys r2�flushzDontReadFromInput.flush�s��"�#S�T�T�Tr4c��dS�NFrurys r2�isattyzDontReadFromInput.isatty�����ur4c��dSrwrurys r2�closezDontReadFromInput.close�s���r4c��dSr�rurys r2�readablezDontReadFromInput.readable�r�r4�offsetc� �td���)Nz0redirected stdin is pseudofile, has no seek(int)r)rzr�s  r2�seekzDontReadFromInput.seek�s��"�#U�V�V�Vr4c��dSr�rurys r2�seekablezDontReadFromInput.seekable�r�r4c� �td���)Nz-redirected stdin is pseudofile, has no tell()rrys r2�tellzDontReadFromInput.tell�s��"�#R�S�S�Sr4�sizec� �td���)Nzcannont truncate stdinr)rzr�s  r2�truncatezDontReadFromInput.truncate�s��"�#;�<�<�<r4c� �td���)Nzcannot write to stdinrr�s  r2rlzDontReadFromInput.write����"�#:�;�;�;r4c� �td���)NzCannot write to stdinrr�s  r2�
writelineszDontReadFromInput.writelines�r�r4c��dSr�rurys r2�writablezDontReadFromInput.writable�r�r4c��|Srwrurys r2r?zDontReadFromInput.buffer�s���r4r�)r�r�r�rJr��readline�	readlines�__next__r�r�rIr��boolr�r�r�r�r�r�r�rlr�r�r�r?rur4r2r�r��s��������H�
�
�
�
�H��I��H����V��V�V�V�V�U�U�U�U�������
�
�
�
��$�����W�3�W�3�W�W�W�W��$�����T�c�T�T�T�T�=�S�=�T�=�=�=�=�<�<�<�<�<�<�<�<��$���������X���r4r�rXrYrZ)r��c�(�eZdZdZd�xZxZxZxZZdS)�	NoCaptureNc��dSrwru)r�s r2�<lambda>zNoCapture.<lambda>�s��t�r4)	r�r�r��EMPTY_BUFFERr��start�done�suspend�resumerur4r2r�r��s/�������L�1C�1C�C�H�C�u�C�t�C�g���r4r�c��eZdZdZddd�dededdfd�Zd	edefd
�Zdefd�Z	ded
e
edfddfd�Zdd�Zd�Z
dd�Zdd�Zdd�Zdd�ZdS)�SysCaptureBinaryr4NF��teerr�r!c���t|}tt|��|_||_|�9|dkrt��}n$|st
��nt|j��}||_d|_	dS)NrX�initialized)
�patchsysdict�getattrr�_oldr{r�r�r��tmpfile�_state)rzrr�r�r{s     r2r�zSysCaptureBinary.__init__sm���B����C��&�&��	���	��?��w���+�-�-���-0�M�)�+�+�+�l�4�9�6M�6M�����#����r4�
class_namec��d�||jt|d��rt|j��pd|j|j��S�Nz(<{} {} _old={} _state={!r} tmpfile={!r}>r�z<UNSET>)�formatr{rUrxr�r�r�)rzr�s  r2rxzSysCaptureBinary.reprsK��9�@�@���I��D�&�!�!�5�d�4�9�o�o�B���K��L�
�
�	
r4c��d�|jj|jt	|d��rt|j��pd|j|j��Sr�)	r�r�r�r{rUrxr�r�r�rys r2�__repr__zSysCaptureBinary.__repr__sP��9�@�@��N�#��I��D�&�!�!�5�d�4�9�o�o�B���K��L�
�
�	
r4�op�states.c��|j|vs7Jd�||jd�|�������dS�Nz+cannot {} in state {!r}: expected one of {}z, �r�r��join�rzr�r�s   r2�
_assert_statezSysCaptureBinary._assert_state!�K���K�6�!�!�!�8�?�?����T�Y�Y�v�.�.�
�
�
"�!�!�!�!r4c��|�dd��tt|j|j��d|_dS)Nr��r��started)r��setattrrr{r�r�rys r2r�zSysCaptureBinary.start(s:�����7�$4�5�5�5���T�Y���-�-�-�����r4c��|�dd��|j�d��|jj���}|j�d��|j���|S�N�snap�r��	suspendedr�r�r�r�r?r�r��rz�ress  r2r�zSysCaptureBinary.snap-�t�����6�#;�<�<�<�����!�����l�!�&�&�(�(������!������������
r4c���|�dd��|jdkrdStt|j|j��|`|j���d|_dS)Nr��r�r�r�r�)r�r�r�rr{r�r�r�rys r2r�zSysCaptureBinary.done5se�����6�#R�S�S�S��;�&� � ��F���T�Y��	�*�*�*��I������������r4c��|�dd��tt|j|j��d|_dS�Nr�r�r�)r�r�rr{r�r�rys r2r�zSysCaptureBinary.suspend>s:�����9�&>�?�?�?���T�Y��	�*�*�*�!����r4c��|�dd��|jdkrdStt|j|j��d|_dS�Nr�r�r�)r�r�r�rr{r�rys r2r�zSysCaptureBinary.resumeCsL�����8�%=�>�>�>��;�)�#�#��F���T�Y���-�-�-�����r4c���|�dd��|j���|jj�|��|jj���dS�N�writeorgr�)r�r�r�r?rl�rz�datas  r2rzSysCaptureBinary.writeorgJsa�����:�'?�@�@�@��	�������	����t�$�$�$��	���� � � � � r4rwr�)r�r�r�r�r�r�r�r�rxr�r
r�r�r�r�r�r�rrur4r2r�r��s4�������L�
$�U�
$�
$�
$�3�
$�d�
$�t�
$�
$�
$�
$�
�s�
�s�
�
�
�
�
�#�
�
�
�
�
��
�U�3��8�_�
��
�
�
�
� � � � �
�������"�"�"�"�
 � � � �!�!�!�!�!�!r4r�c��eZdZdZd�Zd�ZdS)�
SysCapturer~c��|j���}|j�d��|j���|S)Nr)r�r�r�r�r�s  r2r�zSysCapture.snapTsD���l�#�#�%�%������!������������
r4c��|�dd��|j�|��|j���dSr)r�r�rlr�rs  r2rzSysCapture.writeorgZsE�����:�'?�@�@�@��	��������	�������r4N)r�r�r�r�r�rrur4r2rrQs7�������L��������r4rc��eZdZdZdZdeddfd�Zdefd�Zded	e	ed
fddfd�Z
dd�Zd
�Zdd�Z
dd�Zdd�Zd�ZdS)�FDCaptureBinaryzWCapture IO to/from a given OS-level file descriptor.

    snap() produces `bytes`.
    r4�targetfdr!Nc�p�||_	tj|��d|_nX#t$rKtjtjtj��|_tj|j|��YnwxYwtj	|��|_
|dkr5ttjd���|_t|��|_
n^ttd���dddd���|_|t vrt||j��|_
nt#��|_
d	|_dS)
Nr�utf-8)rJ)rPrr~T)rJrKr�r�r�)r
rG�fstat�targetfd_invalidr�rF�devnull�O_RDWR�dup2rH�
targetfd_saver�r�
syscapturertrr�r�r�)rzr
s  r2r�zFDCaptureBinary.__init__hs)�� ��
�	)��H�X���� %)�D�!�!���
	5�
	5�
	5�46�7�2�:�r�y�3Q�3Q�D�!��G�D�)�8�4�4�4�4�4�
	5����  �V�H�-�-����q�=�=���
�W�=�=�=�D�L�(��2�2�D�O�O�&���*�*�*� � ��"����D�L��<�'�'�",�X�t�|�"D�"D����"+�+�+���#����s�%�AA:�9A:c�p�d�|jj|j|j|j|j��S)Nz)<{} {} oldfd={} _state={!r} tmpfile={!r}>)r�r�r�r
rr�r�rys r2r�zFDCaptureBinary.__repr__�s7��:�A�A��N�#��M����K��L�
�
�	
r4r�r�.c��|j|vs7Jd�||jd�|�������dSr�r�r�s   r2r�zFDCaptureBinary._assert_state�r�r4c���|�dd��tj|j���|j��|j���d|_dS)z4Start capturing on targetfd using memorized tmpfile.r�r�r�N)	r�rGrr�rIr
rr�r�rys r2r�zFDCaptureBinary.start�sZ�����7�$4�5�5�5�
����#�#�%�%�t�}�5�5�5������������r4c��|�dd��|j�d��|jj���}|j�d��|j���|Sr�r�r�s  r2r�zFDCaptureBinary.snap�r�r4c��|�dd��|jdkrdStj|j|j��tj|j��|j�B|j|jkrtj|j��tj|j��|j�	��|j
���d|_dS)z_Stop capturing, restore streams, return original capture file,
        seeked to position zero.r�r�N)r�r�rGrrr
r�rrr�r�rys r2r�zFDCaptureBinary.done�s���	
���6�#R�S�S�S��;�&� � ��F�
���"�D�M�2�2�2�
���#�$�$�$�� �,��$��
�5�5�����'�'�'��H�T�*�+�+�+�������������������r4c���|�dd��|jdkrdS|j���t	j|j|j��d|_dSr�)r�r�rr�rGrrr
rys r2r�zFDCaptureBinary.suspend�sa�����9�&>�?�?�?��;�+�%�%��F�����!�!�!�
���"�D�M�2�2�2�!����r4c���|�dd��|jdkrdS|j���t	j|j���|j��d|_dSr�)	r�r�rr�rGrr�rIr
rys r2r�zFDCaptureBinary.resume�sl�����8�%=�>�>�>��;�)�#�#��F����� � � �
����#�#�%�%�t�}�5�5�5�����r4c�f�|�dd��tj|j|��dS)�"Write to original file descriptor.rr�N)r�rGrlrrs  r2rzFDCaptureBinary.writeorg�s4�����:�'?�@�@�@�
���#�T�*�*�*�*�*r4r�)r�r�r��__doc__r�r�r�r�r�r
r�r�r�r�r�r�rrur4r2r	r	`s��������
�L�'$��'$��'$�'$�'$�'$�R
�#�
�
�
�
�
��
�U�3��8�_�
��
�
�
�
� � � � �������� "�"�"�"� � � � �+�+�+�+�+r4r	c�,��eZdZdZdZd�Z�fd�Z�xZS)�	FDCapturezTCapture IO to/from a given OS-level file descriptor.

    snap() produces text.
    r~c��|�dd��|j�d��|j���}|j�d��|j���|Sr�)r�r�r�r�r�r�s  r2r�zFDCapture.snap�sq�����6�#;�<�<�<�����!�����l���!�!������!������������
r4c�p��t���|�d����dS)rrN)r�r�encode)rzrr�s  �r2rzFDCapture.writeorg�s-���
��������W�-�-�.�.�.�.�.r4)r�r�r�rr�r�rr�r�s@r2rr�sX����������L����/�/�/�/�/�/�/�/�/r4rc���eZdZdZdZdededdfd�Zdefd�Zde	efd	�Z
d
edefd�Zddd�deedeeddfd
�Z
dedefd�Zdefd�Zdedefd�Zdefd�Zdedefd�Zdefd�ZdS)�
CaptureResultz2The result of :method:`CaptureFixture.readouterr`.�rprqrprqr!Nc�"�||_||_dSrwr%�rzrprqs   r2r�zCaptureResult.__init__�s���������r4c��dS)Nr�rurys r2�__len__zCaptureResult.__len__�s���qr4c�8�t|j|jf��Srw)�iterrprqrys r2r�zCaptureResult.__iter__s���T�X�t�x�(�)�)�)r4�itemc�,�t|��|Srw)�tuple�rzr,s  r2�__getitem__zCaptureResult.__getitem__s���T�{�{�4� � r4zCaptureResult[AnyStr]c�H�t|�|jn||�|jn|���S)Nr%)r$rprqr's   r2�_replacezCaptureResult._replaces5����K����S�#�+�d�h�h�SV�
�
�
�	
r4�valuec�F�t|���|��Srw)r.�count�rzr3s  r2r5zCaptureResult.count����T�{�{� � ��'�'�'r4c�F�t|���|��Srw)r.�indexr6s  r2r9zCaptureResult.indexr7r4r�c��t|ttf��stSt|��t|��kSrw�rVr$r.�NotImplemented�rzr�s  r2�__eq__zCaptureResult.__eq__s6���%�-��!7�8�8�	"�!�!��T�{�{�e�E�l�l�*�*r4c�:�tt|����Srw)�hashr.rys r2�__hash__zCaptureResult.__hash__s���E�$�K�K� � � r4c��t|ttf��stSt|��t|��kSrwr;r=s  r2�__lt__zCaptureResult.__lt__s6���%�-��!7�8�8�	"�!�!��T�{�{�U�5�\�\�)�)r4c�(�d|j�d|j�d�S)NzCaptureResult(out=z, err=�)r%rys r2r�zCaptureResult.__repr__"s��C�D�H�C�C�d�h�C�C�C�Cr4)r�r�r�rr�rr�r�r)r
r�r0rr2r5r9�objectr�r>rArCr�r�rur4r2r$r$�s�������=�<��I��F����D�����������*�(�6�*�*�*�*�*�!��!��!�!�!�!�*.�t�
�
�
��v�&�
�4<�V�4D�
�	 �
�
�
�
�(�6�(�c�(�(�(�(�(�c�(�(�(�(�+�F�+�t�+�+�+�+�
!�#�!�!�!�!�*�F�*�t�*�*�*�*�
D�#�D�D�D�D�D�Dr4r$c��eZdZdZdZdd�Zdefd�Zdd�Zde	e
e
ffd�Zddeddfd	�Z
dd
�Zdd�Zdefd�Zdee
fd
�ZdS)�MultiCaptureNFr!c�0�||_||_||_dSrw��in_rprq)rzrKrprqs    r2r�zMultiCapture.__init__*s������������r4c�f�d�|j|j|j|j|j��S)NzH<MultiCapture out={!r} err={!r} in_={!r} _state={!r} _in_suspended={!r}>)r�rprqrKr��
_in_suspendedrys r2r�zMultiCapture.__repr__/s4��Y�`�`��H��H��H��K���
�
�	
r4c���d|_|jr|j���|jr|j���|jr|j���dSdS)Nr�)r�rKr�rprqrys r2�start_capturingzMultiCapture.start_capturing8sm������8�	��H�N�N�����8�	��H�N�N�����8�	��H�N�N������	�	r4c��|���\}}|r|j�|��|r|j�|��||fS)z?Pop current snapshot out/err capture and flush to orig streams.)�
readouterrrprrqr's   r2�pop_outerr_to_origzMultiCapture.pop_outerr_to_origAsZ���?�?�$�$���S��	#��H���c�"�"�"��	#��H���c�"�"�"��C�x�r4rKc���d|_|jr|j���|jr|j���|r)|jr$|j���d|_dSdSdS)Nr�T)r�rpr�rqrKrM�rzrKs  r2�suspend_capturingzMultiCapture.suspend_capturingJs���!����8�	��H�������8�	��H�������	&�4�8�	&��H������!%�D����	&�	&�	&�	&r4c���d|_|jr|j���|jr|j���|jr"|j���d|_dSdS)Nr�F)r�rpr�rqrMrKrys r2�resume_capturingzMultiCapture.resume_capturingTsv������8�	��H�O�O�����8�	��H�O�O������	'��H�O�O����!&�D����	'�	'r4c��|jdkrtd���d|_|jr|j���|jr|j���|jr|j���dSdS)z+Stop capturing and reset capturing streams.�stoppedzwas already stoppedN)r��
ValueErrorrpr�rqrKrys r2�stop_capturingzMultiCapture.stop_capturing^s~���;�)�#�#��2�3�3�3�����8�	��H�M�M�O�O�O��8�	��H�M�M�O�O�O��8�	��H�M�M�O�O�O�O�O�	�	r4c��|jdkS)z7Whether actively capturing -- not suspended or stopped.r�)r�rys r2�
is_startedzMultiCapture.is_startedjs���{�i�'�'r4c��|jr|j���nd}|jr|j���nd}t||��S)Nr~)rpr�rqr$r's   r2rQzMultiCapture.readouterrnsF��!%��1�d�h�m�m�o�o�o�r��!%��1�d�h�m�m�o�o�o�r���S�#�&�&�&r4r��F)r�r�r�r�rMr�r�r�rOr
rrRr�rUrWr[r]r$rQrur4r2rHrH&s������
�F��M�����

�#�
�
�
�
������E�&�&�.�$9�����&�&�T�&�d�&�&�&�&�'�'�'�'�
�
�
�
�(�D�(�(�(�(�'�M�&�1�'�'�'�'�'�'r4rHr%�_CaptureMethodc��|dkr9ttd��td��td�����S|dkr9ttd��td��td�����S|dkrtddd���S|dkr0tdtdd	�
��tdd	�
�����Std|�����)Nrrr�r�rJrrrTr�zunknown capturing method: )rHrrrZ)r%s r2�_get_multicapturerbts���
��~�~��	�!���)�A�,�,�I�a�L�L�Q�Q�Q�Q�	�5����
�1�
�
�:�a�=�=�j�QR�m�m�T�T�T�T�	�4�����$�D�9�9�9�9�	�9�	�	���*�Q�D�1�1�1�z�!��7N�7N�7N�
�
�
�	
��<�&�<�<�
=�
=�=r4c��eZdZdZd*d�Zdefd�Zdeeeffd�Z	defd	�Z
d+d
�Zd+d�Zd+d�Z
d,deddfd�Zd,deddfd�Zd+d�Zdeefd�Zd-d�Zd+d�Zd+d�Zd+d�Zd+d�Zd+d�Zejdedfd���Zejdedededfd���Zed �!��d"e fd#���Z!ed �!��dededfd$���Z"ed �!��dededfd%���Z#ed �!��dededfd&���Z$ed �'��d+d(���Z%ed �'��d+d)���Z&dS).rda�The capture plugin.

    Manages that the appropriate capture method is enabled/disabled during
    collection and each test phase (setup, call, teardown). After each of
    those points, the captured output is obtained and attached to the
    collection/runtest report.

    There are two levels of capture:

    * global: enabled by default and can be suppressed by the ``-s``
      option. This is always enabled/disabled during collection and each test
      phase.

    * fixture: when a test function or one of its fixture depend on the
      ``capsys`` or ``capfd`` fixtures. In this case special handling is
      needed to ensure the fixtures take precedence over the global capture.
    r%r`r!Nc�0�||_d|_d|_dSrw)�_method�_global_capturing�_capture_fixture)rzr%s  r2r�zCaptureManager.__init__�s�����>B���?C����r4c�N�d�|j|j|j��S)NzJ<CaptureManager _method={!r} _global_capturing={!r} _capture_fixture={!r}>)r�rerfrgrys r2r�zCaptureManager.__repr__�s)��[�b�b��L�$�0�$�2G�
�
�	
r4c�h�|���rdS|jrd|jjjzSdS)N�globalz
fixture %sF)�is_globally_capturingrg�request�fixturenamerys r2�is_capturingzCaptureManager.is_capturing�s@���%�%�'�'�	��8�� �	L��$�"7�"?�"K�K�K��ur4c��|jdkS)Nr)rerys r2rkz$CaptureManager.is_globally_capturing�s���|�t�#�#r4c�|�|j�J�t|j��|_|j���dSrw)rfrbrerOrys r2rhz%CaptureManager.start_global_capturing�s>���%�-�-�-�!2�4�<�!@�!@�����.�.�0�0�0�0�0r4c��|j�;|j���|j���d|_dSdSrw)rfrRr[rys r2rgz$CaptureManager.stop_global_capturing�sK���!�-��"�5�5�7�7�7��"�1�1�3�3�3�%)�D�"�"�"�.�-r4c�J�|j�|j���dSdSrw)rfrWrys r2�resume_global_capturez$CaptureManager.resume_global_capture�s0���!�-��"�3�3�5�5�5�5�5�.�-r4FrKc�N�|j�|j�|���dSdS)N�rK)rfrUrTs  r2riz%CaptureManager.suspend_global_capture�s3���!�-��"�4�4��4�=�=�=�=�=�.�-r4c�X�|���|�|��dSrw)�suspend_fixturerirTs  r2r�zCaptureManager.suspend�s.���������#�#�C�(�(�(�(�(r4c�V�|���|���dSrw)rs�resume_fixturerys r2r�zCaptureManager.resume�s,���"�"�$�$�$��������r4c�F�|j�J�|j���Srw)rfrQrys r2rkz"CaptureManager.read_global_capture�s&���%�1�1�1��%�0�0�2�2�2r4�capture_fixture�CaptureFixture[Any]c��|jrK|jjj}|jj}|j�d�||����||_dS)Nz%cannot use {} and {} at the same time)rgrlrm�
raiseerrorr�)rzr{�current_fixture�requested_fixtures    r2�set_fixturezCaptureManager.set_fixture�sj��� �	�"�3�;�G�O� /� 7� C���#�.�.�7�>�>�%����
�
�
�
!0����r4c��d|_dSrw)rgrys r2�
unset_fixturezCaptureManager.unset_fixture�s�� $����r4c�J�|jr|j���dSdS)z|If the current item is using ``capsys`` or ``capfd``, activate
        them so they take precedence over the global capture.N)rg�_startrys r2�activate_fixturezCaptureManager.activate_fixture�s4��� �	+��!�(�(�*�*�*�*�*�	+�	+r4c�J�|jr|j���dSdS)zDDeactivate the ``capsys`` or ``capfd`` fixture of this item, if any.N)rgr�rys r2�deactivate_fixturez!CaptureManager.deactivate_fixture�s2��� �	*��!�'�'�)�)�)�)�)�	*�	*r4c�J�|jr|j���dSdSrw)rg�_suspendrys r2rwzCaptureManager.suspend_fixture�s2��� �	-��!�*�*�,�,�,�,�,�	-�	-r4c�J�|jr|j���dSdSrw)rg�_resumerys r2ryzCaptureManager.resume_fixture�s2��� �	,��!�)�)�+�+�+�+�+�	,�	,r4�NNNc#�K�|jo|j���}|r|���|jo|j���}|r|���	dV�|r|���|r|���dSdS#|r|���|r|���wwxYw)zLContext manager to temporarily disable global and current fixture capturing.N)rg�_is_startedrwrfr]rirsry)rz�
do_fixture�	do_globals   r2�global_and_fixture_disabledz*CaptureManager.global_and_fixture_disabled�s�����*�R�t�/D�/P�/P�/R�/R�
��	#�� � �"�"�"��*�R�t�/E�/P�/P�/R�/R�	��	*��'�'�)�)�)�	&��E�E�E��
-��*�*�,�,�,��
&��#�#�%�%�%�%�%�
&�
&���
-��*�*�,�,�,��
&��#�#�%�%�%�%�
&���s�0B$�$/C�whenr,c#�K�|���|���	dV�|���|�d���n/#|���|�d���wxYw|���\}}|�|d|��|�|d|��dS)NFrurYrZ)rsr�r�rirk�add_report_section)rzr�r,rprqs     r2�item_capturezCaptureManager.item_captures������"�"�$�$�$�������	3��E�E�E��#�#�%�%�%��'�'�E�'�2�2�2�2��
�#�#�%�%�%��'�'�E�'�2�2�2�2�����+�+�-�-���S�����h��4�4�4�����h��4�4�4�4�4s�A�,BTr]�	collectorc#�jK�t|t��r�|���dV�}|���|���\}}|���}|r|j�d|f��|r|j�d|f��dSdSdV�dS)NzCaptured stdoutzCaptured stderr)rVrrsrirk�
get_result�sections�append)rzr�rorprq�reps      r2�pytest_make_collect_reportz)CaptureManager.pytest_make_collect_reports������i��&�&�	��&�&�(�(�(��e�e�G��'�'�)�)�)��/�/�1�1�H�C���$�$�&�&�C��
>���#�#�%6��$<�=�=�=��
>���#�#�%6��$<�=�=�=�=�=�
>�
>�
�E�E�E�E�Er4c#�pK�|�d|��5dV�ddd��dS#1swxYwYdS)N�setup�r�r/s  r2�pytest_runtest_setupz#CaptureManager.pytest_runtest_setup%s�����
�
�
�w��
-�
-�	�	��E�E�E�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	��+�/�/c#�pK�|�d|��5dV�ddd��dS#1swxYwYdS)N�callr�r/s  r2�pytest_runtest_callz"CaptureManager.pytest_runtest_call*s�����
�
�
�v�t�
,�
,�	�	��E�E�E�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	r�c#�pK�|�d|��5dV�ddd��dS#1swxYwYdS)N�teardownr�r/s  r2�pytest_runtest_teardownz&CaptureManager.pytest_runtest_teardown/s�����
�
�
�z�4�
0�
0�	�	��E�E�E�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	r�)�tryfirstc�.�|���dSrw�rgrys r2�pytest_keyboard_interruptz(CaptureManager.pytest_keyboard_interrupt4����"�"�$�$�$�$�$r4c�.�|���dSrwr�rys r2�pytest_internalerrorz#CaptureManager.pytest_internalerror8r�r4)r%r`r!Nr�r_)r{r|r!N)'r�r�r�rr�r�r�rr�rnrkrhrgrsrir�r�r$rkr�r�r�r�rwry�
contextlib�contextmanagerrr�rr�rrr�r�r�r�r�r�rur4r2rdrd�s���������$D�D�D�D�

�#�
�
�
�
�
�e�C��I�.�����$�t�$�$�$�$�1�1�1�1�
*�*�*�*�6�6�6�6�>�>�$�>�4�>�>�>�>�)�)�4�)�D�)�)�)�)�
����3�]�3�%7�3�3�3�3�	0�	0�	0�	0�%�%�%�%�+�+�+�+�*�*�*�*�
-�-�-�-�,�,�,�,���&�Y�7G�-H�&�&�&���&� ��5��5�D�5�Y�?O�5P�5�5�5���5��X�$�����I���� ����X�$�������)�<L�2M���� ����X�$��������;K�1L���� ����X�$�����D��Y�?O�5P���� ����X�t����%�%�%���%��X�t����%�%�%���%�%�%r4rdc��eZdZdZdd�dededdfd�Zdd	�Zdd
�Zde	e
fd�Zdd�Zdd
�Z
defd�Zejdedfd���ZdS)�CaptureFixturez|Object returned by the :fixture:`capsys`, :fixture:`capsysbinary`,
    :fixture:`capfd` and :fixture:`capfdbinary` fixtures.F��	_ispytestrlr�r!Nc��t|��||_||_d|_|jj|_|jj|_dSrw)r�captureclassrl�_capturer��
_captured_out�
_captured_err)rzr�rlr�s    r2r�zCaptureFixture.__init__AsJ��	�y�!�!�!�(������8<��
�!�.�;���!�.�;����r4c���|j�Xtd|�d��|�d�����|_|j���dSdS)Nr�r�rJ)r�rHr�rOrys r2r�zCaptureFixture._startKsi���=� �(���%�%�a�(�(��%�%�a�(�(����D�M�

�M�)�)�+�+�+�+�+�
!� r4c���|j�^|j���\}}|xj|z
c_|xj|z
c_|j���d|_dSdSrw)r�rRr�r�r[r's   r2r�zCaptureFixture.closeTsp���=�$��}�7�7�9�9�H�C�����#�%������#�%����M�(�(�*�*�*� �D�M�M�M�%�$r4c���|j|j}}|j�&|j���\}}||z
}||z
}|jj|_|jj|_t
||��S)z�Read and return the captured output so far, resetting the internal
        buffer.

        :returns:
            The captured content as a namedtuple with ``out`` and ``err``
            string attributes.
        )r�r�r�rQr�r�r$)rz�captured_out�captured_errrprqs     r2rQzCaptureFixture.readouterr\sr��&*�%7��9K�l���=�$��}�/�/�1�1�H�C���C��L��C��L�!�.�;���!�.�;����\�<�8�8�8r4c�J�|j�|j���dSdS)z1Suspend this fixture's own capturing temporarily.N)r�rUrys r2r�zCaptureFixture._suspendms,���=�$��M�+�+�-�-�-�-�-�%�$r4c�J�|j�|j���dSdS)z0Resume this fixture's own capturing temporarily.N)r�rWrys r2r�zCaptureFixture._resumers,���=�$��M�*�*�,�,�,�,�,�%�$r4c�F�|j�|j���SdS)z5Whether actively capturing -- not disabled or closed.NF)r�r]rys r2r�zCaptureFixture._is_startedws#���=�$��=�+�+�-�-�-��ur4r�c#�K�|jjj�d��}|���5dV�ddd��dS#1swxYwYdS)z>Temporarily disable capturing while inside the ``with`` block.raN)rl�configrc�	getpluginr�)rz�
capmanagers  r2�disabledzCaptureFixture.disabled}s������\�(�6�@�@�AQ�R�R�
�
�
3�
3�
5�
5�	�	��E�E�E�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A
�
A�Ar�)r�r�r�rrr�r�r�r�r$rrQr�r�r�r�r�rr�rur4r2r�r�=s������=�=�GL�<�<�<�%/�<�?C�<�	
�<�<�<�<�,�,�,�,�!�!�!�!�9�M�&�1�9�9�9�9�".�.�.�.�
-�-�-�-�
�T��������)�$4�5��������r4r�rlc#�6K�|jj�d��}ttt
|d���}|�|��|���|V�|���|�	��dS)aEnable text capturing of writes to ``sys.stdout`` and ``sys.stderr``.

    The captured output is made available via ``capsys.readouterr()`` method
    calls, which return a ``(out, err)`` namedtuple.
    ``out`` and ``err`` will be ``text`` objects.

    Returns an instance of :class:`CaptureFixture[str] <pytest.CaptureFixture>`.

    Example:

    .. code-block:: python

        def test_output(capsys):
            print("hello")
            captured = capsys.readouterr()
            assert captured.out == "hello\n"
    raTr�N)
r�rcr�r�r�rr�r�r�r��rlrnr{s   r2�capsysr��s�����&�^�
)�
3�
3�4D�
E�
E�F�$�S�)�*�g��N�N�N�O�
����'�'�'�������
����������
�������r4c#�6K�|jj�d��}ttt
|d���}|�|��|���|V�|���|�	��dS)a'Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``.

    The captured output is made available via ``capsysbinary.readouterr()``
    method calls, which return a ``(out, err)`` namedtuple.
    ``out`` and ``err`` will be ``bytes`` objects.

    Returns an instance of :class:`CaptureFixture[bytes] <pytest.CaptureFixture>`.

    Example:

    .. code-block:: python

        def test_output(capsysbinary):
            print("hello")
            captured = capsysbinary.readouterr()
            assert captured.out == b"hello\n"
    raTr�N)
r�rcr�r��bytesr�r�r�r�r�r�s   r2�capsysbinaryr��s�����&�^�
)�
3�
3�4D�
E�
E�F�$�U�+�,<�g�QU�V�V�V�O�
����'�'�'�������
����������
�������r4c#�6K�|jj�d��}ttt
|d���}|�|��|���|V�|���|�	��dS)aEnable text capturing of writes to file descriptors ``1`` and ``2``.

    The captured output is made available via ``capfd.readouterr()`` method
    calls, which return a ``(out, err)`` namedtuple.
    ``out`` and ``err`` will be ``text`` objects.

    Returns an instance of :class:`CaptureFixture[str] <pytest.CaptureFixture>`.

    Example:

    .. code-block:: python

        def test_system_echo(capfd):
            os.system('echo "hello"')
            captured = capfd.readouterr()
            assert captured.out == "hello\n"
    raTr�N)
r�rcr�r�r�rr�r�r�r�r�s   r2�capfdr��s�����&�^�
)�
3�
3�4D�
E�
E�F�$�S�)�)�W��M�M�M�O�
����'�'�'�������
����������
�������r4c#�6K�|jj�d��}ttt
|d���}|�|��|���|V�|���|�	��dS)a-Enable bytes capturing of writes to file descriptors ``1`` and ``2``.

    The captured output is made available via ``capfd.readouterr()`` method
    calls, which return a ``(out, err)`` namedtuple.
    ``out`` and ``err`` will be ``byte`` objects.

    Returns an instance of :class:`CaptureFixture[bytes] <pytest.CaptureFixture>`.

    Example:

    .. code-block:: python

        def test_system_echo(capfdbinary):
            os.system('echo "hello"')
            captured = capfdbinary.readouterr()
            assert captured.out == b"hello\n"

    raTr�N)
r�rcr�r�r�r	r�r�r�r�r�s   r2�capfdbinaryr��s�����(�^�
)�
3�
3�4D�
E�
E�F�$�U�+�O�W�PT�U�U�U�O�
����'�'�'�������
����������
�������r4r�)Brr��	functoolsrDrGrr�tempfiler�typingrrrr	r
rrr
rr�_pytest.compatr�_pytest.configrr�_pytest.config.argparsingr�_pytest.deprecatedr�_pytest.fixturesrr�
_pytest.nodesrrr�typing_extensionsrr`r3r;r\rrrErtr�r�r�r�r�r�rr	r�total_orderingr$rHr�rbrdr�r�r�r�r�r�rur4r2�<module>r�sA��1�1���������	�	�	�	�	�	�	�	�
�
�
�
�#�#�#�#�#�#�"�"�"�"�"�"������������������������������������������������� � � � � � ������� � � � � � �!�!�!�!�!�!�#�#�#�#�#�#�,�,�,�,�,�,�-�-�-�-�-�-�$�$�$�$�$�$�'�'�'�'�'�'�#�#�#�#�#�#��������������;�)�)�)�)�)�)��9�:�N��V�������&����51��51�D�51�51�51�51�p
��d������������2
1�
1�
1�
1�
1�"�"�
1�
1�
1� 6�6�6�6�6�� �6�6�6�$�$�$�$�$�9�$�$�$�5�5�5�5�5�5�5�5�v�x�H�5�5��D�D�D�D�D�D�D�D�
O!�O!�O!�O!�O!�O!�O!�O!�d�����!����s+�s+�s+�s+�s+�s+�s+�s+�l/�/�/�/�/��/�/�/�<�
��-D�-D�-D�-D�-D�G�F�O�-D�-D�����-D�`K'�K'�K'�K'�K'�7�6�?�K'�K'�K'�\>�.�>�<��3D�>�>�>�>�"u%�u%�u%�u%�u%�u%�u%�u%�pE�E�E�E�E�W�V�_�E�E�E�V	��J��9�^�C�-@�$��-L�#M����	���6	��*���>�%�3H�$�PT�3T�)U����	���6	��:��)�N�3�,?��t�,K�"L����	���6	����	�.��2G��t�2S�(T����	����r4

Youez - 2016 - github.com/yon3zu
LinuXploit