o
    Ú­jÝh  ã                   @   s  U d Z ddlZddlZddlZddlZddl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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&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l0m1Z1 ddl0m2Z2 dd l3m4Z4 dd!l3m5Z5 dd"l6m7Z7 dd#l8m9Z9 dd$l:m;Z; erùddl<Z<d%Z=d&Z>d'Z?d(Z@d)ZAe=e>e?e@eAfZBdaCdaDeed*  eEd+< d,e)d-dfd.d/„ZFdwd0d1„ZGd2ed3e.d-eed4  fd5d6„ZHd7ed-eIfd8d9„ZJd:e'd7ed3e.d-eIfd;d<„ZKd7ed-eIfd=d>„ZLG d?d@„ d@e!ƒZMG dAdB„ dBeNƒZOd-edC fdDdE„ZP				FdxdGed* dHeeI dIeQdJeId-dCf
dKdL„ZRG dMdN„ dNe/ƒZSd-eeTeQf fdOdP„ZUdQdR„ ZVdSdT„ ZWG dUdV„ dVe7ƒZXdydYdZ„ZYd[eZd-eIfd\d]„Z[ed-ed^ fd_d`„ƒZ\G dadb„ dbe7ƒZ]dceSd-e,fddde„Z^d-ed* fdfdg„Z_dzdhdi„Z`d-eQfdjdk„Zad-eQfdldm„Zbd-eQfdndo„ZcdpeTd-eQfdqdr„Zde+dsdt�d-eeTef fdudv„ƒZedS ){z4Discover 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)ÚPytestWarningÚnoneÚcdiffÚndiffÚudiffÚonly_first_failureúdoctest.OutputCheckerÚCHECKER_CLASSÚ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)r3   Úcollectz--doctest-modulesÚ
store_trueFzRun doctests in all .py modulesÚdoctestmodules)Úactionr3   ÚhelpÚdestz--doctest-reportr)   z9Choose another output format for diffs on doctest failureÚdoctestreport)r2   r3   r9   Úchoicesr:   z--doctest-globÚappendÚpatz2Doctests file matching pattern, default: test*.txtÚdoctestglob)r8   r3   Úmetavarr9   r:   z--doctest-ignore-import-errorszIgnore 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)ÚaddiniÚgetgroupÚ	addoptionÚstrÚlowerÚDOCTEST_REPORT_CHOICES)r-   Úgroup© rJ   úL/var/www/html/CropPilot/venv/lib/python3.10/site-packages/_pytest/doctest.pyÚpytest_addoptionF   s^   üÿ
ûúúû
ûrL   c                   C   s   d a d S ©N)ÚRUNNER_CLASSrJ   rJ   rJ   rK   Úpytest_unconfigurex   s   rO   Ú	file_pathÚparent)ÚDoctestModuleÚDoctestTextfilec                 C   sd   |j }| jdkr!|jjrtt| ƒt| ƒfƒstj|| d�}|S d S t	|| |ƒr0t
j|| d�}|S d S )Nz.py©Úpath)ÚconfigÚsuffixÚoptionr7   ÚanyÚ_is_setup_pyÚ_is_main_pyrR   Úfrom_parentÚ_is_doctestrS   )rP   rQ   rV   ÚmodÚtxtrJ   rJ   rK   Úpytest_collect_file~   s   

