� B�g��� ���dZddlmZddlmZmZddlZddlmZddl m Z m Z m Z ddl Z ddlZddlZddlmZmZmZmZmZmZddlZddlZddlmZddlZddlZdd lmZmZm Z m!Z!m"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/ddl0Z0dd l1m2Z2m3Z3dd l4m5Z5m6Z6dd l7m8Z8ddl9m:Z:ddl;m<Z<ddl=m>Z>m?Z?m@Z@mAZAddlBmCZCddlDmEZEeFe.e,ze-z��ZGeG�Hd��ejId��ZJe%de2���ZKerddlLmMZMddl1mNZNmOZOmPZPmQZQmRZRmSZSddlTmUZUe jVGd�d����ZWe jVGd�de#e!����ZXdd"�ZYe'd�d%���ZZe'd�d&���ZZd�d(�ZZd�d+�Z[e'd�d�d/���Z\e' d�d�d0���Z\ d�d�d3�Z\d4�Z]d�d6�Z^e:eEd7eEd8d#z�9�� d�d�dA���Z_d�dC�Z`dDdDdDdDdEdFdGdHdIdJ� ZaeFea�b����Zcd�dM�Zde:eEd8d#z�N��d�dP���Zed�dR�Zfe'd,d,d,d,d,dS�d�d[���Zge'd,d,d,d,d,d,d\�d�d_���Zge'd,d,d,d,d,d,d\�d�da���Zge:eEd8dTz�N��ddd1dbddd\�d�dc���ZgGdd�deee��ZhGdf�dgeh��ZiGdh�dieh��ZjGdj�dk��ZkGdl�dm��Zld�dq�Zmd�dr�Znd�ds�Zoejpd�du���Zq d�d�dz�Zrd�d~�ZsdS)�zCommon 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�J�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�moder1� compressionF�bool� should_closeN)�__name__� __module__� __qualname__�__doc__�__annotations__rA���`/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/pandas/io/common.pyr9r9asY���������)�(�(�(��M�M�M� �I�I�I� � � � ��L������rHr9c�z�eZdZUdZded<ded<eje���Zded<d Z d ed <dd�Z dd�Z 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]�handler1r?)�default_factoryzlist[IO[bytes] | IO[str]]�created_handlesFr@� is_wrapped�return�Nonec�F�|jrmt|jt��sJ�|j���|j���|j�|j��|jD]}|����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) rO� isinstancerLr�flush�detachrN�remove�close)�selfrLs rIrWzIOHandles.close�s��� �?� 5��d�k�=�9�9� 9� 9�9� �K� � � � � � �K� � � � � � � � '� '�� � 4� 4� 4��*� � �F� �L�L�N�N�N�N�!�������rH�IOHandles[AnyStr]c��|S�NrG�rXs rI� __enter__zIOHandles.__enter__�s��� rH�exc_type�type[BaseException] | None� exc_value�BaseException | None� traceback�TracebackType | Nonec�.�|���dSr[)rW)rXr^r`rbs rI�__exit__zIOHandles.__exit__�s�� � � � � � � � rHN�rPrQ)rPrY)r^r_r`rarbrcrPrQ) rBrCrDrErF� dataclasses�field�listrNrOrWr]rerGrHrIrKrKns�������� � ����� � � � �1B��1B�SW�1X�1X�1X�O�X�X�X�X��J����� � � � �"���������rHrK�url�objectrPr@c�f�t|t��sdSt|��jtvS)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)rSr<� parse_url�scheme� _VALID_URLS�rjs rI�is_urlrq�s/�� �c�3� � ���u� �S�>�>� �K� /�/rHr;r<c��dSr[rG�r;s rI� _expand_userrt�����CrHc��dSr[rGrss rIrtrt�rurH�str | BaseBufferTc�n�t|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 )rSr<�os�path� expanduserrss rIrtrt�s4���$�c�*�*�6��w�!�!�"4�5�5�5� �rH�headerrQc���|�dSt|��r,tt|��}|dkrtd���dSt |d���rptt |��}t tt|����std���td�|D����rtd���dSt|��rtd���td���) NrzUPassing negative integer to header is invalid. For no header, use header=None insteadF)� allow_setsz*header must be integer or list of integersc3�"K�|] }|dkV�� dS)rNrG)�.0�is rI� <genexpr>z&validate_header_arg.<locals>.<genexpr>�s&����%�%��q�1�u�%�%�%�%�%�%rHz8cannot 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)r|s rI�validate_header_argr��s �� �~����&�����c�6�"�"�� �A�:�:��9��� � ���F�u�-�-�-���h��'�'���3�z�6�*�*�+�+� K��I�J�J� J� �%�%�f�%�%�%� %� %� Y��W�X�X� X����v��� �� 4� � � � �A� B� B�BrH.r3�convert_file_likec��dSr[rG�r;r�s rI�stringify_pathr��rurHc��dSr[rGr�s rIr�r��s ���CrHF�FilePath | BaseBufferTc���|s$t|��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 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(rr.rSry�PathLike� __fspath__rtr�s rIr�r��se��. �5��.@�!A�!A�5��K�!3�4�4�4��$�b�k�2�2�=�/�:�:�<�<�� �*� +� +�+rHc�.�ddl}|jj|i|��S)z` Lazy-import wrapper for stdlib urlopen, as that imports a big chunk of the stdlib. rN)�urllib.request�request�urlopen)�args�kwargs�urllibs rIr�r�s*�� ���� !�6�>� !�4� 2�6� 2� 2�2rH�FilePath | BaseBufferc��t|t��o<tt�|����o|�d�� S)zR Returns true if the given URL looks like something fsspec can handle )zhttp://zhttps://)rSr<r@�_RFC_3986_PATTERN�match� startswithrps rI� is_fsspec_urlr�$sM�� �3���� 8� �"�(�(��-�-� .� .� 8����6�7�7� 7�rH�storage_options�compression_options)r�r��utf-8�rr=r?�CompressionOptions | Noner>�StorageOptions | Nonec�(�t|��}t|��\}}t||��}|r>t|d��r.d|vr*t jdt t�����d}t||���}d|vr5|dvr1|d vr-t j|�d |��tt�����|}d |vr d|vr|dz }t|t��r�t|��r�|pi}d dl }|j�||� ��}t!|��5} | j�dd��} | dkrddi}t'| �����} ddd��n #1swxYwYt+| ||d|���St-|���rBt|t��sJ�|�d��r|�dd��}|�d��r|�dd��}t3d��} g} t3d��d dlm}m}||t:g} n#t<$rYnwxYw | j|fd|i|pi�����}nW#tA| ��$rB|�ddi}nt|��}d|d<| j|fd|i|pi�����}YnwxYwt+|||d|���S|rtCd���t|ttDtFj#f��r!t+tI|��||d|���St|d��s1t|d��s!dtK|����}tC|���t+|||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} 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)r;r=r?rAr>zs3a://zs3://zs3n://�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�UnicodeWarningrSr<rqr�r��Requestr�r��getr r�r9r�r��replacer$�botocore.exceptionsr�r��PermissionError� ImportError�open�tupler��bytes�mmaprt�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 rI�_get_filepath_or_bufferr�0s5��>(�(:�;�;��'=�[�&I�&I�#�� �*�+=�?Q�R�R���"�g�&8�'�B�B�"�s�RV���� � R� �'�)�)� � � � � "���{�+=�>�>�>�K� �t� � � �-� /� /� �,� ,� ,�� �� N� N�H� N� N� �'�)�)� � � � ��K� �+���#�[�"8�"8��s�� ��$�c�*�*� �v�6H�/I�/I� �*�/�R�� �����>�)�)�*<�o�)�V�V�� �X� � � )�#�"�{���/A�4�H�H� ��6�)�)�'��0� ��S�X�X�Z�Z�(�(�F�  )� )� )� )� )� )� )� )� )� )� )���� )� )� )� )� �%��#���  � � � ��'�(�(�9 �� �� � � � � � � (� (�� 2� 2� O�!3�!;�!;�H�g�!N�!N� � � (� (�� 2� 2� O�!3�!;�!;�H�g�!N�!N� �+�H�5�5��35�$� � &�z� 2� 2� 2� � � � � � � � � �"��,� (� (�� � � � � �D� ���� �"�v�{�"���)4��9H�9N�B����d�f�f� �H���1�2�2� � � ��&�#)�4�.���#'��"7�"7��*.���'�"�v�{�"���)4��9H�9N�B����d�f�f� �H�H� �����'��#���  � � � � � �� M� � � ��$�s�E�4�9�&=�>�>� ��+�,>�?�?��#���  � � � � �"�F�+�+��/6�7I�7�/S�/S��U�$�?Q�:R�:R�T�T����o�o�� �-���� �  � � �s8�"AE5�5E9�<E9�#!I� I�I�$I;�;AK�Krzc�@�ddlm}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:)r�r�r)rzr�s rI�file_path_to_urlr��s0��,�+�+�+�+�+� �7�L�L��.�.� /� /�/rH�tarr�r��zipr��zstd) �.tar�.tar.gz�.tar.bz2�.tar.xz�.gz�.bz2�.zip�.xzz.zstr2�"tuple[str | None, CompressionDict]c���t|t��rHt|��} |�d��}n&#t$r}t d��|�d}~wwxYwi}|}||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)rSrr��pop�KeyErrorr�)r?�compression_argsr��errs rIr�r�s���.�+�w�'�'�)�� �,�,�� X�!1�!5�!5�h�!?�!?� � ��� X� X� X��M�N�N�TW� W����� X������(�� �/� /�/s�<� A�A�A)r�� str | Nonec�t�|�dS|dkrtt|d���}t|t��sdSt���D]0\}}|����|��r|cS�1dS|tvr|Sddgtt��z}d|�d|��}t|���)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�rSr<�extension_to_compression�items�lower�endswith�_supported_compressions�sortedr�)r;r?� extension�validr�s rIr�r�&s���4���t��g���+�,>�RV�W�W�W���,�c�2�2� ��4�'?�&D�&D�&F�&F� #� #� "�I�{�!�'�'�)�)�2�2�9�=�=� #�"�"�"�"� #��t��-�-�-��� �d�O�f�%<�=�=� =�E� /�+� /� /�',� /� /�� �S�/�/�rH� Path | strc�|�t|��j}|���std|�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)rzr�s rI�check_parent_directoryr�]sI���$�Z�Z� �F� �=�=�?�?�V��T�6�T�T�T�U�U�U�V�VrH)r=r?� memory_map�errorsr�� path_or_bufr��is_text�Literal[False]r�r5�IOHandles[bytes]c��dSr[rG�r�r>r=r?r�r�r�r�s rI� get_handlerk� ���CrH)r=r?r�r�r�r�� Literal[True]�IOHandles[str]c��dSr[rGrs rIrrzrrH�!IOHandles[str] | IOHandles[bytes]c��dSr[rGrs rIrr�rrHTc�F �|pd}|pd}t||��r d|vr|dz }tj|��t|t��rtj|��t |||||���}|j} t| |��\} }} t| t��} t|j ��} | � d��}d|vr| rtt | ����|�r9|dkr!|j �dd ��|_ n|dkrd|j vr|xj dz c_ |d krKt| t��rtjd*| |j d �| ��} �n�tjd*| |j d �| ��} �nu|d krt#��| fd|j i| ��} �nQ|dkr�t%| |j fi| ��} | jj dkr�| �| ��| j���} t-| ��dkr.| j�| � ����} �n�| st1d|�����t1d| ������n�|dk�r| �d|j ��t| t��rt5d*d| i| ��} nt5d*d| i| ��} t| t4��sJ�d| jj vr�| �| ��| j���}t-|��dkr'| j�|d��}|�J�|} n�|st1d|�����t1d|�����n�|dkrt;��| |j fi| ��} ng|dkrMt=d��}d|j vrd|jd*i| ��i}nd|j d*i| ��i}|j| fd|j i|��} nd|��}t1|���t| t��rJ�| �| ��nnt| t��rY|j!r(d|j vrt/| |j |j!|d ���} nt/| |j ��} | �| ��d }|s7|j d!kr,t| tD��rtG| |j!�"��} n�|r�|s|st| |j ��r�tI| d#��r tI| d$��rtI| d%��stK| ��} tM| |j!|d ���} | �| ��t|jt��p|j' }d|j vr5tI| d&��s%tQd'tS|j���d(����| �*��|j'r6t|jt��rJ�| �|j��tW| | ||j �)��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} 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 r��strictr�)r=r?r>r�r�r�r�r�r-r�)�filenamer>)�fileobjr>r�r>r��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�� zstandard�dctx�cctxr�)r=r��newlineF�rb)r=�readable�writable�seekabler�z1Expected file path name or file-like object, got z type)rLrNrOr?rG),�_is_binary_mode�codecs�lookuprSr<� 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�� _IOWrapperrrAr�r��reverserK)r�r>r=r?r�r�r�r��ioargsrL�handles�is_pathr�� zip_names�files�filer�� open_argsr�rOs rIrr�s���d�"�7�H� � �x�F��{�D�)�)��c��o�o� �� �� �M�(�����&�#���$���F�#�#�#�%���� �'� ���F�� &�F� #4�F�J�"G�"G��F�J�����%�%�G��F�.�/�/��"�&�&�x�0�0�K� �$���7���s�6�{�{�+�+�+��D� �&� � � �+�-�-�c�2�6�6�F�K�K� �F� "� "�s�&�+�'=�'=� �K�K�3� �K�K� �&� � ��&�#�&�&� ����#�����'����� ���#��� �� '� �����E� !� !�$�\�^�^�����[��#���F�F��E� !� !�#��� ���'7���F��}�!�S�(�(����v�&�&�&�"�M�2�2�4�4� ��y�>�>�Q�&�&�#�]�/�/� � � ���@�@�F�F�"��$�%R�[�%R�%R�S�S�S�$�>�2;�>�>����)��E� !� !� � '� '��� � <� <� <��&�#�&�&� �&�G�G�F�G�6F�G�G��� '���"��&6�����f�m�4�4� 4� 4�4��f�m�(�(�(����v�&�&�&�� �.�.�0�0���u�:�:��?�?�!�=�4�4�U�1�X�>�>�D��+�+�+�!�F�F���$�%U� �%U�%U�V�V�V�$�B�:?�B�B����)� �D� � �%�]�_�_��� ���'7���F�F� �F� "� "�-�k�:�:�D��f�k�!�!�#�%:�T�%:�%N�%N�=M�%N�%N�O� � �#�%8�T�%8�%L�%L�;K�%L�%L�M� ��T�Y�����[�����F�F�B�K�A�A�C��S�/�/� !��f�c�*�*�*�*�*����v����� �F�C� � �� �?� /�s�&�+�5�5���� ����� ���F�F��&�&�+�.�.�F����v�����J� � �v�{�d�*�*�z�&�*�/M�/M�*� � ��_� � � ��� � �� �!� �%4�V�V�[�%I�%I� ��� �+�+� (��6�:�.�.� (��6�:�.�.� (�  ��'�'�F�� ��_���  � � �� ���v���� �v�0�#� 6� 6� M�&�:M� � � �f�k���'�&�&�"9�"9��� :���1�2�2� :� :� :� � � �  �O�O���� ��2��f�7��=�=�=�=�=����v�0�1�1�1� �� ���&� � � � rHc�P��eZdZdZe��Zedd���Zd�fd� Z�xZ S)�_BufferedWriterz� Some objects do not support multiple .write() calls (TarFile and ZipFile). This wrapper writes to the underlying buffer on close. rPrQc��dSr[rGr\s rI�write_to_bufferz_BufferedWriter.write_to_buffer�s�� �rHc�P��|jrdS|���jrI|�d��|j5|���ddd��n #1swxYwYn|j���t�����dS)Nr)�closed� getbuffer�nbytes�seekrr6rW�super)rX� __class__s �rIrWz_BufferedWriter.close�s���� �;� � �F� �>�>� � � "� � �I�I�a�L�L�L��� '� '��$�$�&�&�&� '� '� '� '� '� '� '� '� '� '� '���� '� '� '� '�� �K� � � � � � ��� � �����s�A!�!A%�(A%rf) rBrCrDrEr rrr6rW� __classcell__�r=s@rIr4r4�sr��������� �W�Y�Y�F�� � � ��^� � � � � � � � � � � rHr4c�B��eZdZ dd�fd � Zdd�Zdd�Zdd�Z�xZS)r$Nr�rr�r>�Literal['r', 'a', 'w', 'x']r �-ReadBuffer[bytes] | WriteBuffer[bytes] | None� archive_namerPrQc ����t�����||_||_t jjd||�|��|d�|��|_dS)N)rr>r rG) r<�__init__rCr�tarfile�TarFiler�� extend_moder)rXrr>r rCr�r=s �rIrEz_BytesTarFile.__init__�sq��� ��������(����� �(/��';�( ���!�!�$�'�'��( �( �� ( �( �� � � rHr<c��|�dd��}|dkr|S|j�,t|j��j}|dvr|�d|dd���}|S)Nr�r-r�)r�r�r��:r)r�rr�suffix)rXr>rKs rIrHz_BytesTarFile.extend_mode�sg���|�|�C��$�$�� �3�;�;��K� �9� ��$�)�_�_�+�F��/�/�/��-�-������-�-��� rHc��|j�dSt|j��}|jdkr|�d��jS|jdvr-|�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�r-)r�r�r�)rrrK� with_suffix�rXr s rI�infer_filenamez_BytesTarFile.infer_filename�s}�� �9� ��4��� �?�?�� �?�f� $� $��'�'��+�+�0� 0� �_� B� B� B��'�'��+�+�7�7��;�;�@� @��}�rHc���|jp|���pd}tj|���}t |�����|_|j�||��dS)Nr�)r) rCrOrF�TarInfor"�getvalue�sizer�addfile)rXrC�tarinfos rIr6z_BytesTarFile.write_to_buffer�sg���(�J�D�,?�,?�,A�,A�J�U� ��/�|�4�4�4���4�=�=�?�?�+�+�� � � ���G�T�*�*�*�*�*rH)Nr�NN) rr�r>rAr rBrCr�rPrQ)r>r<rPr<�rPr�rf)rBrCrDrErHrOr6r>r?s@rIr$r$�s�������� �,/�AE�#'�  � � � � � � �(���� � � � �+�+�+�+�+�+�+�+rHr$c�4��eZdZ d d�fd � Zdd �Zdd �Z�xZS)rNr1�1FilePath | ReadBuffer[bytes] | WriteBuffer[bytes]r>r<rCr�rPrQc ����t�����|�dd��}||_|�dt j��t j||fi|��|_dS)Nr�r-r?) r<rEr�rCr#�zipfile� ZIP_DEFLATED�ZipFiler)rXr1r>rCr�r=s �rIrEz_BytesZipFile.__init__�sz��� ���������|�|�C��$�$��(������-��)=�>�>�>�(/�� �$�( �( � �( �( �� � � rHc���t|jjtjt f��rEt |jj��}|jdkr|�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�r-N) rSrr ryr�r<rrKrMrrNs rIrOz_BytesZipFile.infer_filenamese�� �d�k�*�R�[�#�,>� ?� ?� !��D�K�0�1�1�H���&�(�(��+�+�B�/�/�4�4��=� ��trHc��|jp|���pd}|j�||�����dS)Nr�)rCrOr�writestrrR)rXrCs rIr6z_BytesZipFile.write_to_buffersF���(�J�D�,?�,?�,A�,A�J�U� � � ���\�4�=�=�?�?�;�;�;�;�;rHr[)r1rXr>r<rCr�rPrQrVrf)rBrCrDrErOr6r>r?s@rIrr�so������� $(�  � � � � � � �$ � � � �<�<�<�<�<�<�<�<rHrc�6�eZdZdd�Zdd�Zdd �Zdd �Zdd �Zd S)r*rr rPrQc��||_dSr[)r)rXrs rIrEz_IOWrapper.__init__*s ���� � � rHrr<c�,�t|j|��Sr[��getattrr)rXrs rI� __getattr__z_IOWrapper.__getattr__-����t�{�D�)�)�)rHr@c�b�t|jd��r|j���SdS)NrT)r�rrr\s rIrz_IOWrapper.readable0�/�� �4�;� � +� +� *��;�'�'�)�)� )��trHc�b�t|jd��r|j���SdS)NrT)r�rrr\s rIrz_IOWrapper.seekable5rhrHc�b�t|jd��r|j���SdS)NrT)r�rrr\s rIrz_IOWrapper.writable:rhrHN)rr rPrQ)rr<)rPr@)rBrCrDrErerrrrGrHrIr*r*#sx����������*�*�*�*����� ���� �����rHr*c�*�eZdZddd�Zdd �Zddd�ZdS)r)r�r�StringIO | TextIOBaser=r<rPrQc�0�||_||_d|_dS)NrH)rr=�overflow)rXrr=s rIrEz_BytesIOWrapper.__init__Cs���� � �� � �� � � rH�attrc�,�t|j|��Sr[rc)rXros rIrez_BytesIOWrapper.__getattr__LrfrH������n� int | Noner�c� �|j�J�|j�|���|j��}|j|z}|�|dks|t |��kr d|_|S|d|�}||d�|_|S)NrrH)rr��encoder=rnr")rXrr� bytestring�combined_bytestring� to_returns rIr�z_BytesIOWrapper.readOs����{�&�&�&��[�%�%�a�(�(�/�/�� �>�>� �"�m�j�8�� �9��A����c�*=�&>�&>�!>�!>��D�M�&� &�+�B�Q�B�/�I�/����3�D�M�� rHN)r�)rrlr=r<rPrQ)ror<)rq)rrrsrPr�)rBrCrDrErer�rGrHrIr)r)@sZ�����������*�*�*�*� � � � � � � rHr)rLr:�/tuple[str | BaseBuffer, bool, list[BaseBuffer]]c�4�g}|t|d��pt|t��z}|s|||fStt|��}t|t��r%t |d��}|�|�� ttj|� ��dtj �����}t|��D]}|� ���n+#t|��D]}|� ���wxYw|||gfS)zTry to memory map file/buffer.�filenorr)�access) r�rSr<rr!r�r r*r�r{� ACCESS_READ�reversedrW)rLr�r-�wrappeds rIrr]s/��!#�G��'�&�(�+�+�F�z�&�#�/F�/F�F�J� �+��z�7�*�*��-�� (� (�F��&�#�����f�d�#�#�����v���� �� �I�� � ����4�+;� � � � � �� �w�'�'� � �F� �L�L�N�N�N�N� ��h�w�'�'� � �F� �L�L�N�N�N�N� ���� �J�� � )�)s �AC)�)(Dc���d}t|��}t|t��s|S tj�|��}n#t tf$rYnwxYw|S)zTest whether file exists.F)r�rSr<ryrz�existsr�r�)r;r�s rI� file_existsr�ss�� �F�'�(:�;�;�� �(�#� .� .��� � ����� 2�3�3���� �z� "� � � � �� ���� �Ms�A � A�Ac���d|vsd|vrd|vStjtjtjf}t t |��|��rdSt |t����pdt|d|��vS)z+Whether the handle is opened in binary moder�r�Fr>) r� StreamWriter� StreamReader�StreamReaderWriter� issubclassr�rS�_get_binary_io_classesrd)rLr>� text_classess rIrr�s��� �d�{�{�c�T�k�k��d�{�� �����!� �L� �$�v�,�,� �-�-���u� �f�4�6�6� 7� 7� �3�'����C�C�<�rH�tuple[type, ...]c���ttf}tdd���}|�R|����d��5}|t |��fz }ddd��n #1swxYwY|S)z!IO classes that that expect bytesr�ignore)r�NrH)r r r$r'� stream_readerr�)�binary_classesr�r�s rIr�r��s���)7� �'B�N� &�k�(� C� C� C�D� �� � "� "� $� $� 2� 2�3� 7� 7� .�6� �t�F�|�|�o� -�N� .� .� .� .� .� .� .� .� .� .� .���� .� .� .� .� �s� A)�)A-�0A-�columns�Sequence[Hashable] | MultiIndex� index_col�bool | Sequence[int] | Nonec������t�t��rg�tt|��o0t|t�� ot �fd�|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 Nc3�d�K�|]*}|t���v�t|t��V��+dSr[)rirSr�)r��cr�s �rIr�z+is_potential_multi_index.<locals>.<genexpr>�s=�����R�R���$�y�/�/�9Q�9Q� �1�e�$�$�9Q�9Q�9Q�9Q�R�RrH)rSr@r"r+r�)r�r�s `rI�is_potential_multi_indexr��sv���&��J�y�$�7�7��� � � �G� � � S��7�M�2�2� 2� S� �R�R�R�R�g�R�R�R� R� R� � �rH�names�Sequence[Hashable]�is_potential_multiindexc�L�t|��}tt��}t|��D]p\}}||}|dkrP|dz||<|r1t |t ��sJ�|dd�|d�d|��fz}n|�d|��}||}|dk�P|||<|dz||<�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'] rrNrq�.)rirr�� enumeraterSr�)r�r��countsr��col� cur_counts rI� dedup_namesr��s��� ��K�K�E�)4�S�)9�)9�F��E�"�"�$�$���3��3�K� ��!�m�m�#�a�-�F�3�K�&� +�!�#�u�-�-�-�-�-��#�2�#�h�S��W�":�":�y�":�":�!<�<����*�*�y�*�*���s� �I��!�m�m���a���!�m��s� � � �LrH)rjrkrPr@)r;r<rPr<)r;r.rPr.)r;rwrPrw)r|rkrPrQ).)r;r3r�r@rPr<)r;r.r�r@rPr.)F)r;r�r�r@rPrw)rjr�rPr@)r�Nr�N) r;r�r=r<r?r�r>r<r�r�rPr9)rzr<rPr<)r?r2rPr�)r;r�r?r�rPr�)rzr�rPrQ)r�r�r>r<r=r�r?r2r�r@r�r�r�r�r�r5rPr)r�r�r>r<r=r�r?r2r�r@r�rr�r�r�r5rPr)r�r�r>r<r=r�r?r2r�r@r�r@r�r�r�r5rPr)r�r�r>r<r=r�r?r�r�r@r�r@r�r�r�r�rPr)rLr:r�r@rPry)r;r�rPr@)rLr�r>r<rPr@)rPr�r[)r�r�r�r�rPr@)r�r�r�r@rPr�)trE� __future__r�abcrrr� collectionsr�collections.abcrrr rg� functoolsr��ior r r r rrr�ry�pathlibr�rerF�typingrrrrrrrrrr� urllib.parserrrmrrrr�rZ�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,�setro�discard�compiler�r.�typesr0r1r2r3r4r5r6�pandasr7� dataclassr9rKrqrtr�r�r�r�r�r�r��valuesr�r�r�r�rr4r$rr*r)rr�r� lru_cacher�r�r�rGrHrI�<module>r�s ����"�"�"�"�"�"���������� � � �#�#�#�#�#�#����������� �������� � � � ����������������� � � � � � � � ������� � � � ����� � � � � � � � � � � � � � � � � � � � � � � � ���������������������������������������?�>�>�>�>�>�'�'�'�'�'�'�4�4�4�4�4�4������������� 5�4�4�4�4�4�0�0�0�0�0�0��c�-�+�-� �;�<�<� � ���B�����B�J�?�@�@���g�m�:�6�6�6� �� "�#�#�#�#�#�#�����������������"�!�!�!�!�!� �� � � � � � � ��� � ��.�.�.�.�.����.�.���.�b0�0�0�0�$ ���� ��� ���� �������&C�C�C�C�: ����� ��� �?B����� ���$�,�,�,�,�,�D3�3�3� � � � ��� �!2�3�$�%:�;�>R�R���� �-1��-1� l�l�l�l� ��l�^0�0�0�0�& ���� � � � � � � ���#�6�=�=�?�?�@�@�� 0� 0� 0� 0�F���&;�<�?S�S�T�T�T�3�3�3�U�T�3�l V� V� V� V� � �&)���&)� � � � � � �� � � �&)�� ��&)� � � � � � �� � � �&)����&)� � � � � � �� ����&;�<�}�L�M�M�M�  �-1����-1�P�P�P�P�P�N�M�P�j�����g�s����43+�3+�3+�3+�3+�O�3+�3+�3+�l"<�"<�"<�"<�"<�O�"<�"<�"<�J��������:��������:*�*�*�*�D � � � �����* ��������&.2������:"�"�"�"�"�"rH
Memory