Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pandas/io/excel/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pandas/io/excel/__pycache__/_util.cpython-312.pyc

�

Mٜg����UddlmZddlmZmZmZmZddlmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZmZerddlmZeeZede
egef��ZiZd	ed
<dd�Zddd�Zdd
�Zd d�Zd!d�Ze
d"d��Z e
d#d��Z e
d$d��Z e
d%d��Z 				d&d�Z e
d'd��Z!e
d(d��Z!d)d�Z!						d*d�Z"						d+d�Z#d,d�Z$y)-�)�annotations)�Hashable�Iterable�MutableMapping�Sequence)�
TYPE_CHECKING�Any�Callable�Literal�TypeVar�overload��import_optional_dependency)�
is_integer�is_list_like)�ExcelWriter�usecols_func)�boundz"MutableMapping[str, ExcelWriter_t]�_writersc�Z�t|�std��|j}|t|<y)z�
    Add engine to the excel writer registry.io.excel.

    You must use this method to integrate with ``to_excel``.

    Parameters
    ----------
    klass : ExcelWriter
    z&Can only register callables as enginesN)�callable�
ValueError�_enginer)�klass�engine_names  �@/usr/local/lib/python3.12/site-packages/pandas/io/excel/_util.py�register_writerr"s*���E�?��A�B�B��-�-�K�!�H�[��c�r�dddddd�}ddddd�}|dvsJ�|dk(rtd	d
��}|rd	|d<||S||S)
a�
    Return the default reader/writer for the given extension.

    Parameters
    ----------
    ext : str
        The excel file extension for which to get the default engine.
    mode : str {'reader', 'writer'}
        Whether to get the default engine for reading or writing.
        Either 'reader' or 'writer'

    Returns
    -------
    str
        The default engine for the extension.
    �openpyxl�pyxlsb�xlrd�odf)�xlsx�xlsm�xlsb�xls�ods)r$r%r&r()�reader�writerr*�
xlsxwriter�warn)�errorsr$r)�ext�mode�_default_readers�_default_writersr+s     r�get_default_enginer22sz��$�����������	���'�'�'�'��x��/��V�L�
��'3��V�$���$�$���$�$rc�X�	t|S#t$r}td|�d��|�d}~wwxYw)NzNo Excel writer '�')r�KeyErrorr)r�errs  r�
get_writerr7[s<��F���$�$���F��,�[�M��;�<�#�E��F�s��	)�$�)c���d}|j�j�D]N}t|�}|td�ks|td�kDrtd|����|dz|ztd�z
dz}�P|dz
S)ai
    Convert Excel column name like 'AB' to 0-based column index.

    Parameters
    ----------
    x : str
        The Excel column name to convert to a 0-based column index.

    Returns
    -------
    num : int
        The column index corresponding to the name.

    Raises
    ------
    ValueError
        Part of the Excel column name was invalid.
    r�A�ZzInvalid column name: ��)�upper�strip�ordr)�x�index�c�cps    r�
_excel2numrDbsx��&
�E�
�W�W�Y�_�_�
��
��V��
��C��=�B��S��M��4�Q�C�8�9�9���
�R��#�c�(�*�Q�.��
��1�9�rc
��g}|jd�D]h}d|vrH|jd�}|jtt|d�t|d�dz���O|j	t|���j|S)a�
    Convert comma separated list of column names and ranges to indices.

    Parameters
    ----------
    areas : str
        A string containing a sequence of column ranges (or areas).

    Returns
    -------
    cols : list
        A list of 0-based column indices.

    Examples
    --------
    >>> _range2cols('A:E')
    [0, 1, 2, 3, 4]
    >>> _range2cols('A,C,Z:AB')
    [0, 2, 25, 26, 27]
    �,�:rr<)�split�extend�rangerD�append)�areas�cols�rng�rngss    r�_range2colsrP�sq��*�D��{�{�3����#�:��9�9�S�>�D��K�K��j��a��1�:�d�1�g�3F��3J�K�L��K�K�
�3��(� ��Krc��y�N���usecolss r�maybe_convert_usecolsrV����rc��yrRrSrTs rrVrV�rWrc��yrRrSrTs rrVrV�rWrc��yrRrSrTs rrVrV�rWrc�p�|�|St|�rtd��t|t�rt	|�S|S)a
    Convert `usecols` into a compatible format for parsing in `parsers.py`.

    Parameters
    ----------
    usecols : object
        The use-columns object to potentially convert.

    Returns
    -------
    converted : object
        The compatible format of `usecols`.
    z}Passing an integer for `usecols` is no longer supported.  Please pass in a list of int from 0 to `usecols` inclusive instead.)rr�
