
    Mh              
      ^   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K4J5r5J6r6  SSK7J8r8  SSK9J:r:  SSK;J<r<  SSK=J>r>J?r?J@r@JArA  SSKBJCrC  SSKDJErE  \F" \.\,-   \--   5      rG\GR                  S5        \R                  " S5      rJ\%" S\2S9rK\(       a  SSKLJMrM  SSK1JNrNJOrOJPrPJQrQJRrRJSrS  SSKTJUrU  \R                   " S S5      5       rW\R                   " S S\#\!   5      5       rXSSS jrY\'STS  j5       rZ\'SUS! j5       rZSVS" jrZSWS# jr[\'SXSYS% jj5       r\\' SX     SZS& jj5       r\ S[     S\S( jjr\S) r]S]S* jr^\:" \ES+   \ES,   S-  S-9    S^           S_S. jj5       r_S`S/ jr`S0S0S0S0S1S2S3S4S5S6.	ra\F" \aR                  5       5      rc    SaS7 jrd\:" \ES,   S-  S89      SbS9 j5       reScS: jrf\'S$S$S$S$S$S;.                 SdS= jj5       rg\'S$S$S$S$S$S$S>.                 SeS? jj5       rg\'S$S$S$S$S$S$S>.                 SfS@ jj5       rg\:" \ES,   S<-  S89SSS'SASSS>.                 SgSB jj5       rg " SC SD\\5      rh " SE SF\h5      ri " SG SH\h5      rj " SI SJ5      rk " SK SL5      rl      ShSM jrmSiSN jrnSjSO jro\R                  SkSP j5       rq Sl     SmSQ jjrr      SnSR jrsg)ozCommon IO 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)get_bz2_fileget_lzma_file)import_optional_dependency)doc)find_stack_level)is_boolis_file_like
is_integeris_list_like)ABCMultiIndex)_shared_docs z^[A-Za-z][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)IOArgsa   z7
Return value of io/common.py:_get_filepath_or_buffer.
str | BaseBufferfilepath_or_bufferstrencodingmoder1   compressionFboolshould_close N)__name__
__module____qualname____firstlineno____doc____annotations__rB   __static_attributes__rC       B/var/www/html/env/lib/python3.13/site-packages/pandas/io/common.pyr9   r9   a   s)     )(M
I  L$rK   r9   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)	IOHandlesn   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]handler1   r@   )default_factoryzlist[IO[bytes] | IO[str]]created_handlesFrA   
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)	rS   
isinstancerP   r   flushdetachrR   removeclose)selfrP   s     rL   rY   IOHandles.close   s     ??dkk=9999KKKK   ''4**FLLN +!rK   c                    U $ NrC   rZ   s    rL   	__enter__IOHandles.__enter__   s    rK   c                $    U R                  5         g r]   )rY   )rZ   exc_type	exc_value	tracebacks       rL   __exit__IOHandles.__exit__   s     	

rK   )rR   rS   NreturnNone)rh   zIOHandles[AnyStr])rb   ztype[BaseException] | Nonerc   zBaseException | Nonerd   zTracebackType | Nonerh   ri   )rD   rE   rF   rG   rH   rI   dataclassesfieldlistrR   rS   rY   r_   re   rJ   rC   rK   rL   rN   rN   n   sk       1<1B1BSW1XO.XJ ", ( (	
 
rK   rN   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)rU   r=   	parse_urlscheme_VALID_URLSurls    rL   is_urlrs      s)     c3S>  K//rK   r<   c                    g r]   rC   r<   s    rL   _expand_userrv          rK   c                    g r]   rC   ru   s    rL   rv   rv      rw   rK   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
)rU   r=   ospath
expanduserru   s    rL   rv   rv      s.     $c**ww!!"455rK   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   NrC   ).0is     rL   	<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    rL   validate_header_argr      s    ~&c6"A:9  	Fu-h'3z6*++IJJ%f%%%WXXv4
 	
 A
