
    Mh                    V   S SK Jr  S SKJr  S SKrS SKJr  S SKrS SKJ	r	J
r
Jr  S SKrS SKJr  S SKJr  S SKJr  S S	KJr  S S
KJr  \
(       a  S SKJr  S SKJrJrJr  \      SS j5       r\SS j5       r\ S     SS jj5       r\SS j5       r \SSS jj5       r!SS jr"SS jr#g)    )annotations)contextmanagerN)Path)IOTYPE_CHECKINGAny)using_copy_on_write)PYPY)ChainedAssignmentError)
set_option)
get_handle)	Generator)
BaseBufferCompressionOptionsFilePathc              #  t   #    [        U SUSS9 nUR                  v   SSS5        g! , (       d  f       g= f7f)z
Open a compressed file and return a file object.

Parameters
----------
path : str
    The path where the file is read from.

compression : {'gzip', 'bz2', 'zip', 'xz', 'zstd', None}
    Name of the decompression to use

Returns
-------
file object
rbF)compressionis_textN)r   handle)pathr   r   s      J/var/www/html/env/lib/python3.13/site-packages/pandas/_testing/contexts.pydecompress_filer   !   s-     & 
D$K	G6mm 
H	G	Gs   8'	8
58c              #     ^#    SSK mSU4S jjn[        R                  R                  S5      nU" U 5         Sv   U" U5        g! U" U5        f = f7f)a|  
Context manager for temporarily setting a timezone.

Parameters
----------
tz : str
    A string representing a valid timezone.

Examples
--------
>>> from datetime import datetime
>>> from dateutil.tz import tzlocal
>>> tzlocal().tzname(datetime(2021, 1, 1))  # doctest: +SKIP
'IST'

>>> with set_timezone('US/Eastern'):
...     tzlocal().tzname(datetime(2021, 1, 1))
...
'EST'
r   Nc                   > U c   [         R                  S	 g U [         R                  S'   TR                  5         g ! [         a     g f = f)NTZ)osenvironKeyErrortzset)tztimes    r   setTZset_timezone.<locals>.setTZP   sF    :JJt$  "BJJtJJL	  s   < 
A	A	r   )returnNone)r"   r   r   get)r!   r#   orig_tzr"   s      @r   set_timezoner)   8   sA     ,  jjnnT"G	"Iggs   4AA 	A
AAc              +    #    [        [        R                  " 5       5      nU c  Sn [        [        R
                  " 5       5      U -   n X0-  nUR                  5         [        U5      nUR                  SS5      nU(       a.  UR                  SS5        Uc  SUS   ;  a  Sn[        U4SU0UD6n Uv   [        U[        5      (       d  UR                  5         UR                  5       (       a  UR                  5         gg! [        U[        5      (       d  UR                  5         UR                  5       (       a  UR                  5         f f = f7f)aB  
Gets a temporary path and agrees to remove on close.

This implementation does not use tempfile.mkstemp to avoid having a file handle.
If the code using the returned path wants to delete the file itself, windows
requires that no program has a file handle to it.

Parameters
----------
filename : str (optional)
    suffix of the created file.
return_filelike : bool (default False)
    if True, returns a file-like which is *always* cleaned. Necessary for
    savefig and other functions which want to append extensions.
**kwargs
    Additional keywords are passed to open().

N encodingmodezw+bbzutf-8)r   tempfile
gettempdirstruuiduuid4touchpop
setdefaultopen
isinstancecloseis_fileunlink)filenamereturn_filelikekwargsfolderr   handle_or_strr,   s          r   ensure_cleanrA   b   s    , (%%'(F4::< 8+HDJJL!$iMzz*d+H&%(6&> 9HT?H??---!<<>>KKM  ---!<<>>KKM s    B+E.C> 2AE>AEEc              +     #    SSK n1 SknX;   a  [        S5      eUR                  " U 40 UD6   Sv   UR                  U 5        g! UR                  U 5        f = f7f)a=  
Context manager to temporarily register a CSV dialect for parsing CSV.

Parameters
----------
name : str
    The name of the dialect.
kwargs : mapping
    The parameters for the dialect.

Raises
------
ValueError : the name of the dialect conflicts with a builtin one.

See Also
--------
csv : Python's CSV library.
r   N>   unixexcel	excel-tabz Cannot override builtin dialect.)csv
ValueErrorregister_dialectunregister_dialect)namer>   rF   _BUILTIN_DIALECTSs       r   with_csv_dialectrL      sY     ( 6 ;<<((%t$t$s   ,AA AAAc              #     #    SSK Jn  Uc  UR                  nUR                  nUR                  n[	        SU 5        Xl         S v   XBl        [	        SU5        g ! XBl        [	        SU5        f = f7f)Nr   )expressionszcompute.use_numexpr)pandas.core.computationrN   _MIN_ELEMENTSUSE_NUMEXPRr   )usemin_elementsexprolduseoldmins        r   use_numexprrW      sm     ;))FF$c*%2#(&1 $(&1s   A A1A A1A..A1c                R   SSK Jn  U (       d  SSKJn  U" 5       $ [        (       a  U(       d  SSKJn  U" 5       $ [        (       a  U(       a  U" USR                  U5      S9$ [        5       (       a	  [        nSnO[        nSnU(       a  U/UQ7nU" USR                  U/UQ75      S9$ )Nr   assert_produces_warningnullcontext|)matchzYA value is trying to be set on a copy of a DataFrame or Series through chained assignmentr   )	pandas._testingrZ   
contextlibr\   r
   joinr	   r   FutureWarning)warnextra_warningsextra_matchrZ   r\   warningr^   s          r   raises_chained_assignment_errorrg      s    7*}tN*}	.&((;'
 	

   ,G- 
 $G,E00G&((E0K01
 	
    c                f    SSK Jn  U (       d  SSKJn  U" 5       $ U(       d  SnU" [        4SU0UD6$ )aI  
Assert that a warning is raised in the CoW warning mode.

Parameters
----------
warn : bool, default True
    By default, check that a warning is raised. Can be turned off by passing False.
match : str
    The warning message to match against, if different from the default.
kwargs
    Passed through to assert_produces_warning
r   rY   r[   zSetting a value on a viewr^   )r_   rZ   r`   r\   rb   )rc   r^   r>   rZ   r\   s        r   assert_cow_warningrj      s2     8*}+"=HHHHrh   )r   zFilePath | BaseBufferr   r   r%   z Generator[IO[bytes], None, None])r!   r1   r%   Generator[None, None, None])NF)r=   boolr>   r   r%   zGenerator[Any, None, None])rJ   r1   r%   rk   )N)r%   rk   )T rm   )TN)$
__future__r   r`   r   r   pathlibr   r/   typingr   r   r   r2   pandas._configr	   pandas.compatr
   pandas.errorsr   pandasr   pandas.io.commonr   collections.abcr   pandas._typingr   r   r   r   r)   rA   rL   rW   rg   rj   rm   rh   r   <module>rx      s    " % 	   
  .  0  ')  
.@% , & &R +0,$(,<?,, ,^ % %B 2 2"!
HIrh   