isinstance�strrPrTs rrVrV�sE�� �����'���
R�
�	
�
�'�3���7�#�#��Nrc��yrRrS��freeze_paness r�validate_freeze_panesra�rWrc��yrRrSr_s rrara�rWrc�`�|�,t|�dk(rtd�|D��rytd��y)N�c3�<K�|]}t|t����y�wrR)r\�int)�.0�items  r�	<genexpr>z(validate_freeze_panes.<locals>.<genexpr>�s����*
�.:�d�J�t�S�!�l�s�TzLfreeze_panes must be of form (row, column) where row and column are integersF)�len�allrr_s rrara�sE�����|���!�c�*
�.:�*
�'
���
0�
�	
�rc��|d}tdt|��D])}||s||}||dk(s||�|||<� d||<||}�+||fS)a�
    Forward fill blank entries in row but only inside the same parent index.

    Used for creating headers in Multiindex.

    Parameters
    ----------
    row : list
        List of items in a single row.
    control_row : list of bool
        Helps to determine if particular column is in same parent index as the
        previous value. Used to stop propagation of empty cells between
        different indexes.

    Returns
    -------
    Returns changed row and control_row
    rr<�F)rJrj)�row�control_row�last�is    r�fill_mi_headerrr�sm��*�q�6�D�
�1�c�#�h�
���1�~��q�6�D��q�6�R�<�3�q�6�>��C��F�"�K��N��q�6�D� ����rc��t|�rt|t�sJ�t|�}nt|t�rJ�|}||}|dk(rdn|}||d|dgz||dzdzfS)a�
    Pop the header name for MultiIndex parsing.

    Parameters
    ----------
    row : list
        The data row to parse for the header name.
    index_col : int, list
        The index columns for our data. Assumed to be non-null.

    Returns
    -------
    header_name : str
        The extracted header name.
    trimmed_row : list
        The original data row with the header name removed.
    rmNr<)rr\r�max)rn�	index_colrq�header_names    r�pop_header_namerwsw��*�I���)�X�.�.�.��	�N���i��2�2�2����a�&�K�%��+�$��K���B�Q��2�$���Q��U�W��5�5�5rc�R�|�i}n|j�}|j|�|S)a
    Used to combine two sources of kwargs for the backend engine.

    Use of kwargs is deprecated, this function is solely for use in 1.3 and should
    be removed in 1.4/2.0. Also _base.ExcelWriter.__new__ ensures either engine_kwargs
    or kwargs must be None or empty respectively.

    Parameters
    ----------
    engine_kwargs: dict
        kwargs to be passed through to the engine.
    kwargs: dict
        kwargs to be psased through to the engine (deprecated)

    Returns
    -------
    engine_kwargs combined with kwargs
    )�copy�update)�
engine_kwargs�kwargs�results   r�combine_kwargsr~6s.��&�����#�#�%��
�M�M�&���MrN)r�
ExcelWriter_t�return�None)r))r.r]r/zLiteral['reader', 'writer']r�r])rr]r�r)r@r]r�rf)rLr]r��	list[int])rUzstr | list[int]r�r�)rU�	list[str]r�r�)rUrr�r)rUr�r�r�)rUz1str | list[int] | list[str] | usecols_func | Noner�z+None | list[int] | list[str] | usecols_func)r`ztuple[int, int]r�z
Literal[True])r`r�r�zLiteral[False])r`ztuple[int, int] | Noner��bool)rn�list[Hashable]roz
list[bool]r�z!tuple[list[Hashable], list[bool]])rnr�ruzint | Sequence[int]r�z&tuple[Hashable | None, list[Hashable]])r{zdict[str, Any] | Noner|�dictr�r�)%�
__future__r�collections.abcrrrr�typingrr	r
rrr
�pandas.compat._optionalr�pandas.core.dtypes.commonrr�pandas.io.excel._baser�typer�objectrr�__annotations__rr2r7rDrPrVrarrrwr~rSrr�<module>r�sK��"�����?��
�1���%�M��>��8�*�f�:L�1M�N�L�/1��
,�1�
"� &%�RF��@�B
��
��
��
��
��
��
��
���
>��0��>
��
��
��
���" �	� �&0� �&� �F6�	�6�$7�6�+�6�Dr

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists