+
    ^|izu                     t  a RT tn0 t R t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIHt ^ RIHt ^ RIHtHtHtHtHtHtHtHt ^ RIHt ^ RIHtHtHtHt ^ RIt^ RI H!t! ^ RI"H#t#H$t$H%t% ^ R	I&H't' ^ R
I(H)t) ^ RI*H+t+ ^ RI,H-t-  ^ RI.H/t0 ^ RI2H3t3 ^ RI4H5t5 ^ RI6H7t7H8t8 ^ RI9H:t: ^ RI;H<t< ]'       d   ^ RI=t=^RI>H?t? Rt@RtARtBRtCRtD]@]A]B]C]D3tERsFRsG] ^ k ]H! ]P                  P                  R4       U u. uF  p ]K! V 4      NK  	  up 4      tLR R ltMR R ltNR R  ltO]L^ ,          ^8  d   ]OtPR! R" ltO]8tQR# t8R$ R% ltRR& R' ltSR( R) ltT ! R* R+]%4      tU ! R, R-]V4      tWR. R/ ltXRUR0 R1 lltY ! R2 R3]P                  4      t[R4 R5 lt\R6 t]R7 t^ ! R8 R9]P                  4      t`R: R; ltaR< R= ltb]R> R? l4       tc ! R@ RA]P                  4      tdRB RC lteRD RE ltfRF RG ltgRH RI lthRJ RK ltiRL RM ltjRN RO ltk]P                  ! RPRQ7      RR RS l4       tmR#   ]1 d    ^ RI.H0t0  ELi ; iu up i )Vz6Discover and run ipdoctests in modules and test files.N)contextmanagerPath)TYPE_CHECKINGAnyDictListOptionalTupleTypeUnion)Pattern)Callable	GeneratorIterableSequence)outcomes)ExceptionInfoReprFileLocationTerminalReprTerminalWritersafe_getattr)ConfigParser)
TopRequest)FixtureRequest)	Collector)OutcomeException)
fnmatch_eximport_path)approx)PytestWarningIPDoctestOutputCheckernonecdiffndiffudiffonly_first_failure.c                (    V ^8  d   QhR\         RR/# )   parserreturnNr   )formats   "I/usr/lib/python3/dist-packages/IPython/testing/plugin/pytest_ipdoctest.py__annotate__r3   M   s     / /V / /    c           	         V P                  R RRR.R7       V P                  RRRR7       V P                  R	4      pVP                  R
RRRRR7       VP                  R\        P                  RR\
        RR7       VP                  RR. RRRR7       VP                  RRRRRR7       VP                  RRRRR R7       R!# )"ipdoctest_optionflagszoption flags for ipdoctestsargsELLIPSIS)typedefaultipdoctest_encodingz!encoding used for ipdoctest fileszutf-8)r:   collectz--ipdoctest-modules
store_trueFz!run ipdoctests in all .py modulesipdoctestmodules)actionr:   helpdestz--ipdoctest-reportr*   z;choose another output format for diffs on ipdoctest failureipdoctestreport)r9   r:   r@   choicesrA   z--ipdoctest-globappendpatz4ipdoctests file matching pattern, default: test*.txtipdoctestglob)r?   r:   metavarr@   rA   z --ipdoctest-ignore-import-errorszignore ipdoctest ImportErrorsipdoctest_ignore_import_errorsz--ipdoctest-continue-on-failurez>for a given ipdoctest, continue to run after the first failureipdoctest_continue_on_failureN)addinigetgroup	addoptionstrlowerDOCTEST_REPORT_CHOICES)r/   groups   & r2   pytest_addoptionrQ   M   s    
MM%	   MMA7   OOI&E	OO0   
OOYYJ&   
OOC   
OO*,-   
OO)M,  r4   c                    V ^8  d   QhRR/# r.   r0   N )r1   s   "r2   r3   r3      s      D r4   c                  
    R s R # N)RUNNER_CLASSrT   r4   r2   pytest_unconfigurerX      s	     Lr4   c                `    V ^8  d   QhR\         R\        R\        \        R,          ,          /# )r.   	file_pathparentr0   IPDoctestModuleIPDoctestTextfile)r   r   r	   r   )r1   s   "r2   r3   r3      s1       e:;<r4   c                 J   VP                   pV P                  R 8X  d\   VP                  P                  '       d>   \	        \        V 4      \        V 4      34      '       g   \        P                  WR7      pV# R# \        W V4      '       d   \        P                  WR7      pV# R# )z.pypathN)configsuffixoptionr>   any_is_setup_py_is_main_pyr]   from_parent_is_ipdoctestr^   )rZ   r[   rb   modtxts   &&   r2   pytest_collect_filerl      s     ]]F5 ==)))#)$k)&<=3
 3
 $3#>#>v#>#VCJ  
