+
    Bi2                     |    ^ 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
  ! R R]4      t ! R R4      tR# )	    N)support)	os_helper)print_warningc                       ] tR t^tRtR# )SkipTestEnvironment N)__name__
__module____qualname____firstlineno____static_attributes__r       0/usr/lib/python3.14/test/libregrtest/save_env.pyr   r      s    r   r   c                     a ] tR t^t oRtR tRAtR tR tR t	R t
R tR tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R t#R  t$R! t%R" t&R# t'R$ t(R% t)R& t*R' t+R( t,R) t-R* t.R+ t/R, t0R- t1R. t2R/ t3R0 t4R1 t5R2 t6R3 t7R4 t8R5 t9R6 t:];! ]<4       U u. uF,  p V P{                  R74      '       g   K  \}        \x        V 4      NK.  	  up t?R8 t@R9 tAR: tBR; tCR< tDR= tER> tFR?tGVtHR@# u up i )Bsaved_test_environmenta  Save bits of the test environment and restore them at block exit.

    with saved_test_environment(test_name, verbose, quiet):
        #stuff

Unless quiet is True, a warning is printed to stderr if any of
the saved items was changed by the test. The support.environment_altered
attribute is set to True if a change is detected.

If verbose is more than 1, the before and after state of changed
items is also printed.
c               6    Wn         W n        W0n        W@n        R # N)	test_nameverbosequietpgo)selfr   r   r   r   s   &&&&$r   __init__saved_test_environment.__init__'   s    "
r   c                0    \         P                  V,          # r   )sysmodulesr   names   &&r   
get_module!saved_test_environment.get_moduleF   s    {{4  r   c                P     V P                  V4      #   \         d    \        hi ; ir   )r    KeyErrorr   r   s   &&r   try_get_module%saved_test_environment.try_get_moduleJ   s+    	&??4(( 	&%%	&s    %c                N    V P                  R 4      p\        VP                  4      # urllib.request)r$   list_url_tempfilesr   urllib_requests   & r   "get_urllib_requests__url_tempfiles9saved_test_environment.get_urllib_requests__url_tempfilesQ   s$    ,,-=>N1122r   c                D    V F  p\         P                  ! V4       K  	  R # r   )r   unlink)r   	tempfilesfilenames   && r   &restore_urllib_requests__url_tempfiles=saved_test_environment.restore_urllib_requests__url_tempfilesT   s    !HX& "r   c                <    V P                  R 4      pVP                  # r'   )r$   _openerr+   s   & r   get_urllib_requests__opener2saved_test_environment.get_urllib_requests__openerX   s    ,,-=>%%%r   c                4    V P                  R 4      pWn        R# )r(   N)r    r6   )r   openerr,   s   && r   restore_urllib_requests__opener6saved_test_environment.restore_urllib_requests__opener[   s    )9:!'r   c                N    V P                  R 4       \        P                  ! 4       # )asyncio)r$   r   maybe_get_event_loop_policyr   s   &r   %get_asyncio_events__event_loop_policy<saved_test_environment.get_asyncio_events__event_loop_policy_   s    I&2244r   c                ^    V P                  R 4      pVP                  P                  V4       R# )r>   N)r    events_set_event_loop_policy)r   policyr>   s   && r   )restore_asyncio_events__event_loop_policy@saved_test_environment.restore_asyncio_events__event_loop_policyb   s"    //),--f5r   c                    \        \        P                  4      \        P                  \        P                  R ,          3# NNN)idr   argvr@   s   &r   get_sys_argv#saved_test_environment.get_sys_argvf   #    #((|SXXsxx{22r   c                ^    V^,          \         n        V^,          \         P                  R&   R#    rK   N)r   rM   )r   
saved_argvs   &&r   restore_sys_argv'saved_test_environment.restore_sys_argvh       a= mr   c                ,    \         P                  ! 4       # r   )osgetcwdr@   s   &r   get_cwdsaved_test_environment.get_cwdl   s    yy{r   c                2    \         P                  ! V4       R # r   )rY   chdir)r   	saved_cwds   &&r   restore_cwd"saved_test_environment.restore_cwdn   s    
r   c                "    \         P                  # r   r   stdoutr@   s   &r   get_sys_stdout%saved_test_environment.get_sys_stdoutq       zzr   c                    V\         n        R # r   rc   )r   saved_stdouts   &&r   restore_sys_stdout)saved_test_environment.restore_sys_stdouts   	    !
r   c                "    \         P                  # r   r   stderrr@   s   &r   get_sys_stderr%saved_test_environment.get_sys_stderrv   rg   r   c                    V\         n        R # r   rn   )r   saved_stderrs   &&r   restore_sys_stderr)saved_test_environment.restore_sys_stderrx   rl   r   c                "    \         P                  # r   r   stdinr@   s   &r   get_sys_stdin$saved_test_environment.get_sys_stdin{   s    yyr   c                    V\         n        R # r   rw   )r   saved_stdins   &&r   restore_sys_stdin(saved_test_environment.restore_sys_stdin}   s	    	r   c                    \        \        P                  4      \        P                  \        \        P                  4      3# r   )rL   rY   environdictr@   s   &r   get_os_environ%saved_test_environment.get_os_environ   s$    "**~rzz4

+;;;r   c                    V^,          \         n        \         P                  P                  4        \         P                  P                  V^,          4       R# )rS   N)rY   r   clearupdate)r   saved_environs   &&r   restore_os_environ)saved_test_environment.restore_os_environ   s5    "1%






-*+r   c                    \        \        P                  4      \        P                  \        P                  R ,          3# rJ   )rL   r   pathr@   s   &r   get_sys_path#saved_test_environment.get_sys_path   rP   r   c                ^    V^,          \         n        V^,          \         P                  R&   R# rR   )r   r   )r   
saved_paths   &&r   restore_sys_path'saved_test_environment.restore_sys_path   rW   r   c                    \        \        P                  4      \        P                  \        P                  R ,          3# rJ   )rL   r   
path_hooksr@   s   &r   get_sys_path_hooks)saved_test_environment.get_sys_path_hooks   s%    #..!3>>3>>!3DDDr   c                ^    V^,          \         n        V^,          \         P                  R&   R# rR   )r   r   )r   saved_hookss   &&r   restore_sys_path_hooks-saved_test_environment.restore_sys_path_hooks   s    $Q'Nqr   c                ,    \         P                  ! 4       # r   )r   gettracer@   s   &r   get_sys_gettrace'saved_test_environment.get_sys_gettrace   s    ||~r   c                2    \         P                  ! V4       R # r   )r   settrace)r   	trace_fxns   &&r   restore_sys_gettrace+saved_test_environment.restore_sys_gettrace   s    Yr   c                "    \         P                  # r   builtins
__import__r@   s   &r   get___import__%saved_test_environment.get___import__   s    """r   c                    V\         n        R # r   r   )r   import_s   &&r   restore___import__)saved_test_environment.restore___import__   s
    %r   c                    V P                  R 4      p\        VP                  4      VP                  VP                  R,          3# )warningsrK   )r$   rL   filtersr   r   s   & r   get_warnings_filters+saved_test_environment.get_warnings_filters   s;    &&z2(""#X%5%5x7G7G7JJJr   c                p    V P                  R 4      pV^,          Vn        V^,          VP                  R&   R# )r   rK   N)r    r   )r   saved_filtersr   s   && r   restore_warnings_filters/saved_test_environment.restore_warnings_filters   s2    ??:.(++A.r   c                    \         P                  P                  R 4      pT;'       d#    VP                  P	                  4       ;'       g    / # )test.support.asyncore)r   r   get
socket_mapcopy)r   asyncores   & r   get_asyncore_socket_map.saved_test_environment.get_asyncore_socket_map   s:    ;;??#:;66H//446<<"<r   c                    \         P                  P                  R 4      pVe0   VP                  RR7       VP                  P                  V4       R# R# )r   NT)
ignore_all)r   r   r   	close_allr   r   )r   	saved_mapr   s   && r   restore_asyncore_socket_map2saved_test_environment.restore_asyncore_socket_map   sE    ;;??#:;$/&&y1  r   c                p    V P                  R 4      pVP                  VP                  P                  4       3# shutil)r$   _ARCHIVE_FORMATSr   r   r   s   & r   get_shutil_archive_formats1saved_test_environment.get_shutil_archive_formats   s4    $$X. &&(?(?(D(D(FFFr   c                    V P                  R 4      pV^ ,          Vn        VP                  P                  4        VP                  P                  V^,          4       R# r   N)r    r   r   r   r   savedr   s   && r   restore_shutil_archive_formats5saved_test_environment.restore_shutil_archive_formats   sF    *"'(%%'&&uQx0r   c                p    V P                  R 4      pVP                  VP                  P                  4       3# r   )r$   _UNPACK_FORMATSr   r   s   & r   get_shutil_unpack_formats0saved_test_environment.get_shutil_unpack_formats   s2    $$X.%%v'='='B'B'DDDr   c                    V P                  R 4      pV^ ,          Vn        VP                  P                  4        VP                  P                  V^,          4       R# r   )r    r   r   r   r   s   && r   restore_shutil_unpack_formats4saved_test_environment.restore_shutil_unpack_formats   sF    *!&q$$&%%eAh/r   c                    V P                  R 4      p\        VP                  4      VP                  VP                  P                  4       3# )logging)r$   rL   	_handlersr   r   r   s   & r   get_logging__handlers,saved_test_environment.get_logging__handlers   s?    %%i0'##$g&7&79J9J9O9O9QQQr   c                    R # r   r   )r   saved_handlerss   &&r   restore_logging__handlers0saved_test_environment.restore_logging__handlers       r   c                    V P                  R 4      p\        VP                  4      VP                  VP                  R,          3# )r   rK   )r$   rL   _handlerListr   s   & r   get_logging__handlerList/saved_test_environment.get_logging__handlerList   s<    %%i0'&&')=)=w?S?STU?VVVr   c                    R # r   r   )r   saved_handlerLists   &&r   restore_logging__handlerList3saved_test_environment.restore_logging__handlerList   r   r   c                    \        \        P                  4      \        P                  \        P                  R ,          3# rJ   )rL   r   warnoptionsr@   s   &r   get_sys_warnoptions*saved_test_environment.get_sys_warnoptions   s%    #//"COOS__Q5GGGr   c                ^    V^,          \         n        V^,          \         P                  R&   R# rR   )r   r   )r   saved_optionss   &&r   restore_sys_warnoptions.saved_test_environment.restore_sys_warnoptions   s!    '**1-r   c                >    \         P                  P                  4       # r   )	threading	_danglingr   r@   s   &r   get_threading__dangling.saved_test_environment.get_threading__dangling   s    ""''))r   c                    \         P                  P                  4        \         P                  P                  V4       R # r   )r   r   r   r   )r   r   s   &&r   restore_threading__dangling2saved_test_environment.restore_threading__dangling   s(    !!#""5)r   c                x    V P                  R 4      pVP                  4        VP                  P                  4       # )multiprocessing.process)r$   _cleanupr   r   )r   multiprocessing_processs   & r   %get_multiprocessing_process__dangling<saved_test_environment.get_multiprocessing_process__dangling   s5    "&"5"56O"P((*&005577r   c                    V P                  R 4      pVP                  P                  4        VP                  P                  V4       R# )r   N)r    r   r   r   )r   r   r   s   && r   )restore_multiprocessing_process__dangling@saved_test_environment.restore_multiprocessing_process__dangling   s8    "&//2K"L))//1))007r   c                    V P                  R 4      pVP                  R4       \        VP                  4      VP                  \	        VP                  4      3# )	sysconfigprefix)r$   get_config_varrL   _CONFIG_VARSr   r   r  s   & r   get_sysconfig__CONFIG_VARS1saved_test_environment.get_sysconfig__CONFIG_VARS   sN    ''4	  *9))*I,B,BY++,. 	.r   c                    V P                  R 4      pV^,          Vn        VP                  P                  4        VP                  P                  V^,          4       R# r  N)r    r	  r   r   r   r   r  s   && r   restore_sysconfig__CONFIG_VARS5saved_test_environment.restore_sysconfig__CONFIG_VARS   sF    OOK0	!&q	$$&%%eAh/r   c                    V P                  R 4      p\        VP                  4      VP                  VP                  P                  4       3# )r  )r$   rL   _INSTALL_SCHEMESr   r
  s   & r   get_sysconfig__INSTALL_SCHEMES5saved_test_environment.get_sysconfig__INSTALL_SCHEMES   sD    ''4	9--.	0J0J**//13 	3r   c                    V P                  R 4      pV^,          Vn        VP                  P                  4        VP                  P                  V^,          4       R# r  )r    r  r   r   r  s   && r   "restore_sysconfig__INSTALL_SCHEMES9saved_test_environment.restore_sysconfig__INSTALL_SCHEMES   sF    OOK0	%*1X	"""((*""))%(3r   c                L    \        R  \        P                  ! 4        4       4      # )c              3      "   T FN  pVP                  R 4      '       d   K  T\        P                  P                  V4      '       d   RMR,           x  KP  	  R# 5i)z.hypothesis/ N)
startswithrY   r   isdir).0fns   & r   	<genexpr>3saved_test_environment.get_files.<locals>.<genexpr>  sA      ; ,"]]=9 >b277==#4#4C"== ,s   A%AA)sortedrY   listdirr@   s   &r   	get_files saved_test_environment.get_files  s"     ; "