ÿýr`   rU   c                 C   s&   | j dkrdS |  ¡ }d|v pd|v S )Nzsetup.pyFs
   setuptoolss	   distutils)ÚnameÚ
read_bytes)rU   ÚcontentsrJ   rJ   rK   rZ   �   s   
rZ   rV   c                    s@   ˆ j dv r|j ˆ ¡rdS |  d¡pdg}t‡ fdd„|D ƒƒS )N)z.txtz.rstTr?   z	test*.txtc                 3   s   � | ]}t |ˆ ƒV  qd S rM   r    )Ú.0ÚglobrT   rJ   rK   Ú	<genexpr>š   s   € z_is_doctest.<locals>.<genexpr>)rW   ÚsessionÚ
isinitpathÚ	getoptionrY   )rV   rU   rQ   ÚglobsrJ   rT   rK   r]   –   s   r]   c                 C   s
   | j dkS )Nz__main__.py)ra   rT   rJ   rJ   rK   r[   �   s   
r[   c                   @   s@   e Zd Zdeeeee f  ddfdd„Zdeddfdd„Z	dS )	ÚReprFailDoctestÚreprlocation_linesr.   Nc                 C   s
   || _ d S rM   )rl   )Úselfrl   rJ   rJ   rK   Ú__init__¢   s   
zReprFailDoctest.__init__Útwc                 C   s2   | j D ]\}}|D ]}| |¡ q	| |¡ qd S rM   )rl   ÚlineÚ
toterminal)rm   ro   ÚreprlocationÚlinesrp   rJ   rJ   rK   rq   §   s
   ýzReprFailDoctest.toterminal)
Ú__name__Ú
__module__Ú__qualname__r   r   r   rF   rn   r   rq   rJ   rJ   rJ   rK   rk   ¡   s    ÿ
þrk   c                       s*   e Zd Zded ddf‡ fdd„Z‡  ZS )ÚMultipleDoctestFailuresÚfailureszdoctest.DocTestFailurer.   Nc                    s   t ƒ  ¡  || _d S rM   )Úsuperrn   rx   ©rm   rx   ©Ú	__class__rJ   rK   rn   ¯   s   

z MultipleDoctestFailures.__init__)rt   ru   rv   r   rn   Ú__classcell__rJ   rJ   r{   rK   rw   ®   s    "rw   údoctest.DocTestRunnerc                     s"   dd l ‰ G ‡ fdd„dˆ jƒ} | S )Nr   c                       s”   e Zd ZdZ				dded dee ded	ed
df
‡ fdd„Zddddded
df‡fdd„Z	ddddde
ee eejf d
df‡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Úcheckerr+   ÚverboseÚoptionflagsÚcontinue_on_failurer.   c                    s   t ƒ j|||d� || _d S )N)r   r€   r�   )ry   rn   r‚   )rm   r   r€   r�   r‚   r{   rJ   rK   rn   ¾   s   
z8_init_runner_class.<locals>.PytestDoctestRunner.__init__Útestúdoctest.DocTestÚexamplezdoctest.ExampleÚgotc                    s&   ˆ   |||¡}| jr| |¡ d S |‚rM   )ÚDocTestFailurer‚   r=   )rm   Úoutrƒ   r…   r†   Úfailure©ÚdoctestrJ   rK   Úreport_failureÈ   s   z>_init_runner_class.<locals>.PytestDoctestRunner.report_failureÚexc_infoc                    sV   t |d tƒr|d ‚t |d tjƒrt d¡ ˆ  |||¡}| jr)| |¡ d S |‚)Né   zQuitting debugger)	Ú
isinstancer   ÚbdbÚBdbQuitr   ÚexitÚUnexpectedExceptionr‚   r=   )rm   rˆ   rƒ   r…   r�   r‰   rŠ   rJ   rK   Úreport_unexpected_exceptionÕ   s   
zK_init_runner_class.<locals>.PytestDoctestRunner.report_unexpected_exception©NNr   T)rt   ru   rv   Ú__doc__r
   ÚboolÚintrn   rF   rŒ   r   r   ÚBaseExceptionÚtypesÚTracebackTyper”   r}   rJ   rŠ   r{   rK   ÚPytestDoctestRunner·   sF    ûþýüûú
ýüûúýüûúrœ   )r‹   ÚDebugRunner)rœ   rJ   rŠ   rK   Ú_init_runner_class´   s   /rž   Tr   r€   r�   r‚   c                 C   s   t d u rtƒ a t | |||d�S )N©r   r€   r�   r‚   )rN   rž   rŸ   rJ   rJ   rK   Ú_get_runneré   s   ür    c                       sÆ   e Zd Z		ddeddded ded d	df
‡ fd
d„Zedddeddddf‡ fdd„ƒZddd„Zddd„Z	ddd„Z
dee d	eeef f‡ fdd„Zd	eedef ee ef fdd„Z‡  ZS )ÚDoctestItemNra   rQ   z%Union[DoctestTextfile, DoctestModule]Úrunnerr~   Údtestr„   r.   c                    s*   t ƒ  ||¡ || _|| _d | _d | _d S rM   )ry   rn   r¢   r£   ÚobjÚfixture_request)rm   ra   rQ   r¢   r£   r{   rJ   rK   rn   þ   s
   
zDoctestItem.__init__c                   s   t ƒ j||||d�S )zThe public named constructor.)ra   rQ   r¢   r£   )ry   r\   )ÚclsrQ   ra   r¢   r£   r{   rJ   rK   r\     s   zDoctestItem.from_parentc                 C   sZ   | j d ur+t| ƒ| _t| jjd�}| j d¡ ¡ D ]\}}|||< q| j j |¡ d S d S )N)Ú
getfixtureÚdoctest_namespace)r£   Ú_setup_fixturesr¥   ÚdictÚgetfixturevalueÚitemsrj   Úupdate)rm   rj   ra   ÚvaluerJ   rJ   rK   Úsetup  s   

ÿ
þ
ùzDoctestItem.setupc                 C   sT   | j d usJ ‚| jd usJ ‚t| j ƒ |  ¡  g }| jj| j |d� |r(t|ƒ‚d S )N)rˆ   )r£   r¢   Ú_check_all_skippedÚ$_disable_output_capturing_for_darwinÚrunrw   rz   rJ   rJ   rK   Úruntest"  s   
ÿzDoctestItem.runtestc                 C   sZ   t  ¡ dkrdS | jj d¡}|r+|jdd� | ¡ \}}tj 	|¡ tj
 	|¡ dS dS )zFDisable output capturing. Otherwise, stdout is lost to doctest (#985).ÚDarwinNÚcapturemanagerT)Úin_)ÚplatformÚsystemrV   ÚpluginmanagerÚ	getpluginÚsuspend_global_captureÚread_global_captureÚsysÚstdoutÚwriteÚstderr)rm   Úcapmanrˆ   ÚerrrJ   rJ   rK   r±   .  s   üz0DoctestItem._disable_output_capturing_for_darwinÚexcinfoc                    sÔ  dd l }d }t|j|j|jfƒr|jg}n
t|jtƒr|jj}|d u r)tƒ  |¡S g }|D ]¸}|j	}|j
‰ ˆ j}ˆ jd u r@d }nˆ j|j d }t|ƒj}	t|||	ƒ}
tƒ }t| j d¡ƒ}|d ur“|j
jd usjJ ‚|j
j d¡}ˆ jd usxJ ‚‡ fdd„t|ƒD ƒ}|t|jd dƒ|jd … }ndg}d	}|j ¡ D ]}| d
|› d|› �¡ d}q�t||jƒrÁ|| ||j|¡ d¡7 }nt |j¡}|dt |jƒ g7 }|dd„ t!j"|jŽ D ƒ7 }| |
|f¡ q-t#|ƒS )Nr   rŽ   r;   Fc                    s&   g | ]\}}d |ˆ j  d |f ‘qS )z%03d %srŽ   )Úlineno)rd   ÚiÚx©rƒ   rJ   rK   Ú
<listcomp>`  s    ÿz,DoctestItem.repr_failure.<locals>.<listcomp>é	   z?EXAMPLE LOCATION UNKNOWN, not showing all tests of that examplez>>>z??? ú z...Ú
zUNEXPECTED EXCEPTION: %sc                 S   s   g | ]}|  d ¡‘qS )rË   )Ústrip©rd   rÆ   rJ   rJ   rK   rÈ   t  s    
ÿ)$r‹   r�   r®   r‡   r“   rw   rx   ry   Úrepr_failurer…   rƒ   ÚfilenamerÄ   r2   rt   r   Ú_get_checkerÚ_get_report_choicerV   ri   Ú	docstringÚ
splitlinesÚ	enumerateÚmaxÚsourcer=   Úoutput_differencer†   Úsplitr   Úfrom_exc_infor�   ÚreprÚ	tracebackÚformat_exceptionrk   )rm   rÃ   r‹   rx   rl   r‰   r…   rÏ   rÄ   Úmessagerr   r   Úreport_choicers   Úindentrp   Úinner_excinfor{   rÇ   rK   rÎ   :  sd   þÿ



ÿ ÿÿþ
ÿzDoctestItem.repr_failurezos.PathLike[str]c                 C   s$   | j d usJ ‚| j| j jd| j fS )Nz[doctest] %s)r£   rU   rÄ   ra   )rm   rJ   rJ   rK   Ú
reportinfoz  s   zDoctestItem.reportinfo)NN©r.   N)rt   ru   rv   rF   r
   rn   Úclassmethodr\   r¯   r³   r±   r   r™   r   r   rÎ   r   r˜   rá   r}   rJ   rJ   r{   rK   r¡   ý   sB    ûþýüûúþüûú



þ
ý,@r¡   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_WHITESPACEr1   ÚIGNORE_EXCEPTION_DETAILÚCOMPARISON_FLAGSÚALLOW_UNICODEÚALLOW_BYTESÚNUMBER)r‹   rª   rä   rå   ræ   r1   rç   rè   Ú_get_allow_unicode_flagÚ_get_allow_bytes_flagÚ_get_number_flagrŠ   rJ   rJ   rK   Ú_get_flag_lookup  s   ÷rï   c                 C   s0   | j  d¡}tƒ }d}|D ]}||| O }q|S )Nr/   r   )rV   Úgetinirï   )rQ   Úoptionflags_strÚflag_lookup_tableÚflag_accÚflagrJ   rJ   rK   Úget_optionflags�  s   rõ   c                 C   s    |   d¡}|r|   d¡rd}|S )NrB   ÚusepdbF)Úgetvalue)rV   r‚   rJ   rJ   rK   Ú_get_continue_on_failure˜  s
   