v&	1	1!2!>!>v!>!V
r4   c                T    V ^8  d   QhR\         R\        \        R,          ,          /# )r.   r[   r0   r\   )r   r	   r   )r1   s   "r2   r3   r3      s)     1 11 
%>?	@1r4   c                 ,    \        \        V 4      V4      # rV   )_collect_filer   )ra   r[   s   &&r2   rl   rl      s     T$Z00r4   c                 R    ^ RI p\        VP                  P                  V 4      4      # )    N)py.path_import_pathra   local)ra   rootpys   && r2   r"   r"      s    BGGMM$/00r4   c                0    V ^8  d   QhR\         R\        /# r.   ra   r0   r   bool)r1   s   "r2   r3   r3      s     A At A Ar4   c                 l    V P                   R 8w  d   R# V P                  4       pRV9   ;'       g    RV9   # )zsetup.pyFs
   setuptoolss	   distutils)name
read_bytes)ra   contentss   & r2   rf   rf      s5    yyJ HH$@@(@@r4   c                H    V ^8  d   QhR\         R\        R\        R\        /# )r.   rb   ra   r[   r0   )r   r   r   rz   )r1   s   "r2   r3   r3      s(     9 9& 9 9i 9D 9r4   c                   a SP                   R9   d$   VP                  P                  S4      '       d   R# V P                  R4      ;'       g    R.p\        ;QJ d    V3R lV 4       F  '       g   K   R# 	  R# ! V3R lV 4       4      # ).txtTrF   z	test*.txtc              3   <   <"   T F  p\        VS4      x  K  	  R # 5irV   )r!   ).0globra   s   & r2   	<genexpr> _is_ipdoctest.<locals>.<genexpr>   s     8%$z$%%%s   F)r   z.rst)rc   session
isinitpath	getoptionre   )rb   ra   r[   globss   &f& r2   ri   ri      sj    {{&&6>>+D+DT+J+J_->>+E38%83383838%888r4   c                0    V ^8  d   QhR\         R\        /# rx   ry   )r1   s   "r2   r3   r3      s     & &d &t &r4   c                      V P                   R 8H  # )z__main__.py)r|   r`   s   &r2   rg   rg      s    99%%r4   c                   D   a  ] tR t^t o V 3R lR ltV 3R lR ltRtV tR# )ReprFailDoctestc                Z   < V ^8  d   QhRS[ S[S[S[ S[,          3,          ,          RR/# )r.   reprlocation_linesr0   N)r   r
   r   rM   )r1   __classdict__s   "r2   r3   ReprFailDoctest.__annotate__   s1     5 5"*51A8C=1P+Q"R5	5r4   c                    Wn         R # rV   r   )selfr   s   &&r2   __init__ReprFailDoctest.__init__   s
     #5r4   c                $   < V ^8  d   QhRS[ RR/# )r.   twr0   Nr   )r1   r   s   "r2   r3   r      s     ( (^ ( (r4   c                    V P                    F0  w  r#V F  pVP                  V4       K  	  VP                  V4       K2  	  R # rV   )r   line
toterminal)r   r   reprlocationlinesr   s   &&   r2   r   ReprFailDoctest.toterminal   s8    #'#:#:L ##B' $;r4   r   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes____classdictcell__)r   s   @r2   r   r      s     5 5
( (r4   r   c                   >   a a ] tR t^t oV3R lV 3R lltRtVtV ;t# )MultipleDoctestFailuresc                2   < V ^8  d   QhRS[ R,          RR/# )r.   failureszdoctest.DocTestFailurer0   N)r   )r1   r   s   "r2   r3   $MultipleDoctestFailures.__annotate__   s!     ! !*B!C ! !r4   c                0   < \         SV `  4        Wn        R # rV   )superr   r   )r   r   	__class__s   &&r2   r    MultipleDoctestFailures.__init__   s     r4   )r   )r   r   r   r   r   r   r   __classcell__r   r   s   @@r2   r   r      s     ! ! !r4   r   c                2    V ^8  d   QhR\         R,          /# )r.   r0   IPDocTestRunnerr   )r1   s   "r2   r3   r3      s     3 3D!23 3r4   c                  8   a ^ RI o^RIHp   ! V3R lRV 4      pV# )rq   N)r   c                   x   <a a ] tR t^t oRtR	V3R lV 3R llltV3R lV3R lltV3R lV3R lltRtVt	V ;t
# )
/_init_runner_class.<locals>.PytestDoctestRunnerzpRunner to collect failures.

Note that the out variable in this case is a list instead of a
stdout-like object.
c          
      T   < V ^8  d   QhRS[ R,          RS[ S[,          RS[RS[RR/# )r.   checkerr&   verboseoptionflagscontinue_on_failurer0   Nr	   rz   int)r1   r   s   "r2   r3   <_init_runner_class.<locals>.PytestDoctestRunner.__annotate__   sG     	; 	;67	; d^	; 		;
 "&	; 	;r4   c                6   < \         SV `  WVR 7       W@n        R# ))r   r   r   N)r   r   r   )r   r   r   r   r   r   s   &&&&&r2   r   8_init_runner_class.<locals>.PytestDoctestRunner.__init__   s     GW;W':$r4   c                ,   < V ^8  d   QhRRRRRS[ RR/# )r.   testdoctest.DocTestexampledoctest.Examplegotr0   NrM   )r1   r   s   "r2   r3   r      s5     	 	 $	 '		
 	 	r4   c                x   < SP                   ! W#V4      pV P                  '       d   VP                  V4       R # VhrV   )DocTestFailurer   rD   )r   outr   r   r   failuredoctests   &&&&& r2   report_failure>_init_runner_class.<locals>.PytestDoctestRunner.report_failure   s4     ,,TC@G'''

7#r4   c          	      j   < V ^8  d   QhRRRRRS[ S[S[,          S[S[P                  3,          RR/# )r.   r   r   r   r   exc_infor0   N)r
   r   BaseExceptiontypesTracebackType)r1   r   s   "r2   r3   r      sL     	 	 $	 '		
 D/@S@SST	 	r4   c                >  < \        V^,          \        4      '       d
   V^,          h\        V^,          \        P                  4      '       d   \        P
                  ! R4       SP                  ! W#V4      pV P                  '       d   VP                  V4       R# Vh)   zQuitting debuggerN)	
isinstancer    bdbBdbQuitr   exitUnexpectedExceptionr   rD   )r   r   r   r   r   r   r   s   &&&&& r2   report_unexpected_exceptionK_init_runner_class.<locals>.PytestDoctestRunner.report_unexpected_exception   sr     (1+'788qk!(1+s{{331211$JG'''

7#r4   )r   NNrq   T)r   r   r   r   __doc__r   r   r   r   r   r   )r   r   r   s   @@r2   PytestDoctestRunnerr      s-     		; 	;	 		 	 	r4   r   )r   	ipdoctestr   )r   r   r   s     @r2   _init_runner_classr      s    *-o -^ r4   c          
      p    V ^8  d   QhR\         R,          R\         \        ,          R\        R\        RR/# )r.   r   r&   r   r   r   r0   r   r   )r1   s   "r2   r3   r3     sD      ./d^  	
 r4   c                 D    \         f   \        4       s \        V VVVR7      # )Nr   r   r   r   )rW   r   r   s   &&&&r2   _get_runnerr     s-     )+ /	 r4   c                     a a ] tR tRt oRV3R lV 3R lllt]V3R lV 3R ll4       tV3R lR ltV3R lR	 ltV3R
 lR lt	V3R lR lt
V3R lV 3R lltV3R lR lt]^ ,          ^8  d   ]V3R lR l4       tV3R ltRtVtV ;t# )IPDoctestItemi  c          
      P   < V ^8  d   QhRS[ RRRS[R,          RS[R,          RR	/# )
r.   r|   r[   )Union[IPDoctestTextfile, IPDoctestModule]runnerr   dtestr   r0   N)rM   r	   )r1   r   s   "r2   r3   IPDoctestItem.__annotate__  sI          <  *+	 
 )*  
 r4   c                h   < \         SV `  W4       W0n        W@n        R V n        R V n        / V n        R # rV   )r   r   r   r   objfixture_request_user_ns_orig)r   r|   r[   r   r   r   s   &&&&&r2   r   IPDoctestItem.__init__  s3     	&
9=r4   c                ,   < V ^8  d   QhRRRS[ RRRR/# )r.   r[   r   r|   r   r   r   r   r   )r1   r   s   "r2   r3   r   (  s9     
Y 
Y;
Y 	
Y
 "
Y !
Yr4   c               &   < \         SV `  W!W4R7      # )zThe public named constructor.)r|   r[   r   r   )r   rh   )clsr[   r|   r   r   r   s   &&$$$r2   rh   IPDoctestItem.from_parent'  s     w"F"XXr4   c                   < V ^8  d   QhRR/# rS   rT   )r1   r   s   "r2   r3   r   4  s     / /t /r4   c                   V P                   Ee|   \        V 4      V n        \        V P                  P                  R7      pV P                  P	                  R4      P                  4        F	  w  r#W1V&   K  	  V P                   P                  P                  V4       ^RIH	p \        V P                   P                  ^ ,          V4      '       d   / V n        V P                  P                  \        P                  4       \        P                  P                  V P                   P                  4       \        P                  P                  RR 4       \         \        P                  R&   \        P                  V P                   n        R # R # R # )N)
getfixtureipdoctest_namespace	IPExample___builtins__)r   _setup_fixturesr   dictgetfixturevalueitemsr   updater   r   r   examplesr   _ipuser_nspopbuiltins)r   r   r|   valuer   s   &    r2   setupIPDoctestItem.setup4  s   ::!#24#8D D$8$8$H$HIE#33CC% eg  $d  JJ##E*,$**--a0)<< &("""))#++6""4::#3#34 T*.6N+#&;;

  = "r4   c                   < V ^8  d   QhRR/# rS   rT   )r1   r   s   "r2   r3   r   M  s     
! 
!$ 
!r4   c                h   ^RI Hp \        V P                  P                  ^ ,          V4      '       d[   / V P                  n        \        P                  P                  4        \        P                  P                  V P                  4       V =
V P                  P
                  P                  4        R# )r   r   N)r   r   r   r   r  r   r  r  clearr  r   )r   r   s   & r2   teardownIPDoctestItem.teardownM  ss    ( djj))!,i88!DJJKKKKt112"

 r4   c                   < V ^8  d   QhRR/# rS   rT   )r1   r   s   "r2   r3   r   Y  s     4 4 4r4   c                0   V P                   f   Q hV P                  f   Q h\        V P                   4       V P                  4        . p\	        \
        R4      p\        \
        RR 4      p\        P                  ! 4       p\        P                  ! V P                  P                  4        V P                  P                  V P                   VRR7       \        P                  ! V4       V'       d   \        \
        RV4       M&\	        \
        R4      '       d   \        \
        R4       V'       d   \        V4      hR #   \        P                  ! T4       T'       d   \        \
        RT4       i \	        \
        R4      '       d   \        \
        R4       i i ; i)Nr   F)r   clear_globs)r   r   _check_all_skipped$_disable_output_capturing_for_darwinhasattrr  getattrosgetcwdchdirfspathdirnamerunsetattrdelattrr   )r   r   had_underscore_valueunderscore_original_valuecurdirs   &    r2   runtestIPDoctestItem.runtestY  s#   zz%%%{{&&&4::&11313  'x5$+Hc4$@!
 
$$%		' KKOODJJH%OHHHV##'@A3''#&)(33  HHV##'@A3''#& (s   )(D< <AFc                   < V ^8  d   QhRR/# rS   rT   )r1   r   s   "r2   r3   r   w  s     	" 	"d 	"r4   c                `   \         P                  ! 4       R8w  d   R# V P                  P                  P	                  R4      pV'       de   VP                  RR7       VP                  4       w  r#\        P                  P                  V4       \        P                  P                  V4       R# R# )zNDisable output capturing. Otherwise, stdout is lost to ipdoctest (pytest#985).DarwinNcapturemanagerT)in_)platformsystemrb   pluginmanager	getpluginsuspend_global_captureread_global_capturesysstdoutwritestderr)r   capmanr   errs   &   r2   r  2IPDoctestItem._disable_output_capturing_for_darwinw  s|    ??(**445EF))d)3113HCJJS!JJS!	 r4   c                L   < V ^8  d   QhRS[ S[,          RS[S[S[3,          /# )r.   excinfor0   )r   r   r   rM   r   )r1   r   s   "r2   r3   r     s.     >3 >3}->3 
sL 	!>3r4   c                  < ^ RI pRp\        VP                  VP                  VP                  34      '       d   VP                  .pM6\        VP                  \
        4      '       d   VP                  P                  pVf   \        SV `!  V4      # . pV EF  pVP                  pVP                  pVP                  pVP                  f   Rp	M$VP                  VP                  ,           ^,           p	\        V4      P                  p
\        WV
4      p\!        4       p\#        V P$                  P'                  R4      4      pV	e   VP                  P(                  f   Q hVP                  P(                  P+                  R4      pVP                  f   Q h\-        V4       UUu. uF(  w  ppRWP                  ,           ^,           V3,          NK*  	  pppV\/        VP                  ^	,
          ^ 4      VP                  ^,            pM?R.pRpVP0                  P+                  4        F  pVP3                  RV RV 24       R	pK  	  \        WRP                  4      '       d3   WP5                  WeP6                  V4      P9                  R
4      ,          pM\:        P<                  ! VP>                  4      pVR\A        VP                  4      ,          .,          pT\B        PD                  ! VP>                  !   Uu. uF  pVPG                  R
4      NK  	  up,          pVP3                  W34       EK  	  \I        V4      # u uppi u upi )rq   NrB   Fz%03d %sz?EXAMPLE LOCATION UNKNOWN, not showing all tests of that examplez>>>z???  z...
zUNEXPECTED EXCEPTION: %s)%r   r   r  r   r   r   r   r   repr_failurer   r   filenamelinenor9   r   r   _get_checker_get_report_choicerb   r   	docstring
splitlines	enumeratemaxsourcerD   output_differencer   splitr   from_exc_infor   repr	tracebackformat_exceptionstripr   )r   r7  r   r   r   r   r   r   r<  r=  messager   r   report_choicer   ixindentr   inner_excinfor   s   &&                  r2   r;  IPDoctestItem.repr_failure  s    	  	 MMG22G4O4OP
 
  H'>??}}--H7'00GooG<<D}}H{{"w~~597m,,G+HgFL"nG.t{{/D/DEV/WXM!||--999..99%@{{...GPQVGWGWVaI[[1!4a 888GW   c'..1"4a87>>A;MN V #NN557DLL4xq!78"F 8 '#9#9::22[[-%+ !. ; ;G<L<L M4tM<O<O7PPQQ+4+E+EwGWGW+X+XaAGGDM+X  %%|&;<S  T 1221(s   ".L;6Mc                ^   < V ^8  d   QhRS[ S[RS[3,          S[S[,          S[3,          /# )r.   r0   zos.PathLike[str])r
   r   rM   r	   r   )r1   r   s   "r2   r3   r     s3     J JE%(:C(?"@(3-QT"TU Jr4   c                    V P                   f   Q hV P                  V P                   P                  RV P                  ,          3# )Nz[ipdoctest] %s)r   ra   r=  r|   r   s   &r2   
reportinfoIPDoctestItem.reportinfo  s7    zz%%%yy$**++-=		-IIIr4   c                    < V ^8  d   QhRS[ /# r.   r0   r   )r1   r   s   "r2   r3   r          	% 	%$ 	%r4   c                ,    \        V P                  4      # rV   r   r  rU  s   &r2   ra   IPDoctestItem.path      $$r4   c                <   < V ^8  d   Qh/ S[ S[S[3,          ;R&   # )r.   r   r   rM   r   )r1   r   s   "r2   r3   r     s     S>! r4   )r   r   r   r   r   )NN)r   r   r   r   r   classmethodrh   r	  r  r"  r  r;  rV  pytest_versionpropertyra   __annotate_func__r   r   r   r   s   @@r2   r   r     s         
Y 
Y 
Y/ /2
! 
!4 4<	" 	">3 >3@J J a1		% 
	%i  r4   r   c                F    V ^8  d   QhR\         \        \        3,          /# rY  )r   rM   r   )r1   s   "r2   r3   r3     s      $sCx. r4   c                      ^ RI p \        V P                  V P                  V P                  V P
                  V P                  V P                  \        4       \        4       \        4       R7	      # )rq   N)	DONT_ACCEPT_TRUE_FOR_1DONT_ACCEPT_BLANKLINENORMALIZE_WHITESPACEr8   IGNORE_EXCEPTION_DETAILCOMPARISON_FLAGSALLOW_UNICODEALLOW_BYTESNUMBER)r   r   rg  rh  ri  r8   rj  rk  _get_allow_unicode_flag_get_allow_bytes_flag_get_number_flagr   s    r2   _get_flag_lookuprs    sZ    &==%;;$99!! ' ? ? 11-/)+!
 
r4   c                     V P                   P                  R 4      p\        4       p^ pV F  pW2V,          ,          pK  	  V# )r6   )rb   getinirs  )r[   optionflags_strflag_lookup_tableflag_accflags   &    r2   get_optionflagsrz    sA    mm**+BCO(*Hd++  Or4   c                 j    V P                  R 4      pV'       d   V P                  R4      '       d   RpV# )rI   usepdbF)getvalue)rb   r   s   & r2   _get_continue_on_failurer~    s2     //*IJ ??8$$"'r4   c                      a a ] tR tRt oRtV3R lR lt]^ ,          ^8  d.   ]V3R lR l4       t]	RRRR/V3R	 lV 3R
 lll4       t
RtVtV ;t# RtVtV ;t# )r^   i  Nc                0   < V ^8  d   QhRS[ S[,          /# rY  r   r   )r1   r   s   "r2   r3   IPDoctestTextfile.__annotate__  s      -0 r4   c              #    "   ^ RI p^RIHp V P                  P	                  R4      pV P
                  P                  V4      p\        V P
                  4      pV P
                  P                  pRR/p\        V 4      p\        RV\        4       \        V P                  4      R7      p	V! 4       p
V
P                  WGWe^ 4      pVP                  '       d&   \        P!                  WP                  WR7      x  R# R# 5i)	rq   N)IPDocTestParserr;   r   __main__Fr   r   r   r   r|   r   r   )r   r   r  rb   ru  ra   	read_textrM   r|   rz  r   r>  r~  get_doctestr  r   rh   )r   r   r  encodingtextr<  r|   r   r   r   r/   r   s   &           r2   r<   IPDoctestTextfile.collect  s     . ;;%%&:;yy""8,tyy>yy~~Z(%d+# N 8 E	
 !"!!$tqA===++99V ,   s   C8C:c                    < V ^8  d   QhRS[ /# rY  r   )r1   r   s   "r2   r3   r    rZ  r4   c                ,    \        V P                  4      # rV   r\  rU  s   &r2   ra   IPDoctestTextfile.path  r^  r4   r  ra   c                0   < V ^8  d   QhRS[ S[,          /# r.   ra   r	   r   )r1   r   s   "r2   r3   r         	K 	K
 4.	Kr4   c               r   < Ve    ^ R I pVP                  P                  V4      p\        SV `  ! RRVRV/VB # Nr[   r  rT   rr   ra   rt   r   rh   r   r[   r  ra   kwrv   r   s   &&$$, r2   rh   IPDoctestTextfile.from_parent  =     t,7&JfJVJrJJr4   rT   )r   r   r   r   r   r<   rb  rc  ra   ra  rh   r   r   r   r   s   @@r2   r^   r^     sr     
C 8 a1		% 
	% 
	K 		K
 $(	K 	K 
	K 	K r4   r^   c                     V ^8  d   QhRRRR/# )r.   r   r   r0   NrT   )r1   s   "r2   r3   r3   &  s     = =. =4 =r4   c                   a ^ RI o\        ;QJ d)    V3R lV P                   4       F  '       d   K   RM	  RM! V3R lV P                   4       4      pV'       d   \        P                  ! R4       R# R# )zRRaise pytest.skip() if all examples in the given DocTest have the SKIP
option set.Nc              3   n   <"   T F*  qP                   P                  SP                  R 4      x  K,  	  R# 5i)FN)optionsgetSKIP)r   rO  r   s   & r2   r   %_check_all_skipped.<locals>.<genexpr>+  s%     P-QiimmGLL%88-s   25FTz%all docstests skipped by +SKIP option)r   allr  pytestskip)r   all_skippedr   s   & @r2   r  r  &  sE     #P$--P###P$--PPK;< r4   c                0    V ^8  d   QhR\         R\        /# )r.   r   r0   )objectrz   )r1   s   "r2   r3   r3   0  s      F t r4   c                     \        V RR4      RJ# )ziReturn 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   s   &r2   
_is_mockedr  0  s     	SMtT	r4   c                2    V ^8  d   QhR\         R,          /# )r.   r0   )NNN)r   )r1   s   "r2   r3   r3   :  s     % %),<"= %r4   c               #     a"   \         P                  oRR/R V3R lllp V \         n         Rx  S\         n        R#   S\         n        i ; i5i)z|Context manager which replaces ``inspect.unwrap`` with a version
that's aware of mock objects and doesn't recurse into them.stopNc                    V ^8  d   QhR\         R\        3,          R\        \         \        .\        3,          ,          R\        /# )r.   func.r  r0   )r   r   r	   )r1   s   "r2   r3   ._patch_unwrap_mock_aware.<locals>.__annotate__?  s=      sCx +3HcUCZ4H+I	r4   c                   <a a  Ve   V\         J d   S! S \         R7      # VoS! S VV 3R lR7      #   \         d+   p\        P                  ! RT: RS : R2\        4       h R p?ii ; i)N)r  c                 :   < \        V 4      ;'       g	    S! S4      # rV   )r  )r   _stopr  s   &r2   <lambda>F_patch_unwrap_mock_aware.<locals>._mock_aware_unwrap.<locals>.<lambda>F  s    jo6T6Tt6Tr4   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  er  real_unwraps   f$ @r2   _mock_aware_unwrap4_patch_unwrap_mock_aware.<locals>._mock_aware_unwrap?  si    	|tz1"4j99Et*TUU 	MM GHO 	 	s   2 2 2 A'%A""A')inspectunwrap)r  r  s    @r2   _patch_unwrap_mock_awarer  9  sB      ..KLP " (GN%$s   )A> AAAc                      a a ] tR tRt oV3R lR lt]^ ,          ^8  d.   ]V3R lR l4       t]RRRR/V3R	 lV 3R
 lll4       t	Rt
VtV ;t# Rt
VtV ;t# )r]   iW  c                0   < V ^8  d   QhRS[ S[,          /# rY  r  )r1   r   s   "r2   r3   IPDoctestModule.__annotate__X  s     R R-0 Rr4   c              #  ~  "   ^ RI p^RIHpHp  ! R RV4      pV P                  P
                  R8X  d   \        ^ ,          ^8  dK   V P                  P                  P                  V P                  V P                  P                  R4      4      pMRV P                  P                  /p\        R8  d   RVR	&   V P                  P                  P                  ! V P                  V P                  P                  R4      3/ VB pM? R
V P                  P                  /p\        R8  d   RVR	&   \        V P                  3/ VB pV! V! 4       R7      p\#        V 4      p\%        RV\'        4       \)        V P                  4      R7      p	VP+                  XVP,                  4       F:  p
V
P.                  '       g   K  \0        P3                  W
P
                  WR7      x  K<  	  R#   \         dM    T P                  P                  R4      '       d*   \        P                   ! RT P                  ,          4        Lh i ; i5i)rq   N)DocTestFinderr  c                   N   a a ] tR tRt oRtV 3R ltV3R lV 3R lltRtVtV ;t	# )7IPDoctestModule.collect.<locals>.MockAwareDocTestFinderi\  zA hackish ipdoctest finder that overrides stdlib internals to fix a stdlib bug.

https://github.com/pytest-dev/pytest/issues/3456
https://bugs.python.org/issue25532
c                   < \        V\        4      '       d   \        VRV4      p\        VR4      '       d   \        P
                  ! V4      p\        SV `  VV4      # )zDoctest 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   rc  r  r  r  r  r   _find_lineno)r   r   source_linesr   s   &&&r2   r  DIPDoctestModule.collect.<locals>.MockAwareDocTestFinder._find_linenoc  sU     c8,,!#vs3C3..!..-C w+  r4   c                   < V ^8  d   QhRR/# rS   rT   )r1   r   s   "r2   r3   DIPDoctestModule.collect.<locals>.MockAwareDocTestFinder.__annotate__w  s     	 		r4   c                   < \        V4      '       d   R # \        4       ;_uu_ 4        \        SV `  WW4WVV4       R R R 4       R #   + '       g   i     R # ; irV   )r  r  r   _find)	r   testsr   r|   moduler  r   seenr   s	   &&&&&&&&r2   r  =IPDoctestModule.collect.<locals>.MockAwareDocTestFinder._findw  s>     c??-//GMD,t 0///s   AA	rT   )
r   r   r   r   r   r  r  r   r   r   r   s   @@r2   MockAwareDocTestFinderr  \  s     (	 	 	r4   r  zconftest.py
importmoderootpathFconsider_namespace_packagesru   rH   zunable to import module %r)r/   r  r  )   r   )r   r   r  r  ra   r|   rb  rb   r+  _importconftestr   r  r"   ImportErrorr}  r  r  rz  r   r>  r~  findr   r  r   rh   )r   r   r  r  r  r  kwargsfinderr   r   r   s   &          r2   r<   IPDoctestModule.collectX  s    =$	] $	L 99>>]*a 1$22BBIIKK)),7
 %dkk&:&:;!V+<AF8922BBIIKK)),7 	 $++"6"67!V+<AF89$TYY9&9 (/@A%d+# N 8 E	
 KK8D}}}#//yy 0   9  ;;''(HIIKK <tyy HI	s7   DH=>G# A1H=:)H=#+H:'H:6H=8H::H=c                    < V ^8  d   QhRS[ /# rY  r   )r1   r   s   "r2   r3   r    rZ  r4   c                ,    \        V P                  4      # rV   r\  rU  s   &r2   ra   IPDoctestModule.path  r^  r4   r  Nra   c                0   < V ^8  d   QhRS[ S[,          /# r  r  )r1   r   s   "r2   r3   r    r  r4   c               r   < Ve    ^ R I pVP                  P                  V4      p\        SV `  ! RRVRV/VB # r  r  r  s   &&$$, r2   rh   IPDoctestModule.from_parent  r  r4   rT   )r   r   r   r   r<   rb  rc  ra   ra  rh   r   r   r   r   s   @@r2   r]   r]   W  sp     R Rh a1		% 
	% 
	K 		K
 $(	K 	K 
	K 	K r4   r]   c                0    V ^8  d   QhR\         R\        /# )r.   doctest_itemr0   )r   r   )r1   s   "r2   r3   r3     s      - N r4   c                    R R lp/ V n         V P                  P                  pRV RVRR/p\        R8:  d   RVR&   VP                  ! R/ VB V n        \        V R	R
