403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.9/site-packages/_pytest/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/_pytest/__pycache__/doctest.cpython-39.pyc
a

05die�@s�UdZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZddl
mZddl
mZddl
mZdd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddl
mZddl
mZddl
mZddl
mZddlmZddlmZddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl)m+Z+ddl,m-Z-ddl,m.Z.ddl/m0Z0ddl/m1Z1dd l2m3Z3dd!l2m4Z4dd"l5m6Z6dd#l7m8Z8dd$l9m:Z:e�r�ddl;Z;d%Z<d&Z=d'Z>d(Z?d)Z@e<e=e>e?e@fZAdaBdaCeed*eDd+<e(dd,�d-d.�ZEdd/�d0d1�ZFee-eed2d3�d4d5�ZGeeHd6�d7d8�ZIe&ee-eHd9�d:d;�ZJeeHd6�d<d=�ZKGd>d?�d?e �ZLGd@dA�dAeM�ZNedBd/�dCdD�ZOdsed*eeHePeHdBdF�dGdH�ZQGdIdJ�dJe.�ZReeSePfd/�dKdL�ZTdMdN�ZUdOdP�ZVGdQdR�dRe6�ZWdSddT�dUdV�ZXeYeHdW�dXdY�ZZe
edZd/�d[d\��Z[Gd]d^�d^e6�Z\eRe+d_�d`da�Z]ed*d/�dbdc�Z^d*d/�ddde�Z_ePd/�dfdg�Z`ePd/�dhdi�ZaePd/�djdk�ZbeSePdl�dmdn�Zce*dodp�eeSefd/�dqdr��ZddS)tz4Discover and run doctests in modules and test files.�N)�contextmanager)�Path)�Any)�Callable)�Dict)�	Generator)�Iterable)�List)�Optional)�Pattern)�Sequence)�Tuple)�Type)�
TYPE_CHECKING)�Union)�outcomes)�
ExceptionInfo)�ReprFileLocation)�TerminalRepr)�TerminalWriter��safe_getattr)�Config)�Parser)�fixture)�FixtureRequest)�	Collector)�Item)�OutcomeException)�skip��
fnmatch_ex)�import_path)�Module)�approx)�
PytestWarningZnoneZcdiffZndiff�udiffZonly_first_failure�doctest.OutputChecker�
CHECKER_CLASS)�parser�returncCs�|jddddgd�|jdddd	�|�d
�}|jddd
ddd�|jdtjddtdd�|jddgdddd�|jddd
ddd�|jddd
d d!d�dS)"N�doctest_optionflagszOption flags for doctests�args�ELLIPSIS)�type�default�doctest_encodingzEncoding used for doctest fileszutf-8)r/�collectz--doctest-modules�
store_trueFzRun doctests in all .py modules�doctestmodules)�actionr/�help�destz--doctest-reportr&z9Choose another output format for diffs on doctest failure�
doctestreport)r.r/r5�choicesr6z--doctest-glob�append�patz2Doctests file matching pattern, default: test*.txt�doctestglob)r4r/�metavarr5r6z--doctest-ignore-import-errorszIgnore doctest ImportErrors�doctest_ignore_import_errorsz--doctest-continue-on-failurez<For a given doctest, continue to run after the first failure�doctest_continue_on_failure)ZaddiniZgetgroupZ	addoption�str�lower�DOCTEST_REPORT_CHOICES)r)�group�rC�3/usr/lib/python3.9/site-packages/_pytest/doctest.py�pytest_addoptionEs^��
�����rE�r*cCsdadS�N)�RUNNER_CLASSrCrCrCrD�pytest_unconfigurewsrI)�
DoctestModule�DoctestTextfile)�	file_path�parentr*cCsb|j}|jdkr@|jjr^tt|�t|�f�s^tj||d�}|Snt	|||�r^t
j||d�}|SdS)Nz.py��path)�config�suffix�optionr3�any�_is_setup_py�_is_main_pyrJ�from_parent�_is_doctestrK)rLrMrP�mod�txtrCrCrD�pytest_collect_file}s

�rZ)rOr*cCs&|jdkrdS|��}d|vp$d|vS)Nzsetup.pyFs
setuptoolss	distutils)�name�
read_bytes)rO�contentsrCrCrDrT�s
rT)rPrOrMr*cs@�jdvr|j���rdS|�d�p(dg}t�fdd�|D��S)N)z.txtz.rstTr;z	test*.txtc3s|]}t|��VqdSrGr )�.0�globrNrCrD�	<genexpr>��z_is_doctest.<locals>.<genexpr>)rQ�sessionZ
isinitpath�	getoptionrS)rPrOrM�globsrCrNrDrW�srWcCs
|jdkS)Nz__main__.py)r[rNrCrCrDrU�srUc@s<eZdZeeeeefdd�dd�Zedd�dd�Z	dS)�ReprFailDoctestN)�reprlocation_linesr*cCs
||_dSrG)rf)�selfrfrCrCrD�__init__�szReprFailDoctest.__init__)�twr*cCs2|jD]&\}}|D]}|�|�q|�|�qdSrG)rf�line�
toterminal)rgri�reprlocation�linesrjrCrCrDrk�szReprFailDoctest.toterminal)
�__name__�
__module__�__qualname__rr
rr?rhrrkrCrCrCrDre�s�recs(eZdZeddd��fdd�Z�ZS)�MultipleDoctestFailureszdoctest.DocTestFailureN)�failuresr*cst���||_dSrG)�superrhrr�rgrr��	__class__rCrDrh�s
z MultipleDoctestFailures.__init__)rnrorprrh�
__classcell__rCrCrurDrq�srq�doctest.DocTestRunnercs"ddl�G�fdd�d�j�}|S)NrcsxeZdZdZdedeeeedd��fdd�
Zd	d
edd��fdd
�Z	d	d
e
eeee
jfdd��fdd�Z�ZS)z/_init_runner_class.<locals>.PytestDoctestRunnerz�Runner to collect failures.

        Note that the out variable in this case is a list instead of a
        stdout-like object.
        NrTr'��checker�verbose�optionflags�continue_on_failurer*cst�j|||d�||_dS)N)rzr{r|)rsrhr})rgrzr{r|r}rurCrDrh�sz8_init_runner_class.<locals>.PytestDoctestRunner.__init__�doctest.DocTestzdoctest.Example)�test�example�gotr*cs(��|||�}|jr |�|�n|�dSrG)�DocTestFailurer}r9)rg�outrr�r��failure��doctestrCrD�report_failure�sz>_init_runner_class.<locals>.PytestDoctestRunner.report_failure)rr��exc_infor*csXt|dt�r|d�t|dtj�r0t�d���|||�}|jrP|�|�n|�dS)N�zQuitting debugger)	�
isinstancer�bdbZBdbQuitr�exit�UnexpectedExceptionr}r9)rgr�rr�r�r�r�rCrD�report_unexpected_exception�s
zK_init_runner_class.<locals>.PytestDoctestRunner.report_unexpected_exception)NNrT)rnrorp�__doc__r
�bool�intrhr?r�r
r�
BaseException�types�
TracebackTyper�rwrCr�rurD�PytestDoctestRunner�s,��
��r�)r�ZDebugRunner)r�rCr�rD�_init_runner_class�s/r�TrycCstdurt�at||||d�S)N�rzr{r|r})rHr�r�rCrCrD�_get_runner�s�r�cs�eZdZdedededdd��fdd�
Zededdd��fd	d
��Zdd�dd
�Zdd�dd�Z	dd�dd�Z
eee
eefd��fdd�Zee
defeeefd�dd�Z�ZS)�DoctestItemNz%Union[DoctestTextfile, DoctestModule]rxr~)r[rM�runner�dtestr*cs*t��||�||_||_d|_d|_dSrG)rsrhr�r��obj�fixture_request)rgr[rMr�r�rurCrDrh�s
zDoctestItem.__init__)rMr[r�r�cst�j||||d�S)zThe public named constructor.)r[rMr�r�)rsrV)�clsrMr[r�r�rurCrDrV
szDoctestItem.from_parentrFcCsV|jdurRt|�|_t|jjd�}|j�d���D]\}}|||<q2|jj�|�dS)N)Z
getfixture�doctest_namespace)r��_setup_fixturesr��dictZgetfixturevalue�itemsrd�update)rgrdr[�valuerCrCrD�setups

�
zDoctestItem.setupcCsT|jdusJ�|jdusJ�t|j�|��g}|jj|j|d�|rPt|��dS)N)r�)r�r��_check_all_skipped�$_disable_output_capturing_for_darwin�runrqrtrCrCrD�runtest!s
zDoctestItem.runtestcCsVt��dkrdS|jj�d�}|rR|jdd�|��\}}tj�	|�tj
�	|�dS)zFDisable output capturing. Otherwise, stdout is lost to doctest (#985).ZDarwinNZcapturemanagerT)Zin_)�platform�systemrP�
pluginmanagerZ	getpluginZsuspend_global_captureZread_global_capture�sys�stdout�write�stderr)rgZcapmanr��errrCrCrDr�-sz0DoctestItem._disable_output_capturing_for_darwin)�excinfor*cs�ddl}d}t|j|j|jf�r*|jg}nt|jt�r>|jj}|durRt��|�Sg}|D�]v}|j	}|j
��j}�jdur�d}n�j|jd}t
|�j}	t|||	�}
t�}t|j�d��}|du�r*|j
jdus�J�|j
j�d�}
�jdus�J��fdd�t|
�D�}
|
t|jdd�|jd�}
n6dg}
d	}|j��D] }|
�d
|�d|���d}�q>t||j��r�|
|�||j|��d
�7}
n:t�|j�}|
dt |j�g7}
|
dd�t!j"|j�D�7}
|�|
|
f�qZt#|�S)Nrr�r7Fcs&g|]\}}d|�jd|f�qS)z%03d %sr�)�lineno)r^�i�x�rrCrD�
<listcomp>_sz,DoctestItem.repr_failure.<locals>.<listcomp>�	z?EXAMPLE LOCATION UNKNOWN, not showing all tests of that examplez>>>z??? � z...�
zUNEXPECTED EXCEPTION: %scSsg|]}|�d��qS)r�)�strip�r^r�rCrCrDr�ss)$r�r�r�r�r�rqrrrs�repr_failurer�r�filenamer�r.rnr�_get_checker�_get_report_choicerPrcZ	docstring�
splitlines�	enumerate�max�sourcer9Zoutput_differencer��splitrZ
from_exc_infor��repr�	traceback�format_exceptionre)rgr�r�rrrfr�r�r�r��messagerlrzZ
report_choicerm�indentrjZ
inner_excinforur�rDr�9sd��





� ���
�zDoctestItem.repr_failurezos.PathLike[str]cCs$|jdusJ�|j|jjd|jfS)Nz[doctest] %s)r�rOr�r[)rgrCrCrD�
reportinfoyszDoctestItem.reportinfo)NN)rnrorpr?r
rh�classmethodrVr�r�r�rr�rrr�r
r�r�rwrCrCrurDr��s,��
�

�@r�cCs4ddl}t|j|j|j|j|j|jt�t	�t
�d�	S)Nr)	�DONT_ACCEPT_TRUE_FOR_1�DONT_ACCEPT_BLANKLINE�NORMALIZE_WHITESPACEr-�IGNORE_EXCEPTION_DETAIL�COMPARISON_FLAGS�
ALLOW_UNICODE�ALLOW_BYTES�NUMBER)r�r�r�r�r�r-r�r��_get_allow_unicode_flag�_get_allow_bytes_flag�_get_number_flagr�rCrCrD�_get_flag_lookup~s�r�cCs0|j�d�}t�}d}|D]}|||O}q|S)Nr+r)rP�getinir�)rMZoptionflags_strZflag_lookup_tableZflag_acc�flagrCrCrD�get_optionflags�sr�cCs |�d�}|r|�d�rd}|S)Nr>ZusepdbF)�getvalue)rPr}rCrCrD�_get_continue_on_failure�s


