
    4i              
         S r SSKJr  SSKJrJr  SSKrSSKJr  SSK	J
r
JrJr  SSKrSSKrSSKrSSKJrJrJrJrJrJr  SSKrSSKrSSKJr  SSKrSSKrSS	KJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'  SS
K(J)r)J*r+J,r,J-r-J.r.  SSK/r/SSK0r0SSK1J2r2J3r3  SSK4J5r5  SSK6J7r7  SSK8J9r9J:r:J;r;J<r<  SSK=J>r>  \?" \.\,-   \--   5      r@\@R                  S5        \R                  " S5      rC\%" S\2S9rD\(       a  SSKEJFrF  SSK1JGrGJHrHJIrIJJrJJKrKJLrL  SSKMJNrN  \R                   " S S5      5       rP\R                   " S S\#\!   5      5       rQSJS jrR\'SKS j5       rS\'SLS j5       rSSMS jrSSNS jrT\' SO     SPS! jj5       rU\' SO     SQS" jj5       rU SR     SSS$ jjrUSTS% jrVSUS& jrW    SV           SWS' jjrXSXS( jrYS)S)S)S)S*S+S,S-S.S/.	rZ\?" \ZR                  5       5      r\    SYS0 jr]      SZS1 jr^S[S2 jr_\'S S S S S S3.                 S\S4 jj5       r`\'S S S S S S S5.                 S]S6 jj5       r`\'S S S S S S S5.                 S^S7 jj5       r`SSS#S8SSS5.                 S_S9 jjr` " S: S;\\5      ra " S< S=\a5      rb " S> S?\a5      rc " S@ SA5      rd " SB SC5      re      S`SD jrfSaSE jrgSbSF jrh\R                  ScSG j5       rj Sd     SeSH jjrk      SfSI jrlg)gzCommon I/O API utilities    )annotations)ABCabstractmethodN)defaultdict)HashableMappingSequence)BufferedIOBaseBytesIO	RawIOBaseStringIO
TextIOBaseTextIOWrapper)Path)
IOTYPE_CHECKINGAnyAnyStrDefaultDictGenericLiteralTypeVarcastoverload)urljoinurlparseuses_netlocuses_paramsuses_relative)
BaseBufferReadCsvBuffer)import_optional_dependency)find_stack_level)is_boolis_file_like
is_integeris_list_like)ABCMultiIndex z3^[A-Za-z][A-Za-z0-9+\-+.]*(::[A-Za-z0-9+\-+.]+)*://BaseBufferT)bound)TracebackType)CompressionDictCompressionOptionsFilePath
ReadBufferStorageOptionsWriteBuffer)
MultiIndexc                  P    \ rS rSr% SrS\S'   S\S'   S\S'   S\S	'   S
rS\S'   Srg)IOArgs[   z7
Return value of io/common.py:_get_filepath_or_buffer.
str | BaseBufferfilepath_or_bufferstrencodingmoder-   compressionFboolshould_close N)__name__
__module____qualname____firstlineno____doc____annotations__r>   __static_attributes__r?       R/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/pandas/io/common.pyr5   r5   [   s)     )(M
I  L$rG   r5   c                      \ rS rSr% SrS\S'   S\S'   \R                  " \S9r	S\S	'   S
r
S\S'   SS jrSS jr        SS jrSrg)	IOHandlesh   aU  
Return value of io/common.py:get_handle

Can be used as a context manager.

This is used to easily close created buffers and to handle corner cases when
TextIOWrapper is inserted.

handle: The file handle to be used.
created_handles: All file handles that are created by get_handle
is_wrapped: Whether a TextIOWrapper needs to be detached.
z
IO[AnyStr]handler-   r<   )default_factoryzlist[IO[bytes] | IO[str]]created_handlesFr=   
is_wrappedc                |   U R                   (       az  [        U R                  [        5      (       d   eU R                  R	                  5         U R                  R                  5         U R                  R                  U R                  5        U R                   H  nUR                  5         M     / U l        SU l         g)z
Close all created buffers.

Note: If a TextIOWrapper was inserted, it is flushed and detached to
avoid closing the potentially user-created buffer.
FN)	rO   
isinstancerL   r   flushdetachrN   removeclose)selfrL   s     rH   rU   IOHandles.close}   s     ??dkk=9999KKKK   ''4**FLLN +!rG   c                    U $ Nr?   rV   s    rH   	__enter__IOHandles.__enter__   s    rG   c                $    U R                  5         g rY   )rU   )rV   exc_type	exc_value	tracebacks       rH   __exit__IOHandles.__exit__   s     	

