1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
U
¬ý°dq£ã @sàdZddlmZddlmZmZddlZddlmZddl    Z    ddl
Z
ddl Z ddl m Z mZmZmZmZmZddlZddlZddlmZddlZddlZddlmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%dd    l&m'Z'm(Z)m*Z*m+Z+m,Z,ddl-Z-ddl.Z.dd
l/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7dd l8m9Z9dd l:m;Z;dd l<m=Z>ddl?m@Z@ddlAmBZBddlCmDZDmEZEmFZFmGZGddlHmIZIddlJmKZKeLe,e*e+ƒZMeM Nd¡e Od¡ZPe#de0dZQe    jRGdd„dƒƒZSe    jRGdd„deeƒƒZTdddœdd„ZUe%d d d!œd"d#„ƒZVe%ddd!œd$d#„ƒZVd%d%d!œd&d#„ZVdd'd(œd)d*„ZWe%dŠd,dd d-œd.d/„ƒZXe%d‹dddd-œd0d/„ƒZXdŒd2dd%d-œd3d/„ZXd4d5„ZYd6ddœd7d8„ZZe@eKd9eKd:d;d<dd6d d?d d@ddAœdBdC„ƒZ[d d dDœdEdF„Z\dGdGdGdGdHdIdJdKdLdMœ    Z]eLe] ^¡ƒZ_d?dNdOœdPdQ„Z`e@eKd:d;dRd6dSdSdTœdUdV„ƒZadWd'dDœdXdY„Zbe%d+d+d+d+d+dZœd6d dSd?dd[dSd@d\d]œ    d^d_„ƒZce%d+d+d+d+d+d+d`œd6d dSd?ddadSd@dbd]œ    dcd_„ƒZce%d+d+d+d+d+d+d`œd6d dSd?dddSd@ddd]œ    ded_„ƒZce@eKd:dfdRddd1dgddd`œd6d dSd?dddSd@ddd]œ    dhd_„ƒZcGdidj„djeeƒZdGdkdl„dledƒZeGdmdn„dnedƒZfGdodp„dpƒZgGdqdr„drƒZhdsddtduœdvdw„Zid6dd!œdxdy„Zjd6d ddzœd{d|„Zke
jld}d~œdd€„ƒZmdŽdd‚ddƒœd„d…„Znd†dd†d‡œdˆd‰„ZodS)zCommon IO api utilitiesé)Ú annotations)ÚABCÚabstractmethodN)Ú defaultdict)ÚBufferedIOBaseÚBytesIOÚ    RawIOBaseÚStringIOÚ
TextIOBaseÚ TextIOWrapper)ÚPath) ÚIOÚAnyÚAnyStrÚ DefaultDictÚGenericÚHashableÚLiteralÚMappingÚSequenceÚTypeVarÚcastÚoverload)ÚurljoinÚurlparseÚ uses_netlocÚ uses_paramsÚ uses_relative)Ú
BaseBufferÚCompressionDictÚCompressionOptionsÚFilePathÚ
ReadBufferÚ ReadCsvBufferÚStorageOptionsÚ WriteBuffer)Ú get_lzma_file)Úimport_optional_dependency)ÚBZ2File)Údoc)Úfind_stack_level)Úis_boolÚ is_file_likeÚ
is_integerÚ is_list_like)Ú
MultiIndex)Ú _shared_docsÚz^[A-Za-z][A-Za-z0-9+\-+.]*://Ú BaseBufferT)Úboundc@s>eZdZUdZded<ded<ded<ded<d    Zd
ed <d S) ÚIOArgsz?
    Return value of io/common.py:_get_filepath_or_buffer.
    ústr | BaseBufferÚfilepath_or_bufferÚstrÚencodingÚmoderÚ compressionFÚboolÚ should_closeN)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú__annotations__r<©rBrBúGd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/io/common.pyr4Ss
r4c@sneZdZUdZded<ded<ejedZded<d    Z    d
ed <d d œdd„Z
dd œdd„Z dd dœdd„Z dS)Ú    IOHandlesau
    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]Úhandlerr:)Údefault_factoryzlist[IO[bytes] | IO[str]]Úcreated_handlesFr;Ú
