U
    `»{j�f  ã                   @  s–  U d Z ddlmZ ddlZddlmZ ddlZddlZddlZddl	m
Z
 ddlZddlZddlZddlZddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' ddl&m(Z( ddl)m*Z* ddl)m+Z+ ddl,m-Z- ddl,m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 e�r¸ddl7Z7ddl8m9Z9 d Z:d!Z;d"Z<d#Z=d$Z>e:e;e<e=e>fZ?da@daAd%eBd&< d'd(d)œd*d+„ZCd(d,œd-d.„ZDd/d0d1d2œd3d4„ZEd/d5d6œd7d8„ZFd9d/d0d5d:œd;d<„ZGd/d5d6œd=d>„ZHG d?d@„ d@eƒZIG dAdB„ dBeJƒZKdCd,œdDdE„ZLd|dGdHdId5dJdKœdLdM„ZMG dNdO„ dOe+ƒZNdPd,œdQdR„ZOd9dIdSœdTdU„ZPd9d5dSœdVdW„ZQG dXdY„ dYe2ƒZRdZd(d[œd\d]„ZSd^d5d_œd`da„ZTedbd,œdcdd„ƒZUG dedf„ dfe2ƒZVdgd,œdhdi„ZWdjd,œdkdl„ZXdId,œdmdn„ZYdId,œdodp„ZZdId,œdqdr„Z[dsdIdtœdudv„Z\e'dwdx�dyd,œdzd{„ƒZ]dS )}z4Discover and run doctests in modules and test files.é    )ÚannotationsN)Úcontextmanager)ÚPath)ÚAny)ÚCallable)Ú	Generator)ÚIterable)ÚPattern)ÚSequence)ÚTYPE_CHECKING)Úoutcomes)ÚExceptionInfo)ÚReprFileLocation)ÚTerminalRepr)ÚTerminalWriter©Úsafe_getattr)ÚConfig)ÚParser)Úfixture)Ú
TopRequest)Ú	Collector)ÚItem)ÚOutcomeException)Úskip©Ú
fnmatch_ex)ÚModule)Úapprox)ÚPytestWarning)ÚSelfÚnoneZcdiffZndiffÚudiffZonly_first_failurez"type[doctest.OutputChecker] | NoneÚCHECKER_CLASSr   ÚNone)ÚparserÚreturnc                 C  sœ   | j ddddgd� | j dddd	� |  d
¡}|jdddddd� |jdtjddtdd� |jddg dddd� |jdddddd� |jdddd d!d� d S )"NÚdoctest_optionflagszOption flags for doctestsÚargsÚELLIPSIS)ÚtypeÚdefaultÚdoctest_encodingzEncoding used for doctest fileszutf-8)r+   Úcollectz--doctest-modulesÚ
store_trueFzRun doctests in all .py modulesÚdoctestmodules)Úactionr+   ÚhelpÚdestz--doctest-reportr"   z9Choose another output format for diffs on doctest failureÚdoctestreport)r*   r+   r1   Úchoicesr2   z--doctest-globÚappendÚpatz2Doctests file matching pattern, default: test*.txtÚdoctestglob)r0   r+   Úmetavarr1   r2   z--doctest-ignore-import-errorsz Ignore doctest collection errorsÚdoctest_ignore_import_errorsz--doctest-continue-on-failurez<For a given doctest, continue to run after the first failureÚdoctest_continue_on_failure)ZaddiniZgetgroupZ	addoptionÚstrÚlowerÚDOCTEST_REPORT_CHOICES)r%   Úgroup© r?   úN/var/www/html/bwave/python/venv/lib/python3.8/site-packages/_pytest/doctest.pyÚpytest_addoptionF   sb    ü  ÿ
ûúúûûrA   ©r&   c                   C  s   d a d S ©N)ÚRUNNER_CLASSr?   r?   r?   r@   Úpytest_unconfigurex   s    rE   r   r   z&DoctestModule | DoctestTextfile | None)Ú	file_pathÚparentr&   c                 C  sZ   |j }| jdkr<|jjrVtt| ƒt| ƒfƒsVtj|| d�S nt	|| |ƒrVt
j|| d�S d S )Nz.py©Úpath)ÚconfigÚsuffixÚoptionr/   ÚanyÚ_is_setup_pyÚ_is_main_pyÚDoctestModuleÚfrom_parentÚ_is_doctestÚDoctestTextfile)rF   rG   rJ   r?   r?   r@   Úpytest_collect_file~   s    