r�c@s"eZdZdZeed�dd�ZdS)rKNrFccs�ddl}|j�d�}|j�|�}t|j�}|jj}ddi}t|�}td|t	�t
|j�d�}|��}	|	�||||d�}
|
j
r�tj||
j||
d�VdS)Nrr0rn�__main__F�r{r|rzr}�r[r�r�)r�rPr�rO�	read_textr?r[r�r�r�r�Z
DocTestParserZget_doctest�examplesr�rV)rgr��encoding�textr�r[rdr|r�r)rrCrCrDr1�s&
�
�zDoctestTextfile.collect)rnrorpr�rr�r1rCrCrCrDrK�srKr~)rr*cs0ddl�t�fdd�|jD��}|r,td�dS)zVRaise pytest.skip() if all examples in the given DocTest have the SKIP
    option set.rNc3s|]}|j��jd�VqdS)FN)�options�getZSKIPr�r�rCrDr`�raz%_check_all_skipped.<locals>.<genexpr>z!all tests skipped by +SKIP option)r��allr�r)rZall_skippedrCr�rDr��sr�)r�r*cCst|dd�duS)zmReturn if an object is possibly a mock object by checking the
    existence of a highly improbable attribute.Z1pytest_mock_example_attribute_that_shouldnt_existNr�r�rCrCrD�
_is_mocked�s
��r�)NNNc#s\tj�dd�tdtftttgtftd��fdd�}|t_zdVW�t_n�t_0dS)z�Context manager which replaces ``inspect.unwrap`` with a version
    that's aware of mock objects and doesn't recurse into them.N��stop.)�funcr�r*c
szz:|dus|tur ��td�WS|�����fdd�d�WStyt}z"t�d|�ft��WYd}~n
d}~00dS)Nr�cst|�p���SrG)r�r���_stopr�rCrD�<lambda>�razF_patch_unwrap_mock_aware.<locals>._mock_aware_unwrap.<locals>.<lambda>z�Got %r when unwrapping %r.  This is usually caused by a violation of Python's object protocol; see e.g. https://github.com/pytest-dev/pytest/issues/5080)r��	Exception�warnings�warnr%)r�r��e�Zreal_unwrapr�rD�_mock_aware_unwrap�s��z4_patch_unwrap_mock_aware.<locals>._mock_aware_unwrap)�inspect�unwraprrr
)r�rCr�rD�_patch_unwrap_mock_aware�s��r�c@seZdZeed�dd�ZdS)rJrFccs�ddl}Gdd�d|j�}|jjdkrJ|jjj|j|j�d�|jjd�}nRz t	|j|jj|j�d�d�}Wn0t
y�|j�d�r�td	|j�n�Yn0|�}t
|�}td
|t�t|j�d�}|�||j�D] }|jr�tj||j||d�Vq�dS)
Nrcs2eZdZdZ�fdd�Zdd��fdd�Z�ZS)z5DoctestModule.collect.<locals>.MockAwareDocTestFinderz�A hackish doctest finder that overrides stdlib internals to fix a stdlib bug.

            https://github.com/pytest-dev/pytest/issues/3456
            https://bugs.python.org/issue25532
            cs8t|t�rt|d|�}t|d�r*t�|�}t��||�S)a3Doctest code does not take into account `@property`, this
                is a hackish way to fix it. https://bugs.python.org/issue17446

                Wrapped Doctests will need to be unwrapped so the correct
                line number is returned. This will be reported upstream. #8796
                �fget�__wrapped__)r��property�getattr�hasattrr�r�rs�_find_lineno)rgr��source_linesrurCrDr��s


�zBDoctestModule.collect.<locals>.MockAwareDocTestFinder._find_linenoNrFc
sNt|�rdSt��(t��|||||||�Wd�n1s@0YdSrG)r�r�rs�_find)rgZtestsr�r[�moduler�rd�seenrurCrDrs�z;DoctestModule.collect.<locals>.MockAwareDocTestFinder._find)rnrorpr�r�rrwrCrCrurD�MockAwareDocTestFinder�s�rzconftest.pyZ
importmode)�rootpath)�root�moder=zunable to import module %rFr�r�)r�Z
DocTestFinderrOr[rPr�Z_importconftestrcrr"�ImportErrorr�rr�r�r�r��findrnr�r�rV)rgr�rr�finderr|r�rrCrCrDr1�s>&
�
�
�
�zDoctestModule.collectN)rnrorprr�r1rCrCrCrDrJ�srJ)�doctest_itemr*cCsHdd�dd�}i|_|jj}|j||ddd�|_t|dd�}|��|S)	zEUsed by DoctestTextfile and DoctestItem to setup fixture information.NrFcSsdSrGrCrCrCrCrDr�Asz_setup_fixtures.<locals>.funcF)Znoder�r��funcargsT)Z	_ispytest)rrbZ_fixturemanagerZgetfixtureinfoZ_fixtureinforZ
_fillfixtures)r
r�Zfmr�rCrCrDr�>s�r�cs*ddl}ddl�G�fdd�d|j�}|S)NrcsfeZdZ��d�j�Z��d�j�Z��d�j�Ze	e	e
ed���fdd�Ze	e	e	d�dd	�Z
�ZS)
z2_init_checker_class.<locals>.LiteralsOutputCheckerz(\W|^)[uU]([rR]?[\'\"])z(\W|^)[bB]([rR]?[\'\"])a�
            (?P<number>
              (?P<mantissa>
                (?P<integer1> [+-]?\d*)\.(?P<fraction>\d+)
                |
                (?P<integer2> [+-]?\d+)\.
              )
              (?:
                [Ee]
                (?P<exponent1> [+-]?\d+)
              )?
              |
              (?P<integer3> [+-]?\d+)
              (?:
                [Ee]
                (?P<exponent2> [+-]?\d+)
              )
            )
            )�wantr�r|r*cs�t��|||�rdS|t�@}|t�@}|t�@}|sB|sB|sBdSttttd��fdd�}|rx||j|�}||j|�}|r�||j|�}||j|�}|r�|�	||�}t��|||�S)NTF)�regexrYr*cs��|d|�S)Nz\1\2)�sub)r
rY��rerCrD�remove_prefixes{szX_init_checker_class.<locals>.LiteralsOutputChecker.check_output.<locals>.remove_prefixes)
rs�check_outputr�r�r�rr?�_unicode_literal_re�_bytes_literal_re�_remove_unwanted_precision)rgrr�r|Z
allow_unicodeZallow_bytesZallow_numberr)rvrrCrDrps"


z?_init_checker_class.<locals>.LiteralsOutputChecker.check_output)rr�r*cSst|j�|��}t|j�|��}t|�t|�kr4|Sd}t||�D]�\}}|�d�}|�d�}	|	durp|�d�}	|dur|dnt|�}
|	dur�|
t|	�8}
t|���tt|���d|
d�krB|d|�	�|�|��||�
�|d�}||�
�|�	�|�
�|�	�7}qB|S)Nr�fractionZ	exponent1Z	exponent2�
)�abs)�list�
_number_re�finditer�len�ziprBr��floatr$�start�end)rgrr�ZwantsZgots�offset�w�grZexponentZ	precisionrCrCrDr�s$


&.�&zM_init_checker_class.<locals>.LiteralsOutputChecker._remove_unwanted_precision)rnrorp�compile�UNICODErr�VERBOSErr?r�r�rrrwrCrrurD�LiteralsOutputCheckerRs�r')r�rZ
OutputChecker)r�r'rCrrD�_init_checker_classNsQr(cCstdurt�at�S)a�Return a doctest.OutputChecker subclass that supports some
    additional options:

    * ALLOW_UNICODE and ALLOW_BYTES options to ignore u'' and b''
      prefixes (respectively) in string literals. Useful when the same
      doctest should run in Python 2 and Python 3.

    * NUMBER to ignore floating-point differences smaller than the
      precision of the literal number in the doctest.

    An inner class is used to avoid importing "doctest" at the module
    level.
    N)r(r(rCrCrCrDr��sr�cCsddl}|�d�S)z+Register and return the ALLOW_UNICODE flag.rNr��r�Zregister_optionflagr�rCrCrDr��sr�cCsddl}|�d�S)z)Register and return the ALLOW_BYTES flag.rNr�r)r�rCrCrDr��sr�cCsddl}|�d�S)z$Register and return the NUMBER flag.rNr�r)r�rCrCrDr��sr�)�keyr*c
Cs,ddl}t|jt|jt|jt|jt	di|S)z�Return the actual `doctest` module flag value.

    We want to do it as late as possible to avoid importing `doctest` and all
    its dependencies when parsing options, as it adds overhead and breaks tests.
    rN)
r��DOCTEST_REPORT_CHOICE_UDIFFZREPORT_UDIFF�DOCTEST_REPORT_CHOICE_CDIFFZREPORT_CDIFF�DOCTEST_REPORT_CHOICE_NDIFFZREPORT_NDIFF�(DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILUREZREPORT_ONLY_FIRST_FAILURE�DOCTEST_REPORT_CHOICE_NONE)r*r�rCrCrDr��s��r�rb)ZscopecCst�S)a�Fixture that returns a :py:class:`dict` that will be injected into the
    namespace of doctests.

    Usually this fixture is used in conjunction with another ``autouse`` fixture:

    .. code-block:: python

        @pytest.fixture(autouse=True)
        def add_np(doctest_namespace):
            doctest_namespace["np"] = numpy

    For more details: :ref:`doctest_namespace`.
    )r�rCrCrCrDr��sr�)NNrT)er�r�r��osr�r�r�r�r��
contextlibr�pathlibr�typingrrrrrr	r
rrr
rrrZ_pytestrZ_pytest._code.coderrrZ_pytest._iorZ_pytest.compatrZ_pytest.configrZ_pytest.config.argparsingrZ_pytest.fixturesrrZ
_pytest.nodesrrZ_pytest.outcomesrrZ_pytest.pathlibr!r"Z_pytest.pythonr#Z_pytest.python_apir$Z_pytest.warning_typesr%r�r/r,r-r+r.rArHr(�__annotations__rErIrZr�rTrWrUrer�rqr�r�r�r�r?r�r�r�rKr��objectr�r�rJr�r(r�r�r�r�r�r�rCrCrCrD�<module>s��	2
�
6��	

	MX

Youez - 2016 - github.com/yon3zu
LinuXploit