is_wrappedÚNone©ÚreturncCs\|jr8t|jtƒst‚|j ¡|j ¡|j |j¡|jD] }|     ¡q>g|_d|_dS)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)
rHÚ
isinstancerEr ÚAssertionErrorÚflushÚdetachrGÚremoveÚclose)ÚselfrErBrBrCrQus
 
 
 
zIOHandles.closezIOHandles[AnyStr]cCs|S©NrB©rRrBrBrCÚ    __enter__†szIOHandles.__enter__r)ÚargsrKcGs | ¡dSrS)rQ)rRrVrBrBrCÚ__exit__‰szIOHandles.__exit__N) r=r>r?r@rAÚ dataclassesÚfieldÚlistrGrHrQrUrWrBrBrBrCrD`s
 rDÚobjectr;)ÚurlrKcCst|tƒsdSt|ƒjtkS)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)rLr7Ú    parse_urlÚschemeÚ _VALID_URLS©r\rBrBrCÚis_urls
rar7)r6rKcCsdSrSrB©r6rBrBrCÚ _expand_userŸsrccCsdSrSrBrbrBrBrCrc¤szstr | BaseBufferTcCst|tƒrtj |¡S|S)a]
    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
    )rLr7ÚosÚpathÚ
expanduserrbrBrBrCrc©s
 rI)ÚheaderrKcCs˜|dkr dSt|ƒr2tt|ƒ}|dkr.tdƒ‚dSt|ddr|tt|ƒ}ttt|ƒƒs^tdƒ‚tdd„|Dƒƒrxtdƒ‚dSt    |ƒrŒt
d    ƒ‚tdƒ‚dS)
NrzUPassing negative integer to header is invalid. For no header, use header=None insteadF)Z
allow_setsz*header must be integer or list of integerscss|]}|dkVqdS)rNrB)Ú.0ÚirBrBrCÚ    <genexpr>Ìsz&validate_header_arg.<locals>.<genexpr>z8cannot specify multi-index header with negative integersz–Passing 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)rgrBrBrCÚvalidate_header_arg¼s*
ÿ 
ÿrq.r!)r6Úconvert_file_likerKcCsdSrSrB©r6rrrBrBrCÚstringify_pathÙsrtcCsdSrSrBrsrBrBrCrtÞsFzFilePath | BaseBufferTcCs2|st|ƒrtt|ƒSt|tjƒr*| ¡}t|ƒS)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 (python 3.6+) 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,rr2rLrdÚPathLikeÚ
__fspath__rcrsrBrBrCrtås
 
 cOsddl}|jj||ŽS)z`
    Lazy-import wrapper for stdlib urlopen, as that imports a big chunk of
    the stdlib.
    rN)Úurllib.requestÚrequestÚurlopen)rVÚkwargsÚurllibrBrBrCrysryzFilePath | BaseBuffercCs$t|tƒo"tt |¡ƒo"| d¡ S)zR
    Returns true if the given URL looks like
    something fsspec can handle
    )zhttp://zhttps://)rLr7r;Ú_RFC_3986_PATTERNÚmatchÚ
startswithr`rBrBrCÚ is_fsspec_urls
 
 ÿ
ýrÚstorage_optionsÚcompression_optionsr6)r€rúutf-8Úrr r$)r6r8r:r9r€rKc    CsÐt|ƒ}t|ƒ\}}t||ƒ}|rJt|dƒrJd|krJtjdttƒdd}t||d}d|krŠ|dkrŠ|d    krŠtj|›d
|›t    tƒd|}d |kr¦d|kr¦|d7}t
|t ƒr.t |ƒr.|pÂi}d dl }|jj||d }t|ƒ2}    |    j dd¡}
|
dkrddi}t|     ¡ƒ} W5QRXt| ||d|dSt|ƒrXt
|t ƒsHt‚| d¡r`| dd¡}| d¡rx| dd¡}tdƒ} g} z&tdƒd dlm}m}||tg} Wntk
rÀYnXz$| j |fd|i|pÚi—Ž  ¡}Wn^t!| ƒk
rD|dkrddi}nt|ƒ}d|d<| j |fd|i|p6i—Ž  ¡}YnXt|||d|dS|rft"dƒ‚t
|t t#t$j$fƒrtt%|ƒ||d|dSt|dƒs¾t|dƒs¾dt&|ƒ›}t"|ƒ‚t|||d|dS)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}
 
        .. versionadded:: 1.2.0
 
    ..versionchange:: 1.2.0
 
      Returns the dataclass IOArgs.
    ÚwriteÚbzDcompression has no effect when passing a non-binary object as input.)Ú