rø   c                   @   s"   e Zd ZdZdee fdd„ZdS )rS   Nr.   c                 c   sš   � dd l }| j d¡}| j |¡}t| jƒ}| jj}ddi}t| ƒ}td|t	ƒ t
| jƒd�}| ¡ }	|	 ||||d¡}
|
jrKtj| |
j||
d�V  d S d S )Nr   r4   rt   Ú__main__F©r€   r�   r   r‚   ©ra   r¢   r£   )r‹   rV   rð   rU   Ú	read_textrF   ra   rõ   r    rÐ   rø   ÚDocTestParserÚget_doctestÚexamplesr¡   r\   )rm   r‹   ÚencodingÚtextrÏ   ra   rj   r�   r¢   r-   rƒ   rJ   rJ   rK   r5   ¥  s*   €
ü
ÿÿzDoctestTextfile.collect)rt   ru   rv   r¤   r   r¡   r5   rJ   rJ   rJ   rK   rS   ¢  s    rS   rƒ   r„   c                    s4   ddl ‰ t‡ fdd„| jD ƒƒ}|rtdƒ dS 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ÚgetÚSKIPrÍ   rŠ   rJ   rK   rf   Æ  s   € z%_check_all_skipped.<locals>.<genexpr>z!all tests skipped by +SKIP option)r‹   Úallrÿ   r   )rƒ   Úall_skippedrJ   rŠ   rK   r°   Á  s
   ÿr°   r¤   c                 C   s   t | ddƒduS )zmReturn if an object is possibly a mock object by checking the
    existence of a highly improbable attribute.Ú1pytest_mock_example_attribute_that_shouldnt_existNr   ©r¤   rJ   rJ   rK   Ú