7      p\        R8:  d   VP                  4        V# )zIUsed by IPDoctestTextfile and IPDoctestItem to setup fixture information.c                    V ^8  d   QhRR/# rS   rT   )r1   s   "r2   r3   %_setup_fixtures.<locals>.__annotate__  s      $ r4   c                      R # rV   rT   rT   r4   r2   r  _setup_fixtures.<locals>.func  s    r4   noder  r   NFfuncargsT)	_ispytest)r  rq   rT   )r  r   _fixturemanagerrb  getfixtureinfo_fixtureinfor   _fillfixtures)r  r  fmr  r   s   &    r2   r   r     s     L				-	-BlFD%>F"z " 1 1 !
!L %\TBO%%'r4   c                2    V ^8  d   QhR\         R,          /# r.   r0   r&   r   )r1   s   "r2   r3   r3     s     V! V!T":; V!r4   c                  @   a ^ RI p ^ RIo^RIHp  ! V3R lRV4      pV# )rq   Nr%   c                     <a a ] tR tRt o ZP	                  R ZP
                  4      t ZP	                  R ZP
                  4      t ZP	                  R ZP                  4      t	V3R lV V3R llt
V3R lR ltR	tVtV ;t# )
2_init_checker_class.<locals>.LiteralsOutputCheckeri  z(\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+)
              )
            )
            c                2   < V ^8  d   QhRS[ RS[ RS[RS[/# )r.   wantr   r   r0   )rM   r   rz   )r1   r   s   "r2   r3   ?_init_checker_class.<locals>.LiteralsOutputChecker.__annotate__  s/     	@ 	@S 	@s 	@ 	@ 	@r4   c                  < \         SV `  WV4      '       d   R # V\        4       ,          pV\        4       ,          pV\	        4       ,          pV'       g   V'       g   V'       g   R# R V	3R llpV'       d'   V! V P
                  V4      pV! V P
                  V4      pV'       d'   V! V P                  V4      pV! V P                  V4      pV'       d   V P                  W4      p\         SV `  WV4      # )TFc                R    V ^8  d   QhR\         \        ,          R\        R\        /# )r.   regexrk   r0   )r   rM   )r1   s   "r2   r3   U_init_checker_class.<locals>.LiteralsOutputChecker.check_output.<locals>.__annotate__  s%     3 3ws| 3# 3# 3r4   c                 *   < SP                  V R V4      # )z\1\2)sub)r  rk   res   &&r2   remove_prefixesX_init_checker_class.<locals>.LiteralsOutputChecker.check_output.<locals>.remove_prefixes  s    vveWc22r4   )r   check_outputro  rp  rq  _unicode_literal_re_bytes_literal_re_remove_unwanted_precision)
r   r  r   r   allow_unicodeallow_bytesallow_numberr  r   r  s
   &&&&    r2   r  ?_init_checker_class.<locals>.LiteralsOutputChecker.check_output  s    w#D{;;'*A*CCM%(=(??K&)9);;L \3 3 &t'?'?F%d&>&>D&t'='=tD%d&<&<cB55d@7';??r4   c                ,   < V ^8  d   QhRS[ RS[ RS[ /# )r.   r  r   r0   r   )r1   r   s   "r2   r3   r    s"     	 	3 	S 	S 	r4   c                   \        V P                  P                  V4      4      p\        V P                  P                  V4      4      p\        V4      \        V4      8w  d   V# ^ p\	        W44       EFP  w  rgVP                  R4      pVP                  R4      p	V	f   VP                  R4      p	Vf   ^ M
\        V4      p
V	e   V
\        V	4      ,          p
\        VP                  4       4      \        \        VP                  4       4      ^
V
) ,          R7      8X  g   K  VRVP                  4       V,            VP                  4       ,           W'P                  4       V,           R ,           pWVP                  4       VP                  4       ,
          VP                  4       VP                  4       ,
          ,
          ,          pEKS  	  V# )rq   fraction	exponent1N	exponent2)abs)list
_number_refinditerlenziprP   r   floatr#   startend)r   r  r   wantsgotsoffsetwgr  exponent	precisions   &&&        r2   r	  M_init_checker_class.<locals>.LiteralsOutputChecker._remove_unwanted_precision  sT   11$78E0056D5zSY&
FE(*+''**=*+''+*># ww{3H!)!1As8}	'X.I#veAGGI.>B
N'SS
 0aggi&01AGGI=EEGfDTDV@WW  eeg	1QUUWqwwy5HIIF )  Jr4   rT   )r   r   r   r   compileUNICODEr  r  VERBOSEr  r  r	  r   r   r   )r   r   r  s   @@r2   LiteralsOutputCheckerr    sj     
 !jj)CRZZPJJ'A2::NZZ& JJ)