rG   )rN   rO   NreturnNone)rd   zIOHandles[AnyStr])r^   ztype[BaseException] | Noner_   zBaseException | Noner`   zTracebackType | Nonerd   re   )r@   rA   rB   rC   rD   rE   dataclassesfieldlistrN   rO   rU   r[   ra   rF   r?   rG   rH   rJ   rJ   h   sk       1<1B1BSW1XO.XJ ", ( (	
 
rG   rJ   c                f    [        U [        5      (       d  g[        U 5      R                  [        ;   $ )z
Check to see if a URL has a valid protocol.

Parameters
----------
url : str or unicode

Returns
-------
isurl : bool
    If `url` has a valid protocol return True otherwise False.
F)rQ   r9   	parse_urlscheme_VALID_URLSurls    rH   is_urlro      s)     c3S>  K//rG   c                    g rY   r?   r8   s    rH   _expand_userrr      s    25rG   c                    g rY   r?   rq   s    rH   rr   rr      s    BErG   c                n    [        U [        5      (       a  [        R                  R	                  U 5      $ U $ )a5  
Return the argument with an initial component of ~ or ~user
replaced by that user's home directory.

Parameters
----------
filepath_or_buffer : object to be converted if possible

Returns
-------
expanded_filepath_or_buffer : an expanded filepath or the
                              input if not expandable
)rQ   r9   ospath
expanduserrq   s    rH   rr   rr      s.     $c**ww!!"455rG   c                   U c  g [        U 5      (       a"  [        [        U 5      n U S:  a  [        S5      eg [	        U SS9(       a\  [        [
        U 5      n [        [        [         U 5      5      (       d  [        S5      e[        S U  5       5      (       a  [        S5      eg [        U 5      (       a  [        S5      e[        S5      e)	Nr   zUPassing negative integer to header is invalid. For no header, use header=None insteadF)
allow_setsz*header must be integer or list of integersc              3  *   #    U  H	  oS :  v   M     g7f)r   Nr?   ).0is     rH   	<genexpr>&validate_header_arg.<locals>.<genexpr>   s     %f1ufs   z8cannot specify multi-index header with negative integerszPassing a bool to header is invalid. Use header=None for no header or header=int or list-like of ints to specify the row(s) making up the column names)r&   r   int
ValueErrorr'   r	   allmapanyr$   	TypeError)headers    rH   validate_header_argr      s    ~&c6"A:9  	Fu-h'3z6*++IJJ%f%%%WXXv4
 	
 A
BBrG   .c                    g rY   r?   r8   convert_file_likes     rH   stringify_pathr      s     rG   c                    g rY   r?   r   s     rH   r   r      s     rG   Fc                    U(       d   [        U 5      (       a  [        [        U 5      $ [        U [        R
                  5      (       a  U R                  5       n [        U 5      $ )a  
Attempt to convert a path-like object to a string.

Parameters
----------
filepath_or_buffer : object to be converted

Returns
-------
str_filepath_or_buffer : maybe a string version of the object

Notes
-----
Objects supporting the fspath protocol are coerced
according to its __fspath__ method.

Any other object is passed through unchanged, which includes bytes,
strings, buffers, or anything else that's not even path-like.
)r%   r   r*   rQ   ru   PathLike
__fspath__rr   r   s     rH   r   r      sO    . .@!A!A K!344$bkk22/::<*++rG   c                 B    SSK nUR                  R                  " U 0 UD6$ )zT
Lazy-import wrapper for stdlib urlopen, as that imports a big chunk of
the stdlib.
r   N)urllib.requestrequesturlopen)argskwargsurllibs      rH   r   r     s!    
 >>!!42622rG   c                    [        U [        5      =(       a;    [        [        R	                  U 5      5      =(       a    U R                  S5      (       + $ )zF
Returns true if the given URL looks like
something fsspec can handle
)zhttp://zhttps://)rQ   r9   r=   _FSSPEC_URL_PATTERNmatch
startswithrm   s    rH   is_fsspec_urlr     sA     	3 	8$**3/0	8677rG   c                   [        U 5      n [        U5      u  pR[        X5      nU(       a;  [        U S5      (       a*  SU;  a$  [        R
                  " S[        [        5       S9  Sn[        X%S9nSU;   a3  US;   a-  US	;   a'  [        R
                  " U S
U 3[        [        5       S9  SU;   a(  US;   a"  [        R
                  " S[        [        5       S9  UnSU;  a  SU;  a  US-  n[        U [        5      (       a  [        U 5      (       a  U=(       d    0 nSSKnUR                  R                  XS9n[!        U5       n	U	R"                  R%                  SS5      n
U
S:X  a  SS0n['        U	R)                  5       5      nSSS5        [+        WUUSUS9$ [-        U 5      (       a  [        U [        5      (       d   eU R/                  S5      (       a  U R1                  SS5      n U R/                  S5      (       a  U R1                  SS5      n [3        S5      n/ n [3        S5        SSKJnJn  UU[:        /n UR>                  " U 4SU0U=(       d    0 D6R?                  5       n[+        UUUSUS9$ U(       a  [C        S5      e[        U [        [D        [F        RF                  45      (       a  [+        [I        U 5      UUSUS9$ [        U S 5      (       d*  [        U S5      (       d  S![K        U 5       3n[C        U5      e[+        U UUSUS9$ ! , (       d  f       GN= f! [<         a     Nf = f! [A        U5       aH    Uc  SS0nO[        U5      nSUS'   UR>                  " U 4SU0U=(       d    0 D6R?                  5       n GNf = f)"a  
If the filepath_or_buffer is a url, translate and return the buffer.
Otherwise passthrough.

Parameters
----------
filepath_or_buffer : a url, filepath (str or pathlib.Path),
                     or buffer

compression : str or dict, default 'infer'
    For on-the-fly compression of the output data. If 'infer' and
    'filepath_or_buffer' is path-like, then detect compression from the
    following extensions: '.gz',
    '.bz2', '.zip', '.xz', '.zst', '.tar', '.tar.gz', '.tar.xz' or '.tar.bz2'
    (otherwise no compression).
    Set to ``None`` for no compression.
    Can also be a dict with key ``'method'`` set
    to one of {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'xz'``, ``'tar'``}
    and other key-value pairs are forwarded to
    ``zipfile.ZipFile``, ``gzip.GzipFile``,
    ``bz2.BZ2File``, ``zstandard.ZstdCompressor``, ``lzma.LZMAFile`` or
    ``tarfile.TarFile``, respectively.
    As an example, the following could be passed for faster compression and to
    create a reproducible gzip archive:
    ``compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1}``.

encoding : the encoding to use to decode bytes, default is 'utf-8'
mode : str, optional

storage_options : dict, optional
    Extra options that make sense for a particular storage connection, e.g.
    host, port, username, password, etc. For HTTP(S) URLs the key-value pairs
    are forwarded to ``urllib.request.Request`` as header options. For other
    URLs (e.g. starting with "s3://", and "gcs://") the key-value pairs are
    forwarded to ``fsspec.open``. Please see ``fsspec`` and ``urllib`` for more
    details, and for more examples on storage options refer `here
    <https://pandas.pydata.org/docs/user_guide/io.html?
    highlight=storage_options#reading-writing-remote-files>`_.