ÿrT   Úbool)rI   r&   c                 C  s&   | j dkrdS |  ¡ }d|kp$d|kS )Nzsetup.pyFs
   setuptoolss	   distutils)ÚnameÚ
read_bytes)rI   Úcontentsr?   r?   r@   rN   �   s    
rN   r   )rJ   rI   rG   r&   c                   s@   ˆ j dkr|j ˆ ¡rdS |  d¡p(dg}t‡ fdd„|D ƒƒS )N)z.txtz.rstTr7   z	test*.txtc                 3  s   | ]}t |ˆ ƒV  qd S rC   r   )Ú.0ÚglobrH   r?   r@   Ú	<genexpr>˜   s     z_is_doctest.<locals>.<genexpr>)rK   ÚsessionZ
isinitpathÚ	getoptionrM   )rJ   rI   rG   Úglobsr?   rH   r@   rR   ”   s    rR   c                 C  s
   | j dkS )Nz__main__.py)rV   rH   r?   r?   r@   rO   ›   s    rO   c                   @  s,   e Zd Zdddœdd„Zdddœdd	„Zd
S )ÚReprFailDoctestz0Sequence[tuple[ReprFileLocation, Sequence[str]]]r$   )Úreprlocation_linesr&   c                 C  s
   || _ d S rC   )r`   )Úselfr`   r?   r?   r@   Ú__init__    s    zReprFailDoctest.__init__r   )Útwr&   c                 C  s2   | j D ]&\}}|D ]}| |¡ q| |¡ qd S rC   )r`   ÚlineÚ
toterminal)ra   rc   ÚreprlocationÚlinesrd   r?   r?   r@   re   ¥   s    zReprFailDoctest.toterminalN)Ú__name__Ú
__module__Ú__qualname__rb   re   r?   r?   r?   r@   r_   Ÿ   s   r_   c                      s$   e Zd Zdddœ‡ fdd„Z‡  ZS )ÚMultipleDoctestFailuresz Sequence[doctest.DocTestFailure]r$   )Úfailuresr&   c                   s   t ƒ  ¡  || _d S rC   )Úsuperrb   rl   ©ra   rl   ©Ú	__class__r?   r@   rb   ­   s    
z MultipleDoctestFailures.__init__)rh   ri   rj   rb   Ú__classcell__r?   r?   ro   r@   rk   ¬   s   rk   ztype[doctest.DocTestRunner]c                    s"   dd l ‰ G ‡ fdd„dˆ jƒ} | S )Nr   c                      s`   e Zd ZdZdddddd	d
œ‡ fdd„Zdddd	dœ‡fdd„Zdddd	dœ‡fdd„Z‡  ZS )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.
        Nr   Túdoctest.OutputChecker | Noneúbool | NoneÚintrU   r$   ©ÚcheckerÚverboseÚoptionflagsÚcontinue_on_failurer&   c                   s   t ƒ j|||d� || _d S )N)rv   rw   rx   )rm   rb   ry   )ra   rv   rw   rx   ry   ro   r?   r@   rb   ¼   s    z8_init_runner_class.<locals>.PytestDoctestRunner.__init__údoctest.DocTestzdoctest.Exampler;   )ÚtestÚexampleÚgotr&   c                   s(   ˆ   |||¡}| jr | |¡ n|‚d S rC   )ÚDocTestFailurery   r5   )ra   Úoutr{   r|   r}   Úfailure©Údoctestr?   r@   Úreport_failureÆ   s    z>_init_runner_class.<locals>.PytestDoctestRunner.report_failurez>tuple[type[BaseException], BaseException, types.TracebackType])r{   r|   Úexc_infor&   c                   sX   t |d tƒr|d ‚t |d tjƒr0t d¡ ˆ  |||¡}| jrP| |¡ n|‚d S )Né   zQuitting debugger)	Ú