.	@ 	@6	 	 	r4   r'  )r   r  r   r&   )r   r&   r'  r  s      @r2   _init_checker_classr(    s$    1O 6 Ob ! r4   c                    V ^8  d   QhRR/# r  rT   )r1   s   "r2   r3   r3   /  s      . r4   c                 :    \         f   \        4       s \        4       # )a  Return a IPDoctestOutputChecker 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
  ipdoctest should run in Python 2 and Python 3.

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

An inner class is used to avoid importing "ipdoctest" at the module
level.
)CHECKER_CLASSr(  rT   r4   r2   r>  r>  /  s     +-?r4   c                $    V ^8  d   QhR\         /# rY  r   )r1   s   "r2   r3   r3   C  s     8 8 8r4   c                 .    ^ RI p V P                  ! R4      # )z+Register and return the ALLOW_UNICODE flag.Nrl  r   register_optionflagrr  s    r2   ro  ro  C  s    &&77r4   c                $    V ^8  d   QhR\         /# rY  r-  )r1   s   "r2   r3   r3   J  s     6 6s 6r4   c                 .    ^ RI p V P                  ! R4      # )z)Register and return the ALLOW_BYTES flag.Nrm  r/  rr  s    r2   rp  rp  J  s    &&}55r4   c                $    V ^8  d   QhR\         /# rY  r-  )r1   s   "r2   r3   r3   Q  s     1 1# 1r4   c                 .    ^ RI p V P                  ! R4      # )z$Register and return the NUMBER flag.Nrn  r/  rr  s    r2   rq  rq  Q  s    &&x00r4   c                0    V ^8  d   QhR\         R\        /# )r.   keyr0   )rM   r   )r1   s   "r2   r3   r3   X  s      C C r4   c           
         ^ RI p\        VP                  \        VP                  \
        VP                  \        VP                  \        ^ /V ,          # )zReturn the actual `ipdoctest` module flag value.

We want to do it as late as possible to avoid importing `ipdoctest` and all
its dependencies when parsing options, as it adds overhead and breaks tests.
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)r6  r   s   & r2   r?  r?  X  sN      	$W%9%9#W%9%9#W%9%90'2S2S"A 
 r4   r   )scopec                F    V ^8  d   QhR\         \        \        3,          /# rY  r`  )r1   s   "r2   r3   r3   j  s      T#s(^ r4   c                     \        4       # )z_Fixture that returns a :py:class:`dict` that will be injected into the