Returns the dataclass IOArgs.
writebzDcompression has no effect when passing a non-binary object as input.)
stacklevelN)methodw)bz2xz)zutf-16zutf-32z( will not write the byte order mark for a)ziptarzzip and tar do not support mode 'a' properly. This combination will result in multiple files with same name being added to the archive.tr   )headerszContent-Encodinggzipr   T)r8   r:   r<   r>   r;   zs3a://zs3://zs3n://fsspecbotocore)ClientErrorNoCredentialsErrorr;   anonz?storage_options passed with file object or non-fsspec file pathFreadz)Invalid file path or buffer object type: )&r   get_compression_methodinfer_compressionhasattrwarningswarnRuntimeWarningr#   dictUnicodeWarningrQ   r9   ro   r   r   Requestr   r   getr   r   r5   r   r   replacer"   botocore.exceptionsr   r   PermissionErrorImportErroropentupler   bytesmmaprr   type)r8   r:   r<   r;   storage_optionscompression_methodfsspec_moder   req_inforeqcontent_encodingreaderr   err_types_to_retry_with_anonr   r   file_objmsgs                     rH   _get_filepath_or_bufferr   (  s   b ((:; '=[&I#*+=R g&8'BBsRVR')	

 "{>K
 	t-/,,mCH:N')	
 d{)^;* ')	
 K
+#["8s$c**v6H/I/I */R 	 >>))*<)VX#"{{/A4H6)'0SXXZ(F  %#
 	
 '((
 
 	
 
 ((22!3!;!;Hg!N((22!3!;!;Hg!N+H5 35$	&z2 ",(	{{")49H9NBdf  '#
 	
 
M
 	
 $sE499&=>>+,>?#
 	
 	"F++w7I7/S/S9$?Q:R9STo- u T  		 12 		&#)4. #'"7*.'{{")49H9NBdf 		s2   A LL 8,L- 
L
L*)L*-ANNc                2    SSK Jn  [        SU" U 5      5      $ )z
converts an absolute native path to a FILE URL.

Parameters
----------
path : a path in native format

Returns
-------
a valid FILE URL
r   )pathname2urlzfile:)r   r   r   )rv   r   s     rH   file_path_to_urlr     s     ,7L.//rG   r   r   r   r   r   zstd)	.tar.tar.gz.tar.bz2.tar.xz.gz.bz2.zip.xzz.zstc                    [        U [        5      (       a   [        U 5      n UR                  S5      nX!4$ 0 nU nX!4$ ! [         a  n[        S5      UeSnAff = f)a  
Simplifies a compression argument to a compression method string and
a mapping containing additional arguments.

Parameters
----------
compression : str or mapping
    If string, specifies the compression method. If mapping, value at key
    'method' specifies compression method.

Returns
-------
tuple of ({compression method}, Optional[str]
          {compression arguments}, Dict[str, Any])

