
    yhhQ                    H   d dl mZ d dlmZ d dlZd dlmZ d dlZd dlm	Z	m
Z
mZ d dlZd dlmZ d dlmZmZ d dlmZ d d	lmZ d d
lmZ e
rd dlmZ d dlmZmZmZ ed&d            Zed'd            Ze	 d(d)d            Z ed*d             Z!ed+d,d!            Z"d-d$Z#d.d%Z$dS )/    )annotations)contextmanagerN)Path)IOTYPE_CHECKINGAny)using_copy_on_write)PYPYWARNING_CHECK_DISABLED)ChainedAssignmentError)
set_option)
get_handle)	Generator)
BaseBufferCompressionOptionsFilePathpathFilePath | BaseBuffercompressionr   return Generator[IO[bytes], None, None]c              #  t   K   t          | d|d          5 }|j        V  ddd           dS # 1 swxY w Y   dS )a&  
    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)r   is_textN)r   handle)r   r   r   s      O/var/www/histauto/venv/lib/python3.11/site-packages/pandas/_testing/contexts.pydecompress_filer   $   s      & 
D$K	G	G	G 6m                 s   
-11tzstrGenerator[None, None, None]c              #     K   ddl dfd}t          j                            d          } ||            	 dV   ||           dS #  ||           w xY w)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   Nr   Nonec                    t          d          rH| !	 t          j        d= d S # t          $ r Y d S w xY w| t          j        d<                                    d S d S )NtzsetTZ)hasattrosenvironKeyErrorr$   )r   times    r   setTZzset_timezone.<locals>.setTZS   sz    4!! 	z
4(((   DD $&
4 

	 	s   $ 
22r%   )r   r"   )r*   r'   r(   get)r   r+   orig_tzr*   s      @r   set_timezoner.   ;   s      , KKK	 	 	 	 	 	 jnnT""G	E"IIIggs   A
 
AFreturn_filelikeboolkwargsr   Generator[Any, None, None]c              +    K   t          t          j                              }| d} t          t	          j                              | z   } || z  }|                                 t          |          }|                    dd          }|r3|                    dd           |d|d         vrd}t          |fd|i|}	 |V  t          |t                    s|                                 |                                r|                                 dS dS # t          |t                    s|                                 |                                r|                                 w w xY w)az  
    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
gettempdirr   uuiduuid4touchpop
setdefaultopen
isinstancecloseis_fileunlink)filenamer/   r1   folderr   handle_or_strr5   s          r   ensure_cleanrG   f   sv     , (%''((F4:<<  8+HHDJJLLL!$iiMzz*d++H @&%(((6&> 9 9HT??H???--- 	"!!!<<>> 	KKMMMMM	 	 --- 	"!!!<<>> 	KKMMMM	s   >D AE+namec              +     K   ddl }h d}| |v rt          d           |j        | fi | 	 dV  |                    |            dS # |                    |            w xY w)au  
    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>   	excel-tabunixexcelz Cannot override builtin dialect.)csv
ValueErrorregister_dialectunregister_dialect)rH   r1   rM   _BUILTIN_DIALECTSs       r   with_csv_dialectrR      s      ( JJJ666   ;<<<C(((((%t$$$$$t$$$$s   A Ac              #     K   ddl m} ||j        }|j        }|j        }t	          d|            ||_        	 d V  ||_        t	          d|           d S # ||_        t	          d|           w xY w)Nr   )expressionszcompute.use_numexpr)pandas.core.computationrT   _MIN_ELEMENTSUSE_NUMEXPRr   )usemin_elementsexprolduseoldmins        r   use_numexprr]      s      ;;;;;;)FF$c***%D2#(&11111 $(&1111s   A A.T c                l   ddl m} | sddlm}  |            S t          st
          r|sddlm}  |            S t          st
          r"|r  ||d                    |                    S t                      r
t          }d}n	t          }d}|r|g|R } ||d                    |g|R                     S )Nr   assert_produces_warningnullcontext|)matchzYA value is trying to be set on a copy of a DataFrame or Series through chained assignmentr   )
pandas._testingra   
contextlibrc   r
   r   joinr	   r   FutureWarning)warnextra_warningsextra_matchra   rc   warningre   s          r   raises_chained_assignment_errorrn      s.   777777 ******{}} 
& 
 
******{}}
 
( 
n 
&&((;''
 
 
 	

    		-,G- E
 $G,E 	1000G&&((E0K0011
 
 
 	
    c                h    ddl m} | rt          rddlm}  |            S |sd} |t
          fd|i|S )aq  
    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`   rb   zSetting a value on a viewre   )rf   ra   r   rg   rc   ri   )rj   re   r1   ra   rc   s        r   assert_cow_warningrq      so     877777 ) ******{}} ,+""=HHHHHHro   )r   r   r   r   r   r   )r   r   r   r    )NF)r/   r0   r1   r   r   r2   )rH   r   r   r    )N)r   r    )Tr^   r^   )TN)%
__future__r   rg   r   r'   pathlibr   r8   typingr   r   r   r:   pandas._configr	   pandas.compatr
   r   pandas.errorsr   pandasr   pandas.io.commonr   collections.abcr   pandas._typingr   r   r   r   r.   rG   rR   r]   rn   rq   r^   ro   r   <module>r|      s1   " " " " " " % % % % % % 				                
  . . . . . .        1 0 0 0 0 0       ' ' ' ' ' ' ))))))             , ' ' ' 'T +0, , , , ,^ % % % %B 2 2 2 2 2"!
 !
 !
 !
HI I I I I Iro   