isinstancer   ÚbdbZBdbQuitr   ÚexitÚUnexpectedExceptionry   r5   )ra   r   r{   r|   r„   r€   r�   r?   r@   Úreport_unexpected_exceptionÓ   s    
zK_init_runner_class.<locals>.PytestDoctestRunner.report_unexpected_exception)NNr   T)rh   ri   rj   Ú__doc__rb   rƒ   rŠ   rq   r?   r�   ro   r@   ÚPytestDoctestRunnerµ   s       û
rŒ   )r‚   ZDebugRunner)rŒ   r?   r�   r@   Ú_init_runner_class²   s    /r�   Trr   rs   rt   údoctest.DocTestRunnerru   c                 C  s   t d krtƒ a t | |||d�S )N©rv   rw   rx   ry   )rD   r�   r�   r?   r?   r@   Ú_get_runnerç   s    ür�   c                      s¢   e Zd Zddddddœ‡ fdd„Zeddddd	d
œ‡ fdd„ƒZddœdd„Zddœdd„Zddœdd„Zddœdd„Z	dddœ‡ fdd„Z
ddœdd„Z‡  ZS )ÚDoctestItemr;   zDoctestTextfile | DoctestModulerŽ   rz   r$   )rV   rG   ÚrunnerÚdtestr&   c                   sR   t ƒ  ||¡ || _|| _d | _| jj}|j| d d d�}|| _|j	| _
|  ¡  d S )N)ÚnodeÚfuncÚcls)rm   rb   r’   r“   Úobjr\   Ú_fixturemanagerZgetfixtureinfoZ_fixtureinfoZnames_closureZfixturenamesÚ_initrequest)ra   rV   rG   r’   r“   ÚfmZfixtureinforo   r?   r@   rb   ü   s    zDoctestItem.__init__r    )rG   rV   r’   r“   r&   c                  s   t ƒ j||||d�S )zThe public named constructor.)rV   rG   r’   r“   )rm   rQ   )r–   rG   rV   r’   r“   ro   r?   r@   rQ     s    zDoctestItem.from_parentrB   c                 C  s   i | _ t| dd�| _d S )NT)Z	_ispytest)Zfuncargsr   Ú_request©ra   r?   r?   r@   r™     s    zDoctestItem._initrequestc                 C  sL   | j  ¡  t| j jd�}| j  d¡ ¡ D ]\}}|||< q(| jj |¡ d S )N)Z
getfixtureÚdoctest_namespace)r›   Z_fillfixturesÚdictZgetfixturevalueÚitemsr“   r^   Úupdate)ra   r^   rV   Úvaluer?   r?   r@   Úsetup   s
    