Raises
------
ValueError on mapping missing 'method' key
r   z.If mapping, compression must have key 'method'N)rQ   r   r   popKeyErrorr   )r<   compression_argsr   errs       rH   r   r     sx    . +w'',	X!1!5!5h!? // (//  	XMNTWW	Xs   = 
AAAc                   Uc  gUS:X  a  [        U [        5      (       a  SU ;   a  U R                  S5      S   n [        U SS9n [        U [        5      (       d  g[        R                  5        H-  u  p!U R                  5       R                  U5      (       d  M+  Us  $    gU[        ;   a  U$ SS/[        [        5      QnSU SU 3n[        U5      e)	a  
Get the compression method for filepath_or_buffer. If compression='infer',
the inferred compression method is returned. Otherwise, the input
compression method is returned unchanged, unless it's invalid, in which
case an error is raised.

Parameters
----------
filepath_or_buffer : str or file handle
    File path or object.

compression : str or dict, default 'infer'
    For on-the-fly compression of the output data. If 'infer' and
    'filepath_or_buffer' is path-like, then detect compression from the
    following extensions: '.gz',
    '.bz2', '.zip', '.xz', '.zst', '.tar', '.tar.gz', '.tar.xz' or '.tar.bz2'
    (otherwise no compression).
    Set to ``None`` for no compression.
    Can also be a dict with key ``'method'`` set
    to one of {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'xz'``, ``'tar'``}
    and other key-value pairs are forwarded to
    ``zipfile.ZipFile``, ``gzip.GzipFile``,
    ``bz2.BZ2File``, ``zstandard.ZstdCompressor``, ``lzma.LZMAFile`` or
    ``tarfile.TarFile``, respectively.
    As an example, the following could be passed for faster compression and to
    create a reproducible gzip archive:
    ``compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1}``.

Returns
-------
string or None

Raises
------
ValueError on invalid compression specified.
Ninferz::r   T)r   Unrecognized compression type: z
Valid compression types are )rQ   r9   splitr   extension_to_compressionitemslowerendswith_supported_compressionssortedr   )r8   r<   	extensionvalidr   s        rH   r   r   :  s    N  g(#..4;M3M!3!9!9$!?!B+,>RVW,c22 '?&D&D&F"I!'')229=="" 'G  --d=V$;<=E
)+ 7'',g	/  S/rG   c                v    [        U 5      R                  nUR                  5       (       d  [        SU S35      eg)z
Check if parent directory of a file exists, raise OSError if it does not

Parameters
----------
path: Path or str
    Path to check parent directory of
z1Cannot save file into a non-existent directory: ''N)r   parentis_dirOSError)rv   r   s     rH   check_parent_directoryr     s9     $ZF==??J6(RSTUU rG   )r:   r<   
memory_maperrorsr   c                   g rY   r?   path_or_bufr;   r:   r<   r   is_textr   r   s           rH   
get_handler     s     rG   )r:   r<   r   r   r   r   c                   g rY   r?   r   s           rH   r   r     s     rG   c                   g rY   r?   r   s           rH   r   r     s     ),rG   Tc               \   U=(       d    SnU=(       d    Sn[        X5      (       a  SU;  a  US-  n[        R                  " U5        [        U[        5      (       a  [        R
                  " U5        [        U UUUUS9nUR                  n	[        X5      u  pn
[        U	[        5      n[        UR                  5      nUR                  S5      nSU;  a  U(       a  [        [	        U	5      5        U(       Gax  US:w  a"  UR                  R                  SS	5      Ul        O+US:X  a%  SUR                  ;  a  U=R                  S-  sl        US
:X  a_  [        U	[        5      (       a%  [        R                   " S*U	UR                  S.UD6n	GO[        R                   " S*U	UR                  S.UD6n	GOUS:X  a%  SSKnUR$                  " U	4SUR                  0UD6n	GOlUS:X  a  ['        U	UR                  40 UD6n	U	R(                  R                  S:X  a  U
R+                  U	5        U	R(                  R-                  5       n[/        U5      S:X  a+  U	R(                  R1                  UR                  5       5      n	GOU(       d  [3        SU  35      e[3        SU 35      eGOUS:X  Ga  UR5                  SUR                  5        [        U	[        5      (       a  [7        S*SU	0UD6n	O[7        S*SU	0UD6n	[        U	[6        5      (       d   eSU	R(                  R                  ;   a  U
R+                  U	5        U	R(                  R9                  5       n[/        U5      S:X  a&  U	R(                  R;                  US   5      nUc   eUn	OU(       d  [3        SU  35      e[3        SU 35      eOUS:X  a#  SSKnUR>                  " U	UR                  40 UD6n	OzUS:X  ad  [A        S5      nSUR                  ;   a  SURB                  " S*0 UD60nOSURD                  " S*0 UD60nUR0                  " U	4SUR                  0UD6n	OSU 3n[3        U5      e[        U	[        5      (       a   eU
R+                  U	5        O~[        U	[        5      (       ai  URF                  (       a2  SUR                  ;  a"  [1        U	UR                  URF                  US	S9n	O[1        XR                  5      n	U
R+                  U	5        S nU(       d:  UR                  S!:X  a*  [        U	[H        5      (       a  [K        U	URF                  S"9n	OU(       a  U(       d!  U(       d  [        XR                  5      (       a  [M        U	S#5      (       a"  [M        U	S$5      (       a  [M        U	S%5      (       d  [O        U	5      n	[Q        U	URF                  US	S9n	U
R+                  U	5        [        UR                  [        5      =(       d    URR                  (       + nSUR                  ;   a3  [M        U	S&5      (       d"  [U        S'[W        UR                  5       S(35      eU
RY                  5         URR                  (       a<  [        UR                  [        5      (       a   eU
R+                  UR                  5        [[        U	U
UUR                  S)9$ )+a  
Get file handle for given path/buffer and mode.

Parameters
----------
path_or_buf : str or file handle
    File path or object.
mode : str
    Mode to open path_or_buf with.
encoding : str or None
    Encoding to use.
compression : str or dict, default 'infer'
    For on-the-fly compression of the output data. If 'infer' and 'path_or_buf'
    is path-like, then detect compression from the following extensions: '.gz',
    '.bz2', '.zip', '.xz', '.zst', '.tar', '.tar.gz', '.tar.xz' or '.tar.bz2'
    (otherwise no compression).
    Set to ``None`` for no compression.
    Can also be a dict with key ``'method'`` set
    to one of {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'xz'``, ``'tar'``}
    and other key-value pairs are forwarded to
    ``zipfile.ZipFile``, ``gzip.GzipFile``,
    ``bz2.BZ2File``, ``zstandard.ZstdCompressor``, ``lzma.LZMAFile`` or
    ``tarfile.TarFile``, respectively.
    As an example, the following could be passed for faster compression and to
    create a reproducible gzip archive:
    ``compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1}``.

       May be a dict with key 'method' as compression mode
       and other keys as compression options if compression
       mode is 'zip'.

       Passing compression options as keys in dict is
       supported for compression modes 'gzip', 'bz2', 'zstd' and 'zip'.

memory_map : bool, default False
    See parsers._parser_params for more information. Only used by read_csv.
is_text : bool, default True
    Whether the type of the content passed to the file/buffer is string or
    bytes. This is not the same as `"b" not in mode`. If a string content is
    passed to a binary file/buffer, a wrapper is inserted.
errors : str, default 'strict'
    Specifies how encoding and decoding errors are to be handled.
    See the errors argument for :func:`open` for a full list
    of options.
storage_options: StorageOptions = None
    Passed to _get_filepath_or_buffer

Returns the dataclass IOHandles
utf-8strictr   )r:   r<   r;   r   r   rr   r   r)   r   )filenamer;   )fileobjr;   r   r   Nr;   r      zZero files found in ZIP file z9Multiple files found in ZIP file. Only one file per ZIP: r   namer   z Zero files found in TAR archive zDMultiple files found in TAR archive. Only one file per TAR archive: r   	zstandarddctxcctxr   )r:   r   newlineFrb)r:   readablewritableseekabler   z1Expected file path name or file-like object, got z type)rL   rN   rO   r<   r?   )._is_binary_modecodecslookuprQ   r9   lookup_errorr   r8   _maybe_memory_mapr   r<   r   r   r;   r   r   GzipFiler   BZ2File_BytesZipFilebufferappendnamelistlenr   r   
setdefault_BytesTarFilegetnamesextractfilelzmaLZMAFiler"   ZstdDecompressorZstdCompressorr:   r   _BytesIOWrapperr   
_IOWrapperr   r>   r   r   reverserJ   )r   r;   r:   r<   r   r   r   r   ioargsrL   handlesis_pathr   r   	zip_namesfilesfiler  r   	open_argsr   rO   s                         rH   r   r     s:   z "7HxF {))co MM(&#F# %'F &&F
 #4F"GF%GF../"&&x0K $7s6{+&  ++--c26FKF"s&++'= KK3K & &#&&  # '   #	
 ' E! [[[[ #F E! # #F
 }}!!S(v&"MM224	y>Q&#]]//	@F"$'D[M%RSS$22;>  ) E!''<&#&&&GFG6FG
 ' "& fm4444fmm(((v&..0u:?!==44U1X>D+++!F$'G}%UVV$::?B  )  D  ]] #F F"-k:Dfkk!#T%:%:%N=M%NO	#T%8%8%L;K%LM	YY[[ F 4K=ACS/!fc****v	FC	 	  ??s&++5F &++.Fv Jv{{d*z&*/M/M __
 
z_V[[%I%I 
++6:..6:..'F __	
 	v v00#6M&:M:M

 fkk'&&"9"911235:
 	

 OOf77====v001   &&
 
rG   c                  R   ^  \ rS rSrSr\" 5       r\SS j5       rSU 4S jjr	Sr
U =r$ )_BufferedWriteri  z
Some objects do not support multiple .write() calls (TarFile and ZipFile).
This wrapper writes to the underlying buffer on close.
c                    g rY   r?   rZ   s    rH   write_to_buffer_BufferedWriter.write_to_buffer  s    '*rG   c                H  > U R                   (       a  g U R                  5       R                  (       a7  U R                  S5        U R                     U R                  5         S S S 5        OU R                  R                  5         [        TU ]  5         g ! , (       d  f       N= f)Nr   )closed	getbuffernbytesseekr  r*  rU   super)rV   	__class__s    rH   rU   _BufferedWriter.close  se    ;;>>""IIaL$$&  KK	 s   B
B!r?   rc   )r@   rA   rB   rC   rD   r   r  r   r*  rU   rF   __classcell__r2  s   @rH   r(  r(    s)    
 YF* * rG   r(  c                  l   ^  \ rS rSr    S           SU 4S jjjrS	S jrS
S jrSS jrSrU =r	$ )r  i  c                   > [         TU ]  5         X@l        Xl        [        R
                  R                  " SUU R                  U5      US.UD6U l        g )N)r   r;   r   r?   )	r1  __init__archive_namer   tarfileTarFiler   extend_moder  )rV   r   r;   r   r9  r   r2  s         rH   r8  _BytesTarFile.__init__  sV     	(	 (/';'; (
!!$'(
 	(
rG   c                    UR                  SS5      nUS:w  a  U$ U R                  b/  [        U R                  5      R                  nUS;   a
  U SUSS   3nU$ )Nr   r)   r   )r   r   r   :r   )r   r   r   suffix)rV   r;   r@  s      rH   r<  _BytesTarFile.extend_mode  s_    ||C$3;K99 $))_++F//q-rG   c                *   U R                   c  g[        U R                   5      nUR                  S:X  a  UR                  S5      R                   $ UR                  S;   a*  UR                  S5      R                  S5      R                   $ UR                   $ )z
If an explicit archive_name is not given, we still want the file inside the zip
file not to be named something.tar, because that causes confusion (GH39465).
Nr   r)   )r   r   r   )r   r   r@  with_suffixrV   r   s     rH   infer_filename_BytesTarFile.infer_filename  sz    
 99		???f$''+000__ BB''+77;@@@}}rG   c                    U R                   =(       d    U R                  5       =(       d    Sn[        R                  " US9n[	        U R                  5       5      Ul        U R                  R                  X 5        g )Nr   )r   )	r9  rE  r:  TarInfor  getvaluesizer  addfile)rV   r9  tarinfos      rH   r*  _BytesTarFile.write_to_buffer+  sR    ((JD,?,?,AJU//|44==?+G*rG   )r9  r  r   )Nr   NN)r   
str | Noner;   zLiteral['r', 'a', 'w', 'x']r   z-ReadBuffer[bytes] | WriteBuffer[bytes] | Noner9  rN  r   r   rd   re   )r;   r9   rd   r9   rd   rN  rc   )
r@   rA   rB   rC   r8  r<  rE  r*  rF   r4  r5  s   @rH   r  r    si      ,/AE#'

 *
 ?	

 !
 
 

 
.+ +rG   r  c                  X   ^  \ rS rSr S         SU 4S jjjrSS jrS	S jrSrU =r$ )
r  i3  c                   > [         TU ]  5         UR                  SS5      nX0l        UR	                  S[
        R                  5        [
        R                  " X40 UD6U l        g )Nr   r)   r<   )	r1  r8  r   r9  r  zipfileZIP_DEFLATEDZipFiler  )rV   r%  r;   r9  r   r2  s        rH   r8  _BytesZipFile.__init__4  sY     	||C$(-)=)=> (/(
 (
rG   c                "   [        U R                  R                  [        R                  [
        45      (       aV  [        U R                  R                  5      nUR                  S:X  a  UR                  S5      R                  $ UR                  $ g)z
If an explicit archive_name is not given, we still want the file inside the zip
file not to be named something.zip, because that causes confusion (GH39465).
r   r)   N)
rQ   r  r   ru   r   r9   r   r@  rC  r   rD  s     rH   rE  _BytesZipFile.infer_filenameI  sh    
 dkk**R[[#,>??DKK001H&(++B/444== rG   c                    U R                   =(       d    U R                  5       =(       d    SnU R                  R                  XR	                  5       5        g )Nr   )r9  rE  r  writestrrI  )rV   r9  s     rH   r*  _BytesZipFile.write_to_bufferU  s8    ((JD,?,?,AJU\==?;rG   )r9  r  rY   )
r%  z1FilePath | ReadBuffer[bytes] | WriteBuffer[bytes]r;   r9   r9  rN  r   r   rd   re   rO  rc   )	r@   rA   rB   rC   r8  rE  r*  rF   r4  r5  s   @rH   r  r  3  sQ    
 $(	
?
 
 !	

 
 

 
*
< <rG   r  c                  F    \ rS rSrS	S jrS
S jrSS jrSS jrSS jrSr	g)r  i[  c                    Xl         g rY   r  )rV   r  s     rH   r8  _IOWrapper.__init__b  s    rG   c                .    [        U R                  U5      $ rY   getattrr  )rV   r   s     rH   __getattr___IOWrapper.__getattr__e      t{{D))rG   c                n    [        U R                  S5      (       a  U R                  R                  5       $ g)Nr  T)r   r  r  rZ   s    rH   r  _IOWrapper.readableh  )    4;;
++;;''))rG   c                n    [        U R                  S5      (       a  U R                  R                  5       $ g)Nr  T)r   r  r  rZ   s    rH   r  _IOWrapper.seekablem  rg  rG   c                n    [        U R                  S5      (       a  U R                  R                  5       $ g)Nr  T)r   r  r  rZ   s    rH   r  _IOWrapper.writabler  rg  rG   r]  N)r  r    rd   re   )r   r9   rd   r   )rd   r=   )
r@   rA   rB   rC   r8  rb  r  r  r  rF   r?   rG   rH   r  r  [  s    *

rG   r  c                  :    \ rS rSrSSS jjrS	S jrS
SS jjrSrg)r  ix  c                *    Xl         X l        SU l        g )NrG   r  r:   overflow)rV   r  r:   s      rH   r8  _BytesIOWrapper.__init__{  s     
 rG   c                .    [        U R                  U5      $ rY   r`  )rV   attrs     rH   rb  _BytesIOWrapper.__getattr__  rd  rG   c                   U R                   c   eU R                   R                  U5      R                  U R                  5      nU R                  U-   nUb  US:  d  U[        U5      :  a	  SU l        U$ US U nX1S  U l        U$ )Nr   rG   )r  r   encoder:   ro  r  )rV   n
bytestringcombined_bytestring	to_returns        rH   r   _BytesIOWrapper.read  s    {{&&&[[%%a(//>
"mmj89Ac*=&>!>DM&&+BQ/I/3DMrG   rn  N)r   )r  zStringIO | TextIOBaser:   r9   rd   re   )rr  r9   rd   r   ))rv  z
int | Nonerd   r   )r@   rA   rB   rC   r8  rb  r   rF   r?   rG   rH   r  r  x  s    * rG   r  c                    / nU[        U S5      =(       d    [        U [        5      -  nU(       d  XU4$ [        [        U 5      n [        U [        5      (       a  [        U S5      n UR                  U 5         [        [        R                  " U R                  5       S[        R                  S95      n[        U5       H  n U R                  5         M     X1U/4$ ! [        U5       H  n U R                  5         M     f = f)zTry to memory map file/buffer.filenor  r   )access)r   rQ   r9   r   r!   r   r  r  r   r}  ACCESS_READreversedrU   )rL   r   r!  wrappeds       rH   r  r    s     !#G'&(+Fz&#/FFJ7** -(F &#fd#v II''
 w'FLLN ( 	))	 w'FLLN (s   7;C $C=c                    Sn[        U 5      n [        U [        5      (       d  U$  [        R                  R                  U 5      nU$ ! [        [        4 a     U$ f = f)zTest whether file exists.F)r   rQ   r9   ru   rv   existsr   r   )r8   r  s     rH   file_existsr    sc    F'(:;(#.. 23 M z" Ms   A AAc                   SU;   d  SU;   a  SU;   $ [         R                  [         R                  [         R                  4n[	        [        U 5      U5      (       a  g[        U [        5       5      =(       d    S[        U SU5      ;   $ )z+Whether the handle is opened in binary moder   r   Fr;   )	r
  StreamWriterStreamReaderStreamReaderWriter
issubclassr   rQ   _get_binary_io_classesra  )rL   r;   text_classess      rH   r	  r	    s     d{cTkd{
 	!!	L $v,--f467 3'C < rG   c                     [         [        4n [        SSS9nUb9  UR                  5       R	                  S5       nU [        U5      4-  n SSS5        U $ U $ ! , (       d  f       U $ = f)z!IO classes that that expect bytesr  ignore)r   NrG   )r
   r   r"   r  stream_readerr   )binary_classesr   r   s      rH   r  r    sn     )7	'BN &k(CD""$22376tF|o-N 8 > 87 s   A
A$c                   ^ Ub  [        U[        5      (       a  [        5       mO[        U5      m[        [        U 5      =(       a1    [        U [        5      (       + =(       a    [        U4S jU  5       5      5      $ )au  
Check whether or not the `columns` parameter
could be converted into a MultiIndex.

Parameters
----------
columns : array-like
    Object which may or may not be convertible into a MultiIndex
index_col : None, bool or list, optional
    Column or columns to use as the (possibly hierarchical) index

Returns
-------
bool : Whether or not columns could become a MultiIndex
c              3  R   >#    U  H  oT;  d  M
  [        U[        5      v   M     g 7frY   )rQ   r   )r{   cindex_columnss     rH   r}   +is_potential_multi_index.<locals>.<genexpr>	  s#     Pg-9O$
1e$$gs   	'')rQ   r=   setr  r(   r   )columns	index_colr  s     @rH   is_potential_multi_indexr    sb    & Jy$77IG 	Q7M22	QPgPP rG   c                "   [        U 5      n [        [        5      n[        U 5       He  u  p4X$   nUS:  aK  US-   X$'   U(       a*  [	        U[
        5      (       d   e/ USS QUS    SU 3P7nOU SU 3nX$   nUS:  a  MK  X@U'   US-   X$'   Mg     U $ )a  
Rename column names if duplicates exist.

Currently the renaming is done by appending a period and an autonumeric,
but a custom pattern may be supported in the future.

Examples
--------
>>> dedup_names(["x", "y", "x", "x"], is_potential_multiindex=False)
['x', 'y', 'x.1', 'x.2']
r   r   Nr{  .)rh   r   r   	enumeraterQ   r   )namesis_potential_multiindexcountsr|   col	cur_counts         rH   dedup_namesr    s     KE)4S)9FE"K	!m#a-FK&!#u----;CR;SWIQyk":;Qyk*I !m a!m #" LrG   )rn   objectrd   r=   )r8   r9   rd   r9   )r8   r*   rd   r*   )r8   str | BaseBufferTrd   r  )r   r  rd   re   ).)r8   r/   r   r=   rd   r9   )r8   r*   r   r=   rd   r*   )F)r8   zFilePath | BaseBufferTr   r=   rd   r  )r   r   r   r   rd   r   )rn   FilePath | BaseBufferrd   r=   )r   Nr   N)r8   r  r:   r9   r<   CompressionOptions | Noner;   r9   r   StorageOptions | Nonerd   r5   )rv   r9   rd   r9   )r<   r.   rd   z"tuple[str | None, CompressionDict])r8   r  r<   rN  rd   rN  )rv   z
Path | strrd   re   )r   r  r;   r9   r:   rN  r<   r.   r   r=   r   zLiteral[False]r   rN  r   r1   rd   zIOHandles[bytes])r   r  r;   r9   r:   rN  r<   r.   r   r=   r   zLiteral[True]r   rN  r   r1   rd   zIOHandles[str])r   r  r;   r9   r:   rN  r<   r.   r   r=   r   r=   r   rN  r   r1   rd   !IOHandles[str] | IOHandles[bytes])r   r  r;   r9   r:   rN  r<   r  r   r=   r   r=   r   rN  r   r  rd   r  )rL   r7   r   r=   rd   z/tuple[str | BaseBuffer, bool, list[BaseBuffer]])r8   r  rd   r=   )rL   r  r;   r9   rd   r=   )rd   ztuple[type, ...]rY   )r  zSequence[Hashable] | MultiIndexr  zbool | Sequence[int] | Nonerd   r=   )r  Sequence[Hashable]r  r=   rd   r  )mrD   
__future__r   abcr   r   r
  collectionsr   collections.abcr   r   r	   rf   	functoolsr   ior
   r   r   r   r   r   r   ru   pathlibr   rer:  typingr   r   r   r   r   r   r   r   r   r   urllib.parser   r   rj   r   r   r   r   rR  pandas._typingr    r!   pandas.compat._optionalr"   pandas.util._exceptionsr#   pandas.core.dtypes.commonr$   r%   r&   r'   pandas.core.dtypes.genericr(   r  rl   discardcompiler   r*   typesr,   r-   r.   r/   r0   r1   r2   pandasr3   	dataclassr5   rJ   ro   rr   r   r   r   r   r   r   r   valuesr   r   r   r   r   r(  r  r  r  r  r  r  r	  	lru_cacher  r  r  r?   rG   rH   <module>r     s^    "  # 
      	  	       ? 4  5-+-;<   B jj!WX m:6 #  " 	 	 	 . . .b0$ 
 5 
 5 
 E 
 E&C: 
<? 59 

 
?B#8< 
 $,.,, ,D3	 -1-1L-LL +L 	L
 +L L^0& 
  6==?@  0# 0' 0FD-D<FDDNV 

 &)&)
&


 	

 $
 
 
 
 $
 
 

 

 &) &)
&


 	

 $
 
 
 
 $
 
 

 

 &)&)
,&
,

, 	
,
 $
, 
, 
, 
, $
, '
, 

,"  -1-1e&e
e 	e
 +e e e e +e 'eP	gs 26+O 6+r%<O %<P : :!*!**.!*4!*H*  & .2,* 
>""8<""rG   