stacklevelN)ÚmethodÚw)Úbz2Úxz)zutf-16zutf-32z( will not write the byte order mark for Útr)ÚheaderszContent-EncodingÚgzipr‡T)r6r8r:r<r9zs3a://zs3://zs3n://ÚfsspecZbotocore)Ú ClientErrorÚNoCredentialsErrorr9Zanonz?storage_options passed with file object or non-fsspec file pathFÚreadz)Invalid file path or buffer object type: )'rtÚget_compression_methodÚinfer_compressionÚhasattrÚwarningsÚwarnÚRuntimeWarningr*ÚdictÚUnicodeWarningrLr7rarwrxÚRequestryrŒÚgetrr‘r4rrMr~Úreplacer'Zbotocore.exceptionsrrÚPermissionErrorÚ ImportErrorÚopenÚtuplerlÚbytesÚmmaprcÚtype)r6r8r:r9r€Úcompression_methodZ fsspec_moder{Zreq_infoÚreqÚcontent_encodingÚreaderrŽZerr_types_to_retry_with_anonrrZfile_objÚmsgrBrBrCÚ_get_filepath_or_buffersâ" 
ý ÿþý ý    
 
û
ÿ
    ýÿÿÿ
 
ÿÿÿûÿû ÿÿûr©)rerKcCsddlm}td||ƒƒS)z©
    converts an absolute native path to a FILE URL.
 
    Parameters
    ----------
    path : a path in native format
 
    Returns
    -------
    a valid FILE URL
    r)Ú pathname2urlzfile:)rwrªr)rerªrBrBrCÚfile_path_to_urlÓs r«Útarrr‰ÚziprŠÚzstd)    ú.tarú.tar.gzú.tar.bz2ú.tar.xzú.gzú.bz2ú.zipú.xzz.zstz"tuple[str | None, CompressionDict])r:rKc