; ; 	;r   c                J   \         P                  pW!9  d   VR ,           V9  d}   \        P                  P	                  V4      '       d   \         P
                  ! V4       R# \        P                  P                  V4      '       d   \         P                  ! V4       R# R# R# R# )r  N)r   TESTFNrY   r   isfiler0   r  rmtree)r   saved_valuer   s   && r   restore_files$saved_test_environment.restore_files
  sn     b3h{%Bww~~b!!  $r""  $ # &C r   LC_c                    . pV P                    F,  p VP                  V\        P                  ! VR 4      34       K.  	  V#   \        \
        3 d     KF  i ; ir   )_lcappendlocale	setlocale	TypeError
ValueError)r   pairingslcs   &  r   
get_locale!saved_test_environment.get_locale  sX    ((BV%5%5b$%? @A 
  z* s   (AAAc                H    V F  w  r#\         P                  ! W#4       K  	  R # r   )r2  r3  )r   r   r7  settings   &&  r   restore_locale%saved_test_environment.restore_locale  s     KBR) !r   c                <    V P                  R 4      pVP                  # )r   )r$   showwarningr   s   & r   get_warnings_showwarning/saved_test_environment.get_warnings_showwarning   s    &&z2###r   c                4    V P                  R 4      pWn        R# )r   N)r    r?  )r   fxnr   s   && r   restore_warnings_showwarning3saved_test_environment.restore_warnings_showwarning#  s    ??:."r   c              #     "   V P                    F@  pVP                  R R4      pRV,           pRV,           pV\        W4      \        W4      3x  KB  	  R# 5i)._get_restore_N)	resourcesreplacegetattr)r   r   method_suffixget_namerestore_names   &    r   resource_info$saved_test_environment.resource_info'  sN     NND LLc2M-H%5L/1LLL	 #s   AAc                    . V n         V P                  4        F+  w  rp V! 4       pT P                   P                  YY434       K-  	  V #   \         d     K?  i ; ir   )saved_valuesrQ  r   r1  )r   r   r   restoreoriginals   &    r   	__enter__ saved_test_environment.__enter__.  sd    "&"4"4"6Dw5 $$d%CD #7 	 ' s   A		AAc                D   V P                   pR V n         \        P                  ! 4        V Fq  w  rVrxV! 4       p	W8w  g   K  R\        n        V! V4       V P                  '       d   K<  V P
                  '       d   KP  \        V RV P                   RV RV	 R24       Ks  	  R# )NTz was modified by z
  Before: z
  After:   F)rT  r   
gc_collectenvironment_alteredr   r   r   r   )
r   exc_typeexc_valexc_tbrT  r   r   rU  rV  currents
   &&&&      r   __exit__saved_test_environment.__exit__9  s    ((  	,8(DweG".2+!zzz$(((!& 1$..1A B%%-J /%%,IQ01 -9 r   )r   r   rT  r   r   N)zsys.argvcwdz	sys.stdinz
sys.stdoutz
sys.stderrz
os.environzsys.pathzsys.path_hooksr   zwarnings.filterszasyncore.socket_mapzlogging._handlerszlogging._handlerListzsys.gettracezsys.warnoptionsz!multiprocessing.process._danglingzthreading._danglingzsysconfig._CONFIG_VARSzsysconfig._INSTALL_SCHEMESfilesr2  zwarnings.showwarningshutil_archive_formatsshutil_unpack_formatsz!asyncio.events._event_loop_policyzurllib.requests._url_tempfileszurllib.requests._opener)Ir	   r
   r   r   __doc__r   rK  r    r$   r-   r3   r7   r;   rA   rG   rN   rU   r[   r`   re   rj   rp   rt   ry   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r%  r,  dirr2  r  rM  r0  r8  r<  r@  rD  rQ  rW  ra  r   __classdictcell__)r7  __classdict__s   0@r   r   r      s     I!&3'&(563$"" <,
3$E+ #&K/
=2G1E0RWH.**
88
.034;
% *-V $2mmE" 762 $C*$#M	 O$s   7DDr   )r   r2  rY   r   r   testr   test.supportr   utilsr   	Exceptionr   r   r   r   r   <module>ro     s5      	 
   "  	) 	r rr   