_is_mockedË  s   
ÿÿr	  )NNNc                  #   s`   � t j‰ ddœdtdtf dtttgtf  dtf‡ fdd„} | t _z	dV  W ˆ t _dS ˆ t _w )	z€Context manager which replaces ``inspect.unwrap`` with a version
    that's aware of mock objects and doesn't recurse into them.N©ÚstopÚfunc.r  r.   c             
      sj   z|d u s	|t u rˆˆt d�W S |‰ ˆˆ‡ ‡fdd„d�W S  ty4 } zt d|ˆf t¡ ‚ d }~ww )Nr
  c                    s   t | ƒpˆ ˆƒS rM   )r	  r  ©Ú_stopr  rJ   rK   Ú<lambda>á  s    zF_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©Úreal_unwrapr  rK   Ú_mock_aware_unwrapÚ  s   þü€ùz4_patch_unwrap_mock_aware.<locals>._mock_aware_unwrap)ÚinspectÚunwrapr   r   r
   )r  rJ   r  rK   Ú_patch_unwrap_mock_awareÔ  s   €ÿ
ÿÿþr  c                   @   s   e Zd Zdee fdd„ZdS )rR   r.   c                 c   sø   � dd l }G dd„ d|jƒ}| jjdkr&| jjj| j| j d¡| jjd�}n)zt	| j| jj| j d¡d�}W n t
yN   | j d¡rKtd	| j ƒ n‚ Y nw |ƒ }t| ƒ}td
|tƒ t| jƒd�}| ||j¡D ]}|jrytj| |j||d�V  qid S )Nr   c                       sR   e Zd ZdZ‡ fdd„Z		d‡ fdd„Zejdk r$‡ fd	d
„Z‡  Z	S 	 ‡  Z	S )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
            c                    s8   t |tƒrt|d|ƒ}t|dƒrt |¡}tƒ  ||¡S )a3  Doctest 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  ry   Ú_find_lineno)rm   r¤   Úsource_linesr{   rJ   rK   r  ý  s   


þzBDoctestModule.collect.<locals>.MockAwareDocTestFinder._find_linenor.   Nc              
      sP   t |ƒrd S tƒ � tƒ  |||||||¡ W d   ƒ d S 1 s!w   Y  d S rM   )r	  r  ry   Ú_find)rm   Útestsr¤   ra   Úmoduler   rj   Úseenr{   rJ   rK   r!    s   ÿ"þz;DoctestModule.collect.<locals>.MockAwareDocTestFinder._find)é   é   c                    s*   t tdƒr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
                    Úcached_property)r  Ú	functoolsr�   r'  r  ry   Ú_from_module)rm   r#  Úobjectr{   rJ   rK   r)    s
   ÿzBDoctestModule.collect.<locals>.MockAwareDocTestFinder._from_modulerâ   )