zDoctestItem.setupc                 C  s8   t | jƒ |  ¡  g }| jj| j|d� |r4t|ƒ‚d S )N)r   )Ú_check_all_skippedr“   Ú$_disable_output_capturing_for_darwinr’   Úrunrk   rn   r?   r?   r@   Úruntest'  s    
zDoctestItem.runtestc                 C  sV   t  ¡ dkrdS | jj d¡}|rR|jdd� | ¡ \}}tj 	|¡ tj
 	|¡ dS )zFDisable output capturing. Otherwise, stdout is lost to doctest (#985).ÚDarwinNZcapturemanagerT)Zin_)ÚplatformÚsystemrJ   ZpluginmanagerZ	getpluginZsuspend_global_captureZread_global_captureÚsysÚstdoutÚwriteÚstderr)ra   Zcapmanr   Úerrr?   r?   r@   r¤   1  s    z0DoctestItem._disable_output_capturing_for_darwinzExceptionInfo[BaseException]zstr | TerminalRepr)Úexcinfor&   c                   sÚ  dd l }d }t|j|j|jfƒr*|jg}nt|jtƒr>|jj}|d krRtƒ  |¡S g }|D �]t}|j	}|j
‰ ˆ j}ˆ jd kr‚d }nˆ j|j d }t|ƒj}	t|||	ƒ}
tƒ }t| j d¡ƒ}|d k	�r*|j
jd k	sØt‚|j
j d¡}ˆ jd k	sôt‚‡ fdd„t|ƒD ƒ}|t|jd dƒ|jd … }n6dg}d	}|j ¡ D ] }| d
|› d|› �¡ d}�q>t||jƒ�rŠ|| ||j|¡ d¡7 }n8t |j ¡}|d|j›�g7 }|dd„ t!j"|j Ž D ƒ7 }| |
|f¡ qZt#|ƒS )Nr   r…   r3   Fc                   s&   g | ]\}}d |ˆ j  d |f ‘qS )z%03d %sr…   )Úlineno)rY   ÚiÚx©r{   r?   r@   Ú
<listcomp>c  s    z,DoctestItem.repr_failure.<locals>.<listcomp>é	   z?EXAMPLE LOCATION UNKNOWN, not showing all tests of that examplez>>>z??? ú z...Ú
zUNEXPECTED EXCEPTION: c                 S  s   g | ]}|  d ¡‘qS )r·   )Ústrip©rY   r²   r?   r?   r@   r´   w  s    )$r‚   r†   r¡   r~   r‰   rk   rl   rm   Úrepr_failurer|   r{   Úfilenamer°   r*   rh   r   Ú_get_checkerÚ_get_report_choicerJ   r]   Z	docstringÚAssertionErrorÚ
splitlinesÚ	enumerateÚmaxÚsourcer5   Zoutput_differencer}   Úsplitr   Zfrom_exc_infor„   Ú	tracebackÚformat_exceptionr_   )ra   r¯   r‚   rl   r`   r€   r|   r»   r°   Úmessagerf   rv   Zreport_choicerg   Úindentrd   Zinner_excinforo   r³   r@   rº   =  sj    þ 
ÿ





ÿ ÿ  ÿþ
ÿzDoctestItem.repr_failurez.tuple[os.PathLike[str] | str, int | None, str]c                 C  s   | j | jjd| j› �fS )Nz
[doctest] )rI   r“   r°   rV   rœ   r?   r?   r@   Ú
reportinfo}  s    zDoctestItem.reportinfo)rh   ri   rj   rb   ÚclassmethodrQ   r™   r¢   r¦   r¤   rº   rÈ   rq   r?   r?   ro   r@   r‘   û   s   
@r‘   zdict[str, int]c                  C  s4   dd l } t| j| j| j| j| j| jtƒ 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�   r?   r?   r@   Ú_get_flag_lookup�  s    ÷rÕ   )rJ   r&   c                 C  s.   |   d¡}tƒ }d}|D ]}||| O }q|S )Nr'   r   )ÚgetinirÕ   )rJ   Zoptionflags_strZflag_lookup_tableZflag_accÚflagr?   r?   r@   Úget_optionflags‘  s    
rØ   c                 C  s    |   d¡}|r|   d¡rd}|S )Nr:   ZusepdbF)Úgetvalue)rJ   ry   r?   r?   r@   Ú_get_continue_on_failureš  s
    

rÚ   c                   @  s   e Zd ZdZddœdd„ZdS )rS   NúIterable[DoctestItem]rB   c                 c  s–   dd l }| j d¡}| j |¡}t| jƒ}| jj}ddi}t| jƒ}td|t	ƒ t
| jƒd�}| ¡ }	|	 ||||d¡}
|
jr’tj| |
j||
d�V  d S )Nr   r,   rh   Ú__main__F©rw   rx   rv   ry   ©rV   r’   r“   )r‚   rJ   rÖ   rI   Ú	read_textr;   rV   rØ   r�   r¼   rÚ   ZDocTestParserZget_doctestÚexamplesr‘   rQ   )ra   r‚   ÚencodingÚtextr»   rV   r^   rx   r’   r%   r{   r?   r?   r@   r-   §  s,    

ü   ÿzDoctestTextfile.collect)rh   ri   rj   r—   r-   r?   r?   r?   r@   rS   ¤  s   rS   rz   )r{   r&   c                   s0   ddl ‰ t‡ fdd„| jD ƒƒ}|r,tdƒ dS )zVRaise pytest.skip() if all examples in the given DocTest have the SKIP
    option set.r   Nc                 3  s   | ]}|j  ˆ jd ¡V  qdS )FN)ÚoptionsÚgetZSKIPr¹   r�   r?   r@   r[   È  s     z%_check_all_skipped.<locals>.<genexpr>z!all tests skipped by +SKIP option)r‚   Úallrà   r   )r{   Zall_skippedr?   r�   r@   r£   Ã  s    r£   Úobject)r—   r&   c                 C  s   t | ddƒdk	S )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—   r?   r?   r@   Ú
_is_mockedÍ  s    
ÿÿrè   zGenerator[None]c                  #  s@   t j‰ ddœddddœ‡ fdd„} | t _z
dV  W 5 ˆ t _X dS )	z€Context manager which replaces ``inspect.unwrap`` with a version
    that's aware of mock objects and doesn't recurse into them.N©ÚstopzCallable[..., Any]zCallable[[Any], Any] | Noner   )r•   rê   r&   c             
     s~   z:|d ks|t kr ˆˆt d�W S |‰ ˆˆ‡ ‡fdd„d�W S  tk
rx } z t d|›dˆ›d�t¡ ‚ W 5 d }~X Y nX d S )Nré   c                   s   t | ƒpˆ ˆƒS rC   )rè   rç   ©Ú_stopr•   r?   r@   Ú<lambda>ã  ó    zF_patch_unwrap_mock_aware.<locals>._mock_aware_unwrap.<locals>.<lambda>zGot z when unwrapping z.  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©Zreal_unwraprë   r@   Ú_mock_aware_unwrapÜ  s    üz4_patch_unwrap_mock_aware.<locals>._mock_aware_unwrap)ÚinspectÚunwrap)rô   r?   ró   r@   Ú_patch_unwrap_mock_awareÖ  s    ÿ
r÷   c                   @  s   e Zd Zddœdd„ZdS )rP   rÛ   rB   c                 c  sÆ   dd l }G dd„ d|jƒ}z
| j}W n6 tjk
rZ   | j d¡rTtd| j›�ƒ n‚ Y nX | j	j
 | ¡ |ƒ }t| jƒ}td|tƒ t| jƒd�}| ||j¡D ] }|jr tj| |j||d�V  q d S )	Nr   c                      s�   e Zd Zejdd… Zedk pDedkr2ejjdk pDedkoDejjdk ZerV‡ fdd„Zejd	k rrd
dœ‡ fdd„Z	ejdk rˆ‡ fdd„Z
‡  ZS )z5DoctestModule.collect.<locals>.MockAwareDocTestFinderNé   )é   é   rµ   )rù   é   rù   c                   s8   t |tƒrt|d|ƒ}t|dƒr*t |¡}tƒ  ||¡S )a%  On older Pythons, doctest code does not take into account
                    `@property`. https://github.com/python/cpython/issues/61648

                    Moreover, wrapped Doctests need to be unwrapped so the correct
                    line number is returned. #8796
                    ÚfgetÚ__wrapped__)r†   ÚpropertyÚgetattrÚhasattrrõ   rö   rm   Ú_find_lineno)ra   r—   Úsource_linesro   r?   r@   r    s    


þzBDoctestModule.collect.<locals>.MockAwareDocTestFinder._find_lineno)rù   é
   r$   rB   c              
     s:   t |ƒrdS tƒ � tƒ  |||||||¡ W 5 Q R X dS )zÌOverride _find to work around issue in stdlib.

                    https://github.com/pytest-dev/pytest/issues/3456
                    https://github.com/python/cpython/issues/69718
                    N)rè   r÷   rm   Ú_find)ra   Ztestsr—   rV   Úmoduler  r^   Úseenro   r?   r@   r    s          ÿz;DoctestModule.collect.<locals>.MockAwareDocTestFinder._find)rù   é   c                   s    t |tjƒr|j}tƒ  ||¡S )a>  `cached_property` objects are never considered a part
                    of the 'current module'. As such they are skipped by doctest.
                    Here we override `_from_module` to check the underlying
                    function instead. https://github.com/python/cpython/issues/107995
                    )r†   Ú	functoolsÚcached_propertyr•   rm   Ú_from_module)ra   r  ræ   ro   r?   r@   r
  )  s    zBDoctestModule.collect.<locals>.MockAwareDocTestFinder._from_module)rh   ri   rj   rª   Úversion_infoZpy_ver_info_minorÚmicroZis_find_lineno_brokenr  r  r
  rq   r?   r?   ro   r@   ÚMockAwareDocTestFinderø  s   ÿý

r  r9   zunable to import module FrÝ   rÞ   )r‚   ZDocTestFinderr—   r   ZCollectErrorrJ   rÙ   r   rI   r\   r˜   ZparsefactoriesrØ   r�   r¼   rÚ   Úfindrh   rà   r‘   rQ   rV   )ra   r‚   r  r  Úfinderrx   r’   r{   r?   r?   r@   r-   õ  s2    =

ü   ÿzDoctestModule.collectN)rh   ri   rj   r-   r?   r?   r?   r@   rP   ô  s   rP   ztype[doctest.OutputChecker]c                    s*   dd l } dd l‰ G ‡ fdd„d| jƒ}|S )Nr   c                      sf   e Zd Z” d”j¡Z” d”j¡Z” d”j¡Zdddddœ‡ ‡fdd	„Z	dddd
œdd„Z
‡  ZS )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+)
              )
            )
            r;   rt   rU   )Úwantr}   rx   r&   c                   s°   t ƒ  |||¡rdS |tƒ @ }|tƒ @ }|tƒ @ }|sB|sB|sBdS ddddœ‡fdd„}|rt|| j|ƒ}|| j|ƒ}|r�|| j|ƒ}|| j|ƒ}|r |  ||¡}t ƒ  |||¡S )NTFzPattern[str]r;   )ÚregexÚtxtr&   c                   s   ˆ   | d|¡S )Nz\1\2)Úsub)r  r  ©Úrer?   r@   Úremove_prefixes  s    zX_init_checker_class.<locals>.LiteralsOutputChecker.check_output.<locals>.remove_prefixes)rm   Úcheck_outputrÒ   rÓ   rÔ   Ú_unicode_literal_reÚ_bytes_literal_reÚ_remove_unwanted_precision)ra   r  r}   rx   Zallow_unicodeZallow_bytesZallow_numberr  )rp   r  r?   r@   r  t  s"    


z?_init_checker_class.<locals>.LiteralsOutputChecker.check_output)r  r}   r&   c                 S  s  t | j |¡ƒ}t | j |¡ƒ}t|ƒt|ƒkr4|S d}t||ƒD ]Ð\}}| d¡}| d¡}	|	d krp| d¡}	|d kr|dnt|ƒ}
|	d k	r˜|
t|	ƒ8 }
t| ¡ ƒtt| ¡ ƒd|
  d�krB|d | 	¡ | … | ¡  || 
¡ | d …  }|| 
¡ | 	¡  | 
¡ | 	¡   7 }qB|S )Nr   ÚfractionZ	exponent1Z	exponent2r  )Úabs)ÚlistÚ
_number_reÚfinditerÚlenÚzipr>   rt   Úfloatr   ÚstartÚend)ra   r  r}   ZwantsÚgotsÚoffsetÚwÚgr  ÚexponentÚ	precisionr?   r?   r@   r  �  s$    


&.ÿ&zM_init_checker_class.<locals>.LiteralsOutputChecker._remove_unwanted_precision)rh   ri   rj   ÚcompileÚUNICODEr  r  ÚVERBOSEr  r  r  rq   r?   r  ro   r@   ÚLiteralsOutputCheckerV  s   ìr.  )r‚   r  ZOutputChecker)r‚   r.  r?   r  r@   Ú_init_checker_classR  s    Qr/  zdoctest.OutputCheckerc                   C  s   t dkrtƒ a t ƒ 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/  r?   r?   r?   r@   r¼   ª  s    r¼   c                  C  s   ddl } |  d¡S )z+Register and return the ALLOW_UNICODE flag.r   NrÏ   ©r‚   Zregister_optionflagr�   r?   r?   r@   rÒ   ¾  s    rÒ   c                  C  s   ddl } |  d¡S )z)Register and return the ALLOW_BYTES flag.r   NrÐ   r0  r�   r?   r?   r@   rÓ   Å  s    rÓ   c                  C  s   ddl } |  d¡S )z$Register and return the NUMBER flag.r   NrÑ   r0  r�   r?   r?   r@   rÔ   Ì  s    rÔ   r;   )Úkeyr&   c              
   C  s,   ddl }t|jt|jt|jt|jt	di|  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.
    r   N)
r‚   ÚDOCTEST_REPORT_CHOICE_UDIFFZREPORT_UDIFFÚDOCTEST_REPORT_CHOICE_CDIFFZREPORT_CDIFFÚDOCTEST_REPORT_CHOICE_NDIFFZREPORT_NDIFFÚ(DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILUREZREPORT_ONLY_FIRST_FAILUREÚDOCTEST_REPORT_CHOICE_NONE)r1  r‚   r?   r?   r@   r½   Ó  s         ûúr½   r\   )Úscopezdict[str, Any]c                   C  s   t ƒ 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ž   r?   r?   r?   r@   r�   ä  s    r�   )NNr   T)^r‹   Ú
__future__r   r‡   Ú
contextlibr   r  rõ   ÚosÚpathlibr   r¨   rª   rÄ   ÚtypesÚtypingr   r   r   r   r	   r
   r   rð   Z_pytestr   Z_pytest._code.coder   r   r   Z_pytest._ior   Z_pytest.compatr   Z_pytest.configr   Z_pytest.config.argparsingr   Z_pytest.fixturesr   r   Z_pytest.nodesr   r   Z_pytest.outcomesr   r   Z_pytest.pathlibr   Z_pytest.pythonr   Z_pytest.python_apir   Z_pytest.warning_typesr   r‚   Útyping_extensionsr    r6  r3  r4  r2  r5  r=   rD   r#   Ú__annotations__rA   rE   rT   rN   rR   rO   r_   rï   rk   r�   r�   r‘   rÕ   rØ   rÚ   rS   r£   rè   r÷   rP   r/  r¼   rÒ   rÓ   rÔ   r½   r�   r?   r?   r?   r@   Ú<module>   s¬   û	26    ü 	

	^X