BBrK   .c                    g r]   rC   r<   convert_file_likes     rL   stringify_pathr      rw   rK   c                    g r]   rC   r   s     rL   r   r      s     rK   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.   rU   rz   PathLike
__fspath__rv   r   s     rL   r   r      sO    . .@!A!A K!344$bkk22/::<*++rK   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      rL   r   r     s!    
 >>!!42622rK   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://)rU   r=   rA   _RFC_3986_PATTERNmatch
startswithrq   s    rL   is_fsspec_urlr   $  sA     	3 	8"((-.	8677rK   storage_optionscompression_options)r   r   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  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, py.path.local or pathlib.Path),
                     or buffer
{compression_options}

    .. versionchanged:: 1.4.0 Zstandard support.

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

{storage_options}


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 tr   )headerszContent-Encodinggzipr   T)r<   r>   r@   rB   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UnicodeWarningrU   r=   rs   r   r   Requestr   r   getr   r   r9   r   r   replacer$   botocore.exceptionsr   r   PermissionErrorImportErroropentupler   bytesmmaprv   type)r<   r>   r@   r?   r   compression_methodfsspec_moder   req_inforeqcontent_encodingreaderr   err_types_to_retry_with_anonr   r   file_objmsgs                     rL   _get_filepath_or_bufferr   0  s   > ((:; '=[&I#*+=R g&8'BBsRVR')	

 "{>K
 	t-/,,mCH:N')	
 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 K-K/ 
,K? 
K,/
K<;K<?AMM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   )r{   r   s     rL   file_path_to_urlr     s     ,7L.//rK   tarr   r   zipr   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)rU   r   r   popKeyErrorr   )r@   compression_argsr   errs       rL   r   r     sx    . +w'',	X!1!5!5h!? // (//  	XMNTWW	Xs   = 
AAA)r   c                H   Uc  gUS:X  af  [        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      -   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_options}

    .. versionchanged:: 1.4.0 Zstandard support.

Returns
-------
string or None

Raises
------
ValueError on invalid compression specified.
NinferT)r   Unrecognized compression type: z
Valid compression types are )
r   rU   r=   extension_to_compressionitemslowerendswith_supported_compressionssortedr   )r<   r@   	extensionvalidr   s        rL   r   r   &  s    4  g+,>RVW,c22 '?&D&D&F"I!'')229=="" 'G  --dOf%<==E
)+ 7'',g	/  S/rK   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)r{   r   s     rL   check_parent_directoryr   ]  s9     $ZF==??J6(RSTUU rK   )r>   r@   
memory_maperrorsr   path_or_bufc                   g r]   rC   r   r?   r>   r@   r   is_textr   r   s           rL   
get_handler   k       rK   )r>   r@   r   r   r   r   c                   g r]   rC   r   s           rL   r   r   z  r   rK   c                   g r]   rC   r   s           rL   r   r     r   rK   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aj  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  [#        5       " U	4SUR                  0UD6n	GOdUS:X  a  [%        XR                  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&                  R/                  UR                  5       5      n	GOU(       d  [1        SU  35      e[1        SU 35      eGOUS:X  Ga  UR3                  SUR                  5        [        U	[        5      (       a  [5        S)SU	0UD6n	O[5        S)SU	0UD6n	[        U	[4        5      (       d   eSU	R&                  R                  ;   a  U
R)                  U	5        U	R&                  R7                  5       n[-        U5      S:X  a&  U	R&                  R9                  US   5      nUc   eUn	OU(       d  [1        SU  35      e[1        SU 35      eOUS:X  a  [;        5       " XR                  40 UD6n	OzUS:X  ad  [=        S5      nSUR                  ;   a  SUR>                  " S)0 UD60nOSUR@                  " S)0 UD60nUR.                  " U	4SUR                  0UD6n	OSU 3n[1        U5      e[        U	[        5      (       a   eU
R)                  U	5        O~[        U	[        5      (       ai  URB                  (       a2  SUR                  ;  a"  [/        U	UR                  URB                  US	S9n	O[/        XR                  5      n	U
R)                  U	5        SnU(       d:  UR                  S :X  a*  [        U	[D        5      (       a  [G        U	URB                  S!9n	OU(       a  U(       d!  U(       d  [        XR                  5      (       a  [I        U	S"5      (       a"  [I        U	S#5      (       a  [I        U	S$5      (       d  [K        U	5      n	[M        U	URB                  US	S9n	U
R)                  U	5        [        UR                  [        5      =(       d    URN                  (       + nSUR                  ;   a3  [I        U	S%5      (       d"  [Q        S&[S        UR                  5       S'35      eU
RU                  5         URN                  (       a<  [        UR                  [        5      (       a   eU
R)                  UR                  5        [W        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_options}

       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'.

    .. versionchanged:: 1.4.0 Zstandard support.

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?   r      zZero files found in ZIP file z9Multiple files found in ZIP file. Only one file per ZIP: r   namer  r   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)rP   rR   rS   r@   rC   ),_is_binary_modecodecslookuprU   r=   lookup_errorr   r<   _maybe_memory_mapr   r@   r   r   r?   r   r   GzipFiler"   _BytesZipFilebufferappendnamelistlenr   r   
setdefault_BytesTarFilegetnamesextractfiler#   r$   ZstdDecompressorZstdCompressorr>   r   _BytesIOWrapperr   
_IOWrapperr   rB   r   r   reverserN   )r   r?   r>   r@   r   r   r   r   ioargsrP   handlesis_pathr   	zip_namesfilesfiler   	open_argsr   rS   s                       rL   r   r     s&   d "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! #'7F }}!!S(v&"MM224	y>Q&#]]//	@F"$'D[M%RSS$22;>  ) E!''<&#&&&GFG6FG
 ' "&6 fm4444fmm(((v&..0u:?!==44U1X>D+++!F$'G}%UVV$::?B  )  D  #_'7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   &&
 
rK   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 r]   rC   r^   s    rL   write_to_buffer_BufferedWriter.write_to_buffer  s    rK   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,  rY   super)rZ   	__class__s    rL   rY   _BufferedWriter.close  se    ;;>>""IIaL$$&  KK	 s   B
B!rC   rg   )rD   rE   rF   rG   rH   r   r  r   r,  rY   rJ   __classcell__r4  s   @rL   r*  r*    s-    
 YF  rK   r*  c                  h   ^  \ 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  rC   )	r3  __init__archive_namer  tarfileTarFiler   extend_moder  )rZ   r  r?   r  r;  r   r4  s         rL   r:  _BytesTarFile.__init__  sV     	(	 (/';'; (
!!$'(
 	(
rK   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)rZ   r?   rB  s      rL   r>  _BytesTarFile.extend_mode  s_    ||C$3;K99 $))_++F//q-rK   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   rB  with_suffixrZ   r  s     rL   infer_filename_BytesTarFile.infer_filename  sz    
 99		???f$''+000__ BB''+77;@@@}}rK   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  )	r;  rG  r<  TarInfor  getvaluesizer  addfile)rZ   r;  tarinfos      rL   r,  _BytesTarFile.write_to_buffer  sR    ((JD,?,?,AJU//|44==?+G*rK   )r;  r  r  )Nr  NN)
r  
str | Noner?   zLiteral['r', 'a', 'w', 'x']r  z-ReadBuffer[bytes] | WriteBuffer[bytes] | Noner;  rP  rh   ri   )r?   r=   rh   r=   rh   rP  rg   )
rD   rE   rF   rG   r:  r>  rG  r,  rJ   r6  r7  s   @rL   r  r    s_      ,/AE#'

 *
 ?	

 !
 

 
(+ +rK   r  c                  T   ^  \ 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  i  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@   )	r3  r:  r   r;  r  zipfileZIP_DEFLATEDZipFiler  )rZ   r'  r?   r;  r   r4  s        rL   r:  _BytesZipFile.__init__  sY     	||C$(-)=)=> (/(
 (
rK   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)
rU   r  r  rz   r   r=   r   rB  rE  r  rF  s     rL   rG  _BytesZipFile.infer_filename  sh    
 dkk**R[[#,>??DKK001H&(++B/444== rK   c                    U R                   =(       d    U R                  5       =(       d    SnU R                  R                  XR	                  5       5        g )Nr   )r;  rG  r  writestrrK  )rZ   r;  s     rL   r,  _BytesZipFile.write_to_buffer  s8    ((JD,?,?,AJU\==?;rK   )r;  r  r]   )r'  z1FilePath | ReadBuffer[bytes] | WriteBuffer[bytes]r?   r=   r;  rP  rh   ri   rQ  rg   )	rD   rE   rF   rG   r:  rG  r,  rJ   r6  r7  s   @rL   r  r    sG    
 $(	
?
 
 !	
 

 
$
< <rK   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 r]   r  )rZ   r  s     rL   r:  _IOWrapper.__init__*  s    rK   c                .    [        U R                  U5      $ r]   getattrr  )rZ   r  s     rL   __getattr___IOWrapper.__getattr__-      t{{D))rK   c                n    [        U R                  S5      (       a  U R                  R                  5       $ g)Nr  T)r   r  r  r^   s    rL   r  _IOWrapper.readable0  )    4;;
++;;''))rK   c                n    [        U R                  S5      (       a  U R                  R                  5       $ g)Nr  T)r   r  r  r^   s    rL   r  _IOWrapper.seekable5  ri  rK   c                n    [        U R                  S5      (       a  U R                  R                  5       $ g)Nr  T)r   r  r  r^   s    rL   r  _IOWrapper.writable:  ri  rK   r_  N)r  r    rh   ri   )r  r=   )rh   rA   )
rD   rE   rF   rG   r:  rd  r  r  r  rJ   rC   rK   rL   r   r   #  s    *

rK   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  i@  c                *    Xl         X l        SU l        g )NrK   r  r>   overflow)rZ   r  r>   s      rL   r:  _BytesIOWrapper.__init__C  s     
 rK   c                .    [        U R                  U5      $ r]   rb  )rZ   attrs     rL   rd  _BytesIOWrapper.__getattr__L  rf  rK   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   rK   )r  r   encoder>   rq  r  )rZ   n
bytestringcombined_bytestring	to_returns        rL   r   _BytesIOWrapper.readO  s    {{&&&[[%%a(//>
"mmj89Ac*=&>!>DM&&+BQ/I/3DMrK   rp  N)r   )r  zStringIO | TextIOBaser>   r=   rh   ri   )rt  r=   ))rx  z
int | Nonerh   r   )rD   rE   rF   rG   r:  rd  r   rJ   rC   rK   rL   r  r  @  s    * rK   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   rU   r=   r   r!   r   r  r   r   r  ACCESS_READreversedrY   )rP   r   r#  wrappeds       rL   r  r  ]  s     !#G'&(+Fz&#/FFJ7** -(F &#fd#v II4+;+;
 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   rU   r=   rz   r{   existsr   r   )r<   r  s     rL   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   rU   _get_binary_io_classesrc  )rP   r?   text_classess      rL   r  r    s     d{cTkd{
 	!!	L $v,--f467 3'C < rK   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   NrK   )r
   r   r$   r  stream_readerr   )binary_classesr   r   s      rL   r  r    sn     )7	'BN &k(CD""$22376tF|o-N 8 > 87 s   A
A$c                   ^ Tb  [        T[        5      (       a  / 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  d   >#    U  H%  o[        T5      ;  d  M  [        U[        5      v   M'     g 7fr]   )rl   rU   r   )r   c	index_cols     rL   r   +is_potential_multi_index.<locals>.<genexpr>  s'     Rg$y/9Q$
1e$$gs   00)rU   rA   r  r+   r   )columnsr  s    `rL   is_potential_multi_indexr    sW    & Jy$77	G 	S7M22	SRgRR rK   c                    [        U 5      n [        [        5      n[        U 5       Hd  u  p4X$   nUS:  aJ  US-   X$'   U(       a)  [	        U[
        5      (       d   eUSS US    SU 34-   nOU SU 3nX$   nUS:  a  MJ  X@U'   US-   X$'   Mf     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}  .)rl   r   r   	enumeraterU   r   )namesis_potential_multiindexcountsr   col	cur_counts         rL   dedup_namesr    s     KE)4S)9FE"K	!m#a-FK&!#u----#2hSWIQyk":!<<Qyk*I !m a!m #" LrK   )rr   objectrh   rA   )r<   r=   rh   r=   )r<   r.   rh   r.   )r<   str | BaseBufferTrh   r  )r   r  rh   ri   ).)r<   r3   r   rA   rh   r=   )r<   r.   r   rA   rh   r.   )F)r<   zFilePath | BaseBufferTr   rA   rh   r  )rr   FilePath | BaseBufferrh   rA   )r   Nr  N)r<   r  r>   r=   r@   CompressionOptions | Noner?   r=   r   StorageOptions | Nonerh   r9   )r{   r=   rh   r=   )r@   r2   rh   z"tuple[str | None, CompressionDict])r<   r  r@   rP  rh   rP  )r{   z
Path | strrh   ri   )r   r  r?   r=   r>   rP  r@   r2   r   rA   r   zLiteral[False]r   rP  r   r5   rh   zIOHandles[bytes])r   r  r?   r=   r>   rP  r@   r2   r   rA   r   zLiteral[True]r   rP  r   r5   rh   zIOHandles[str])r   r  r?   r=   r>   rP  r@   r2   r   rA   r   rA   r   rP  r   r5   rh   !IOHandles[str] | IOHandles[bytes])r   r  r?   r=   r>   rP  r@   r  r   rA   r   rA   r   rP  r   r  rh   r  )rP   r;   r   rA   rh   z/tuple[str | BaseBuffer, bool, list[BaseBuffer]])r<   r  rh   rA   )rP   r  r?   r=   rh   rA   )rh   ztuple[type, ...]r]   )r  zSequence[Hashable] | MultiIndexr  zbool | Sequence[int] | Nonerh   rA   )r  Sequence[Hashable]r  rA   rh   r  )trH   
__future__r   abcr   r   r  collectionsr   collections.abcr   r   r	   rj   	functoolsr   ior
   r   r   r   r   r   r   rz   pathlibr   rer<  typingr   r   r   r   r   r   r   r   r   r   urllib.parser   r   rn   r   r   r   r   rT  pandas._typingr    r!   pandas.compatr"   r#   pandas.compat._optionalr$   pandas.util._decoratorsr%   pandas.util._exceptionsr&   pandas.core.dtypes.commonr'   r(   r)   r*   pandas.core.dtypes.genericr+   pandas.core.shared_docsr,   setrp   discardcompiler   r.   typesr0   r1   r2   r3   r4   r5   r6   pandasr7   	dataclassr9   rN   rs   rv   r   r   r   r   r   r   r   valuesr   r   r   r   r   r*  r  r  r   r  r  r  r  	lru_cacher  r  r  rC   rK   rL   <module>r     s    "  # 
      	  	       ? ' 4  5 0-+-;<   B JJ?@ m:6 #  " 	 	 	 . . .b0$ 
 
 
 
&C: 
 
 
?B#8< 
 $,.,, ,D3	  !23$%:;>RR -1-1l-ll +l 	l
 +l l	l^0& 
  6==?@  0# 0' 0F &;<?SST3-3<F33 U3lV 

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

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

 &)&)&
 	
 $    $ ' 
 &;<}LM
  -1-1P&P
P 	P
 +P P P P +P 'P NPjgs 43+O 3+l"<O "<J : :***.*4*D*  & .2,* 
:""8<""rK   