
    m*iQ                    Z   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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WARNING_CHECK_DISABLED)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      X/var/www/html/land-doc-ocr/venv/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                   > [        TS5      (       a:  U c   [        R                  S	 g U [        R                  S'   TR	                  5         g g ! [         a     g f = f)NtzsetTZ)hasattrosenvironKeyErrorr   )tztimes    r   setTZset_timezone.<locals>.setTZS   sX    4!!z

4( $&

4 

 "   s   A 
AAr   )returnNone)r$   r    r!   get)r#   r%   orig_tzr$   s      @r   set_timezoner+   ;   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_cleanrC   f   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@   rH   _BUILTIN_DIALECTSs       r   with_csv_dialectrN      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.computationrP   _MIN_ELEMENTSUSE_NUMEXPRr   )usemin_elementsexprolduseoldmins        r   use_numexprrY      sm     ;))FF$c*%2#(&1 $(&1s   A A1A A1A..A1c                ~   SSK Jn  U (       d  SSKJn  U" 5       $ [        (       d  [
        (       a  U(       d  SSKJn  U" 5       $ [        (       d  [
        (       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._testingr\   
contextlibr^   r
   r   joinr	   r   FutureWarning)warnextra_warningsextra_matchr\   r^   warningr`   s          r   raises_chained_assignment_errorri      s    7*}&&*}
$((n&((;'
 	

   ,G- 
 $G,E00G&((E0K01
 	
    c                |    SSK Jn  U (       a  [        (       a  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   r[   r]   zSetting a value on a viewr`   )ra   r\   r   rb   r^   rd   )re   r`   r@   r\   r^   s        r   assert_cow_warningrl      s8     8))*}+"=HHHHrj   )r   zFilePath | BaseBufferr   r   r'   z Generator[IO[bytes], None, None])r#   r3   r'   Generator[None, None, None])NF)r?   boolr@   r   r'   zGenerator[Any, None, None])rL   r3   r'   rm   )N)r'   rm   )T ro   )TN)%
__future__r   rb   r   r    pathlibr   r1   typingr   r   r   r4   pandas._configr	   pandas.compatr
   r   pandas.errorsr   pandasr   pandas.io.commonr   collections.abcr   pandas._typingr   r   r   r   r+   rC   rN   rY   ri   rl   ro   rj   r   <module>rz      s    " % 	   
  . 1  ')  
.@% , ' 'T +0,$(,<?,, ,^ % %B 2 2"!
HIrj   