rt   ru   rv   r–   r  r!  r½   Úversion_infor)  r}   rJ   rJ   r{   rK   ÚMockAwareDocTestFinderö  s    þ

r,  zconftest.pyÚ
importmode)Úrootpath)ÚrootÚmoderA   zunable to import module %rFrú   rû   )r‹   ÚDocTestFinderrU   ra   rV   r¹   Ú_importconftestri   r.  r"   ÚImportErrorr÷   r   rõ   r    rÐ   rø   Úfindrt   rÿ   r¡   r\   )rm   r‹   r,  r#  Úfinderr�   r¢   rƒ   rJ   rJ   rK   r5   ó  sH   €9
ý

ýþþü
ÿ€þzDoctestModule.collectN)rt   ru   rv   r   r¡   r5   rJ   rJ   rJ   rK   rR   ò  s    rR   Údoctest_itemc                 C   sD   d	dd„}i | _ | jj}|j| |ddd�| _t| dd�}| ¡  |S )
zEUsed by DoctestTextfile and DoctestItem to setup fixture information.r.   Nc                   S   s   d S rM   rJ   rJ   rJ   rJ   rK   r  U  s   z_setup_fixtures.<locals>.funcF)Únoder  r¦   ÚfuncargsT)Ú	_ispytestrâ   )r8  rg   Ú_fixturemanagerÚgetfixtureinfoÚ_fixtureinfor   Ú_fillfixtures)r6  r  Úfmr¥   rJ   rJ   rK   r©   R  s   
ÿr©   c                     s*   dd l } dd l‰ G ‡ fdd„d| jƒ}|S )Nr   c                       sp   e Zd Z” d”j¡Z” d”j¡Z” d”j¡Zde	de	de
def‡ ‡fdd	„Zde	de	de	f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+)
              )
            )
            Úwantr†   r�   r.   c                    s¸   t ƒ  |||¡r
dS |tƒ @ }|tƒ @ }|tƒ @ }|s!|s!|s!dS dtt dtdtf‡fdd„}|r>|| j|ƒ}|| j|ƒ}|rL|| j|ƒ}|| j|ƒ}|rT|  	||¡}t ƒ  |||¡S )NTFÚregexr_   r.   c                    s   ˆ   | d|¡S )Nz\1\2)Úsub)r@  r_   ©ÚrerJ   rK   Úremove_prefixes�  s   zX_init_checker_class.<locals>.LiteralsOutputChecker.check_output.<locals>.remove_prefixes)
ry   Úcheck_outputrì   rí   rî   r   rF   Ú_unicode_literal_reÚ_bytes_literal_reÚ_remove_unwanted_precision)rm   r?  r†   r�   Úallow_unicodeÚallow_bytesÚallow_numberrD  )r|   rC  rJ   rK   rE  „  s"   


z?_init_checker_class.<locals>.LiteralsOutputChecker.check_outputc                 S   s  t | j |¡ƒ}t | j |¡ƒ}t|ƒt|ƒkr|S d}t||ƒD ]h\}}| d¡}| d¡}	|	d u r8| d¡}	|d u r>dnt|ƒ}
|	d urL|
t|	ƒ8 }
t| ¡ ƒtt| ¡ ƒd|
  d�kr‰|d | 	¡ | … | ¡  || 
¡ | d …  }|| 
¡ | 	¡  | 
¡ | 	¡   7 }q!|S )Nr   ÚfractionÚ	exponent1Ú	exponent2é
   )Úabs)ÚlistÚ
_number_reÚfinditerÚlenÚziprI   r˜   Úfloatr$   ÚstartÚend)rm   r?  r†   ÚwantsÚgotsÚoffsetÚwÚgrL  ÚexponentÚ	precisionrJ   rJ   rK   rH  Ÿ  s&   


&.ÿ$€zM_init_checker_class.<locals>.LiteralsOutputChecker._remove_unwanted_precision)rt   ru   rv   ÚcompileÚUNICODErF  rG  ÚVERBOSErR  rF   r˜   r—   rE  rH  r}   rJ   rB  r{   rK   ÚLiteralsOutputCheckerf  s    ì rc  )r‹   rC  ÚOutputChecker)r‹   rc  rJ   rB  rK   Ú_init_checker_classb  s   Qre  c                   C   s   t du 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,   re  rJ   rJ   rJ   rK   rÐ   º  s   rÐ   c                  C   ó   ddl } |  d¡S )z+Register and return the ALLOW_UNICODE flag.r   Nré   ©r‹   Úregister_optionflagrŠ   rJ   rJ   rK   rì   Î  ó   
rì   c                  C   rf  )z)Register and return the ALLOW_BYTES flag.r   Nrê   rg  rŠ   rJ   rJ   rK   rí   Õ  ri  rí   c                  C   rf  )z$Register and return the NUMBER flag.r   Nrë   rg  rŠ   rJ   rJ   rK   rî   Ü  ri  rî   Úkeyc              
   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_UDIFFÚREPORT_UDIFFÚDOCTEST_REPORT_CHOICE_CDIFFÚREPORT_CDIFFÚDOCTEST_REPORT_CHOICE_NDIFFÚREPORT_NDIFFÚ(DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILUREÚREPORT_ONLY_FIRST_FAILUREÚDOCTEST_REPORT_CHOICE_NONE)rj  r‹   rJ   rJ   rK   rÑ   ã  s   ûúrÑ   rg   )Úscopec                   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ª   rJ   rJ   rJ   rK   r¨   ô  s   r¨   râ   r•   )rƒ   r„   r.   N)r.   r+   )fr–   r�   r(  r  Úosr·   r½   rÛ   rš   r  Ú
contextlibr   Úpathlibr   Útypingr   r   r   r   r   r	   r
   r   r   r   r   r   r   Ú_pytestr   Ú_pytest._code.coder   r   r   Ú_pytest._ior   Ú_pytest.compatr   Ú_pytest.configr   Ú_pytest.config.argparsingr   Ú_pytest.fixturesr   r   Ú_pytest.nodesr   r   Ú_pytest.outcomesr   r   Ú_pytest.pathlibr!   r"   Ú_pytest.pythonr#   Ú_pytest.python_apir$   Ú_pytest.warning_typesr%   r‹   rs  rm  ro  rk  rq  rH   rN   r,   Ú__annotations__rL   rO   r`   r—   rZ   r]   r[   rk   r  rw   rž   r˜   r    r¡   rF   rï   rõ   rø   rS   r°   r*  r	  r  rR   r©   re  rÐ   rì   rí   rî   rÑ   r¨   rJ   rJ   rJ   rK   Ú<module>   sÚ    û	
2ÿþ

ý6üÿþýü
û 	


	`
X