namespace of ipdoctests.)r   rT   r4   r2   r   r   i  s     6Mr4   c                d    V ^8  d   Qh/ ^ \         9   d   \        \        R,          ,          ;R&   # )r.   r&   r+  )__conditional_annotations__r	   r   )r1   s   "r2   r3   r3      s'     < <D ? >x567 >E =r4   r   )orE  r   r   r  r  r  r)  r/  rI  r   r  
contextlibr   pathlibr   typingr   r   r   r   r	   r
   r   r   r  r   collections.abcr   r   r   r   r  _pytestr   _pytest._code.coder   r   r   _pytest._ior   _pytest.compatr   _pytest.configr   _pytest.config.argparsingr   _pytest.fixturesr   r   r  _pytest.nodesr   _pytest.outcomesr    _pytest.pathlibr!   r"   _pytest.python_apir#   _pytest.warning_typesr$   r   r   r&   r@  r:  r<  r8  r>  rO   rW   r+  tuple__version__rF  r   rb  rQ   rX   rl   ro   rs   rf   ri   rg   r   r  r   r   r   Itemr   rs  rz  r~  Moduler^   r  r  r  r]   r   r(  r>  ro  rp  rq  r?  fixturer   r3   )partrE  s   0@r2   <module>r\     s&   = 
   	  
    % 	 	 	  C C   L L & ' ! ,0= $ - 3 % /1# % % % +? ( ,  :> >f.@.@.F.Fs.KL.KdD	.KLM/d" !q'M1 L1A9&
(l 
(!i !3l(u%FKK u%p 2K 2Kj= % %:hKfmm hKV(V!r(861" i  !A  0//0@ Ms   H! <H5!H21H2