
    d                    6   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mZmZ d dlmZ d dlmZ d d	lmZ d d
lmZ ed!d            Zed"d            Ze	 d#d$d            Zed%d            Zed%d            Zed&d%d            Zd  ZdS )'    )annotations)contextmanagerN)Path)IOAny	Generator)
BaseBufferCompressionOptionsFilePath)PYPY)ChainedAssignmentError)
set_option)
get_handle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      T/var/www/html/t/fyr/venv311/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           j        d= d S # t          $ r Y d S w xY w| t           j        d<                                    d S )NTZ)osenvironKeyErrortzset)r   times    r   setTZzset_timezone.<locals>.setTZJ   s^    :Jt$$$     "BJtJJLLLLLs    
""r!   )r   r   )r&   r"   r#   get)r   r'   orig_tzr&   s      @r   set_timezoner*   2   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          |          }|r#|                    dd           t          |f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 modezw+b)r   tempfile
gettempdirr   uuiduuid4touch
setdefaultopen
isinstancecloseis_fileunlink)filenamer+   r-   folderr   handle_or_strs         r   ensure_cleanr@   \   sD     , (%''((F4:<<  8+HHDJJLLL!$iiM -&%(((T,,V,,--- 	"!!!<<>> 	KKMMMMM	 	 --- 	"!!!<<>> 	KKMMMM	s   C1 1AEc               #  D  K   t          t          j                  } 	 dV  t          j                                         t          j                            |            dS # t          j                                         t          j                            |            w xY w)z
    Get a context manager to safely set environment variables

    All changes will be undone on close, hence environment variables set
    within this contextmanager will neither persist nor change global state.
    N)dictr"   r#   clearupdate)saved_environs    r   !ensure_safe_environment_variablesrF      s       $$M)



-((((( 	


-((((s   A   ?Bc              +     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)namer-   rK   _BUILTIN_DIALECTSs       r   with_csv_dialectrQ      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.computationrS   _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.c                 `    t           rddlm}   |             S ddlm}  |t
          d          S )Nr   )nullcontext)assert_produces_warningzYA value is trying to be set on a copy of a DataFrame or Series through chained assignment)match)r   
contextlibr^   pandas._testingr_   r   )r^   r_   s     r   raises_chained_assignment_errorrc      s\     
******{}};;;;;;&&"-
 
 
 	
    )r   r   r   r
   r   r   )r   r   r   r   )NF)r+   r,   r-   r   r   r.   )r   r   )N) 
__future__r   ra   r   r"   pathlibr   r2   typingr   r   r   r4   pandas._typingr	   r
   r   pandas.compatr   pandas.errorsr   pandasr   pandas.io.commonr   r   r*   r@   rF   rQ   r\   rc    rd   r   <module>rn      s   " " " " " " % % % % % % 				                
          
       0 0 0 0 0 0       ' ' ' ' ' '    , & & & &R +0) ) ) ) )X ) ) ) ) % % % %B 2 2 2 2 2"
 
 
 
 
rd   