Cs`t|tƒrPt|ƒ}z| d¡}WqXtk
rL}ztdƒ|‚W5d}~XYqXXni}|}||fS)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)rLrr˜ÚpopÚKeyErrorrl)r:Úcompression_argsr¤ÚerrrBrBrCr’ós
r’)rú
str | None)r6r:rKcCs’|dkr dS|dkrZt|dd}t|tƒs.dSt ¡D]\}}| ¡ |¡r6|Sq6dS|tkrf|Sddgttƒ}d|›d|›}t    |ƒ‚dS)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.
    NZinferT)rrúUnrecognized compression type: z
Valid compression types are )
rtrLr7Úextension_to_compressionÚitemsÚlowerÚendswithÚ_supported_compressionsÚsortedrl)r6r:Ú    extensionZvalidr¨rBrBrCr“s  
 
ÿr“z
Path | strcCs&t|ƒj}| ¡s"td|›dƒ‚dS)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)rerÅrBrBrCÚcheck_parent_directoryMs    
rÈ)r8r:Ú
memory_mapÚerrorsr€zLiteral[False]zIOHandles[bytes])    Ú path_or_bufr9r8r:rÉÚis_textrÊr€rKcCsdSrSrB©rËr9r8r:rÉrÌrÊr€rBrBrCÚ
get_handle[s rÎ)r8r:rÉrÌrÊr€z Literal[True]zIOHandles[str]cCsdSrSrBrÍrBrBrCrÎjs z!IOHandles[str] | IOHandles[bytes]cCsdSrSrBrÍrBrBrCrÎys rËTcCs¼|pd}|pd}t||ƒr*d|kr*|d7}t |¡t|tƒrHt |¡t|||||d}|j}    t|    |ƒ\}    }}
t|    tƒ} t    |j
ƒ} |   d¡}d|kr¦| r¦t t|    ƒƒ|rP|dkrÆ|j  dd    ¡|_ n |dkræd|j kræ|j d7_ |d
kr2t|    tƒrtjf|    |j d œ| —Ž}    ntjf|    |j d œ| —Ž}    n|d krVt|    fd|j i| —Ž}    nÞ|dkrÚt|    |j f| Ž}    |    jj dkr4|
 |    ¡|    j ¡} t| ƒdkr²|    j |   ¡¡}    n$| sÈtd|›ƒ‚ntd| ›ƒ‚nZ|dkr®|  d|j ¡t|    tƒrtfd|    i| —Ž}    ntfd|    i| —Ž}    t|    tƒs4t‚d|    jj kr4|
 |    ¡|    j ¡}t|ƒdkrˆ|    j |d¡}|dk    s‚t‚|}    n$|sžtd|›ƒ‚ntd|›ƒ‚n†|dkrÈtƒ|    |j ƒ}    nl|dkr"tdƒ}d|j krød|j f| Ži}nd|j!f| Ži}|j|    fd|j i|—Ž}    nd|›}t|ƒ‚t|    tƒrDt‚|
 |    ¡nNt|    tƒrž|j"rˆd|j krˆt|    |j |j"|d    d}    n t|    |j ƒ}    |
 |    ¡d }|sÐ|j d!krÐt|    t#ƒrÐt$|    |j"d"}    n~|rN|sð|sðt|    |j ƒrNt%|    d#ƒrt%|    d$ƒrt%|    d%ƒst&|    ƒ}    t'|    |j"|d    d}    |
 |    ¡t|jtƒpJ|j( }d|j kr|t%|    d&ƒs|t)d't*|jƒ›d(ƒ‚|
 +¡|j(rªt|jtƒržt‚|
 |j¡t,|    |
||j
d)S)*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}
 
        .. versionchanged:: 1.0.0
           May now be a dict with key 'method' as compression mode
           and other keys as compression options if compression
           mode is 'zip'.
 
        .. versionchanged:: 1.1.0
           Passing compression options as keys in dict is now
           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
 
    .. versionchanged:: 1.2.0
 
    Returns the dataclass IOHandles
    r‚Ústrictr…)r8r:r9r€r‡rƒr®r‹r1r)Úfilenamer9)Úfileobjr9r‰r9r­ézZero files found in ZIP file z9Multiple files found in ZIP file. Only one file per ZIP: r¬ÚnamerÑrNz Zero files found in TAR archive zDMultiple files found in TAR archive. Only one file per TAR archive: rŠÚ    zstandardZdctxZcctxr¼)r8rÊÚnewlineFÚrb)r8ÚreadableÚwritableÚseekabler‘z1Expected file path name or file-like object, got z type)rErGrHr:)-Ú_is_binary_modeÚcodecsÚlookuprLr7Ú lookup_errorr©r6Ú_maybe_memory_mapr˜r:r·rÈr9rœrÚGzipFileÚ_BZ2FileÚ _BytesZipFileÚbufferÚappendÚnamelistÚlenrŸrlÚ
setdefaultÚ _BytesTarFilerMÚgetnamesÚ extractfiler&r'ÚZstdDecompressorZZstdCompressorr8r
Ú_BytesIOWrapperr”Ú
_IOWrapperr r<rpr£ÚreverserD)rËr9r8r:rÉrÌrÊr€ZioargsrEÚhandlesZis_pathr¹Z    zip_namesÚfilesÚfiler®Z    open_argsr¨rHrBrBrCrΈs>6
 
 
û
 
 
 
 þýüû
    
ÿþý
 
ÿÿ
 
ÿ
 ÿÿ
 
ÿ
 
 ÿþý
  û     
þÿÿ
ÿÿþýü
ÿÿ ÷cs8eZdZdZeddœdd„ƒZddœ‡fdd„ Z‡ZS)Ú_BufferedWriterz
    Some objects do not support multiple .write() calls (TarFile and ZipFile).
    This wrapper writes to the underlying buffer on close.
    rIrJcCsdSrSrBrTrBrBrCÚwrite_to_buffer¦sz_BufferedWriter.write_to_bufferc    sP|jr
dS| ¡r8| d¡|j| ¡W5QRXn
|j ¡tƒ ¡dS)Nr)ÚclosedÚgetvalueÚseekrâròrQÚsuperrT©Ú    __class__rBrCrQªs
 
z_BufferedWriter.close)r=r>r?r@rròrQÚ __classcell__rBrBr÷rCrñ srñcsXeZdZdddddddœ‡fdd    „ Zd
d
d œd d „Zddœdd„Zddœdd„Z‡ZS)rçNrƒr»zLiteral[('r', 'a', 'w', 'x')]z-ReadBuffer[bytes] | WriteBuffer[bytes] | NonerI)rÓr9rÑÚ archive_namerKc s<tƒ ¡||_||_tjjf|| |¡|dœ|—Ž|_dS)N)rÓr9rÑ)    röÚ__init__rúrÓÚtarfileÚTarFilerŸÚ extend_moderâ)rRrÓr9rÑrúrzr÷rBrCrû»s
ýüz_BytesTarFile.__init__r7)r9rKcCsP| dd¡}|dkr|S|jdk    rLt|jƒj}|dkrL|›d|dd…›}|S)Nr…r1rˆ)r³r¶r´ú:rÒ)rœrÓr Úsuffix)rRr9rrBrBrCrþÐs 
 z_BytesTarFile.extend_moderJcCsP|jdkrdSt|jƒ}|jdkr.| d¡jS|jdkrJ| d¡ d¡jS|jS)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¯r1)r°r±r²)rÓr rÚ with_suffix©rRrÐrBrBrCÚinfer_filenameÚs
 
 
 
z_BytesTarFile.infer_filenamecCs>|jp| ¡pd}tj|d}t| ¡ƒ|_|j ||¡dS)Nr¬©rÓ)    rúrrüÚTarInforårôÚsizerâÚaddfile)rRrúÚtarinforBrBrCròés z_BytesTarFile.write_to_buffer)NrƒNN)r=r>r?rûrþrròrùrBrBr÷rCrçºsû
rçcsFeZdZddddddœ‡fdd„ Zdd    œd
d „Zdd    œd d „Z‡ZS)ráNz1FilePath | ReadBuffer[bytes] | WriteBuffer[bytes]r7r»rI)rðr9rúrKc s@tƒ ¡| dd¡}||_| dtj¡tj||f|Ž|_dS)Nr…r1r:)    rörûrœrúræÚzipfileÚ ZIP_DEFLATEDÚZipFilerâ)rRrðr9rúrzr÷rBrCrûòs
 
 z_BytesZipFile.__init__rJcCs@t|jjtjtfƒr<t|jjƒ}|jdkr6| d¡j    S|j    SdS)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µr1N)
rLrârÐrdrur7r rrrÓrrBrBrCrs  
 z_BytesZipFile.infer_filenamecCs(|jp| ¡pd}|j || ¡¡dS)Nr­)rúrrâÚwritestrrô)rRrúrBrBrCròsz_BytesZipFile.write_to_buffer)N)r=r>r?rûrròrùrBrBr÷rCráñsü rác@sTeZdZdddœdd„Zddœdd    „Zd
d œd d „Zd
d œdd„Zd
d œdd„ZdS)rìrrI)rârKcCs
||_dSrS)râ)rRrârBrBrCrûsz_IOWrapper.__init__r7rcCs t|j|ƒSrS©Úgetattrrâ)rRrÓrBrBrCÚ __getattr__sz_IOWrapper.__getattr__r;rJcCst|jdƒr|j ¡SdS)Nr×T)r”râr×rTrBrBrCr×"s 
z_IOWrapper.readablecCst|jdƒr|j ¡SdS)NrÙT)r”rârÙrTrBrBrCrÙ's 
z_IOWrapper.seekablecCst|jdƒr|j ¡SdS)NrØT)r”rârØrTrBrBrCrØ,s 
z_IOWrapper.writableN)r=r>r?rûrr×rÙrØrBrBrBrCrìs
rìc@s@eZdZdddddœdd„Zddœd    d
„Zdd d dœdd„ZdS)rër‚zStringIO | TextIOBaser7rI)râr8rKcCs||_||_d|_dS)Nó)râr8Úoverflow)rRrâr8rBrBrCrû5sz_BytesIOWrapper.__init__)ÚattrcCs t|j|ƒSrSr )rRrrBrBrCr>sz_BytesIOWrapper.__getattr__éÿÿÿÿz
int | Noner¡)ÚnrKcCst|jdk    st‚|j |¡ |j¡}|j|}|dksH|dksH|t|ƒkrRd|_|S|d|…}||d…|_|SdS)Nrr)rârMr‘Úencoder8rrå)rRrZ
bytestringZcombined_bytestringZ    to_returnrBrBrCr‘As
 z_BytesIOWrapper.readN)r‚)r)r=r>r?rûrr‘rBrBrBrCrë2s    rër5z/tuple[str | BaseBuffer, bool, list[BaseBuffer]])rErÉrKc    Cs–g}|t|dƒpt|tƒM}|s*|||fStt|ƒ}t|tƒrRt|dƒ}| |¡zt    t
j
|  ¡dt
j dƒ}W5t|ƒD] }| ¡qzX|||gfS)zTry to memory map file/buffer.ÚfilenorÖr)Úaccess) r”rLr7rr#rŸrãÚreversedrQrìr¢rZ ACCESS_READ)rErÉrîÚwrappedrBrBrCrÞOs&
 
 
 
 
ÿÿ  rÞc    CsHd}t|ƒ}t|tƒs|Sztj |¡}Wnttfk
rBYnX|S)zTest whether file exists.F)rtrLr7rdreÚexistsrprl)r6rrBrBrCÚ file_existsqs
r)rEr9rKcCsVd|ksd|krd|kStjtjtjf}tt|ƒ|ƒr:dSt|tƒƒpTdt|d|ƒkS)z+Whether the handle is opened in binary moder‹r…Fr9)    rÛÚ StreamWriterÚ StreamReaderÚStreamReaderWriterÚ
issubclassr£rLÚ_get_binary_io_classesr)rEr9Z text_classesrBrBrCrÚsüÿrÚztuple[type, ...]rJc    CsHttf}tddd}|dk    rD| ¡ d¡}|t|ƒf7}W5QRX|S)z!IO classes that that expect bytesrÔÚignore)rÊNr)rrr'rêZ stream_readerr£)Zbinary_classesr®r§rBrBrCr ”s  r zSequence[Hashable] | MultiIndexzbool | Sequence[int] | None)ÚcolumnsÚ    index_colrKcsDˆdkstˆtƒrg‰tt|ƒo@t|tƒ o@t‡fdd„|DƒƒƒS)a¥
    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
    Nc3s$|]}|tˆƒkrt|tƒVqdSrS)rZrLr )rhÚc©r#rBrCrj¿s z+is_potential_multi_index.<locals>.<genexpr>)rLr;rår/rm)r"r#rBr%rCÚis_potential_multi_index¦s
ÿýr&zSequence[Hashable])ÚnamesÚis_potential_multiindexrKcCs¢t|ƒ}ttƒ}t|ƒD]„\}}||}|dkrˆ|d||<|rpt|tƒsNt‚|dd…|d›d|›f}n|›d|›}||}q(|||<|d||<q|S)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']
    rrÒNrÚ.)rZrrkÚ    enumeraterLr rM)r'r(ÚcountsriÚcolZ    cur_countrBrBrCÚ dedup_namesÃs "
r-).).)F)r‚NrƒN)N)pr@Ú
__future__rÚabcrrrÛÚ collectionsrrXÚ    functoolsrÚiorrrr    r
r r¢rdÚpathlibr ÚrerüÚtypingr rrrrrrrrrrrÚ urllib.parserrr]rrrr•r    Zpandas._typingrrr r!r"r#r$r%Z pandas.compatr&Zpandas.compat._optionalr'Zpandas.compat.compressorsr(ràZpandas.util._decoratorsr)Zpandas.util._exceptionsr*Zpandas.core.dtypes.commonr+r,r-r.Zpandas.core.indexes.apir/Zpandas.core.shared_docsr0Úsetr_ÚdiscardÚcompiler|r2Z    dataclassr4rDrarcrqrtryrr©r«r½ÚvaluesrÁr’r“rÈrÎrñrçrárìrërÞrrÚÚ    lru_cacher r&r-rBrBrBrCÚ<module>sô    8(
 
 
  ,ÿþ"
 
þû3÷ #6÷$÷$÷$÷$7$"þ