
    cMh                       U d dl mZ d dlmZmZmZmZ d dlmZm	Z	m
Z
mZmZmZ d dlmZ d dlmZmZ er$d dlmZ ee         Z ede
egef                   Zi Zd	ed
<   dAdZdBdCdZdDdZdEdZdFdZedGd             Z edHd"            Z edId#            Z edJd$            Z dKd'Z edLd+            Z!edMd-            Z!dNd0Z!dOd6Z"dPd:Z#dQd?Z$d@S )R    )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]_writersklassExcelWriter_treturnNonec                d    t          |           st          d          | j        }| t          |<   dS )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   )r   engine_names     U/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pandas/io/excel/_util.pyregister_writerr    "   s9     E?? CABBB-K!H[    readerextstrmodeLiteral['reader', 'writer']c                    dddddd}ddddd}|dv sJ |dk    r t          d	d
          }|rd	|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.   r0   )r"   writerr1   
xlsxwriterwarn)errorsr,   r   )r#   r%   _default_readers_default_writersr2   s        r   get_default_enginer7   2   s    $   	  '''''x/VLLL
 	4'3V$$$$$r!   r   c                j    	 t           |          S # t          $ r}t          d|  d          |d }~ww xY w)NzNo Excel writer '')r   KeyErrorr   )r   errs     r   
get_writerr<   [   sR    F$$ F F F;[;;;<<#EFs    
2-2xintc                &   d}|                                                                  D ]d}t          |          }|t          d          k     s|t          d          k    rt          d|            |dz  |z   t          d          z
  dz   }e|dz
  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ZzInvalid column name:       )upperstripordr   )r=   indexccps       r   
_excel2numrJ   b   s    & EWWYY__ / /VVC==BSMM8Q88999
R#c((*Q.19r!   areas	list[int]c           
     J   g }|                      d          D ]}d|v rb|                     d          }|                    t          t          |d                   t          |d                   dz                        h|                    t          |                     |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]
    ,:r   rC   )splitextendrangerJ   append)rK   colsrngrngss       r   _range2colsrW      s    * D{{3 ) )#::99S>>DKKja11:d1g3F3F3JKKLLLLKK
3((((Kr!   usecolsstr | list[int]c                    d S N rX   s    r   maybe_convert_usecolsr^          Cr!   	list[str]c                    d S r[   r\   r]   s    r   r^   r^      r_   r!   c                    d S r[   r\   r]   s    r   r^   r^      r_   r!   c                    d S r[   r\   r]   s    r   r^   r^      r_   r!   1str | list[int] | list[str] | usecols_func | None+None | list[int] | list[str] | usecols_funcc                    | | S t          |           rt          d          t          | t                    rt	          |           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`.
    Nz}Passing an integer for `usecols` is no longer supported.  Please pass in a list of int from 0 to `usecols` inclusive instead.)r   r   
isinstancer$   rW   r]   s    r   r^   r^      s]      ' 
R
 
 	

 '3 $7###Nr!   freeze_panestuple[int, int]Literal[True]c                    d S r[   r\   rh   s    r   validate_freeze_panesrm      r_   r!   Literal[False]c                    d S r[   r\   rl   s    r   rm   rm      r_   r!   tuple[int, int] | Noneboolc                    | =t          |           dk    rt          d | D                       rdS t          d          dS )N   c              3  @   K   | ]}t          |t                    V  d S r[   )rg   r>   ).0items     r   	<genexpr>z(validate_freeze_panes.<locals>.<genexpr>   s=       *
 *
&*JtS!!*
 *
 *
 *
 *
 *
r!   TzLfreeze_panes must be of form (row, column) where row and column are integersF)lenallr   rl   s    r   rm   rm      sk    |!!c *
 *
.:*
 *
 *
 '
 '
! 40
 
 	
 5r!   rowlist[Hashable]control_row
list[bool]!tuple[list[Hashable], list[bool]]c                    | d         }t          dt          |                     D ]9}||         s| |         }| |         dk    s| |         || |<   ,d||<   | |         }:| |fS )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
    r   rC    NF)rR   rx   )rz   r|   lastis       r   fill_mi_headerr      s    * q6D1c#hh  1~ 	q6Dq6R<<3q6>CFF"KNq6DDr!   	index_colint | Sequence[int]&tuple[Hashable | None, list[Hashable]]c                    t          |          r't          |t                    sJ t          |          }nt          |t                    rJ |}| |         }|dk    rdn|}|| d|         dgz   | |dz   d         z   fS )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.
    r   NrC   )r   rg   r   max)rz   r   r   header_names       r   pop_header_namer     s    * I )X.....	NNi22222a&K%++$$KBQB2$QUWW555r!   engine_kwargsdict[str, Any] | Nonekwargsdictc                b    | i }n|                                  }|                    |           |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)r   r   results      r   combine_kwargsr   6  s9    & ##%%
MM&Mr!   N)r   r   r   r   )r"   )r#   r$   r%   r&   r   r$   )r   r$   r   r   )r=   r$   r   r>   )rK   r$   r   rL   )rX   rY   r   rL   )rX   r`   r   r`   )rX   r   r   r   )rX   r   r   r   )rX   rd   r   re   )rh   ri   r   rj   )rh   r   r   rn   )rh   rp   r   rq   )rz   r{   r|   r}   r   r~   )rz   r{   r   r   r   r   )r   r   r   r   r   r   )%
__future__r   collections.abcr   r   r   r   typingr   r	   r
   r   r   r   pandas.compat._optionalr   pandas.core.dtypes.commonr   r   pandas.io.excel._baser   typer   objectr   r   __annotations__r    r7   r<   rJ   rW   r^   rm   r   r   r   r\   r!   r   <module>r      s   " " " " " " "                           ? > > > > >       
  O111111%M7>8*f:L1MNNNL/1 1 1 1 1" " " " &% &% &% &% &%RF F F F   @   B 
   
 
   
 
   
 
   
   > 
   
 
   
   "       F6 6 6 6D     r!   