gL iUddlmZddlmZmZmZmZddlmZm Z m Z m Z m Z m Z ddlmZddlmZmZerddlmZeeZe de egefZiZd ed <dd Zddd Zdd Zd dZd!dZe d"dZ e d#dZ e d$dZ e d%dZ d&dZ e d'dZ!e d(dZ!d)dZ! d*dZ" d+dZ#d,dZ$y)-) annotations)HashableIterableMutableMappingSequence) TYPE_CHECKINGAnyCallableLiteralTypeVaroverloadimport_optional_dependency) is_integer is_list_like) ExcelWriter usecols_func)boundz"MutableMapping[str, ExcelWriter_t]_writerscZt|s td|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 [/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pandas/io/excel/_util.pyregister_writerr"s* E?ABB--K!H[crdddddd}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. openpyxlpyxlsbxlrdodf)xlsxxlsmxlsbxlsods)r$r%r&r()readerwriterr* xlsxwriterwarn)errorsr$r)extmode_default_readers_default_writersr+s rget_default_enginer22sz$   ' '' ' x/ VL '3 V $$$$$rcX t|S#t$r}td|d|d}~wwxYw)NzNo Excel writer '')rKeyErrorr)rerrs r get_writerr7[s<F $$ F,[M;<#EFs )$)cd}|jjD]N}t|}|tdks|tdkDrtd||dz|ztdz 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. rAZzInvalid column name: )upperstripordr)xindexccps r _excel2numrDbs}& E WWY__ / V C=BSM4QC89 9 R#c(*Q. / 19rc g}|jdD]h}d|vrH|jd}|jtt|dt|ddzO|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<)splitextendrangerDappend)areascolsrngrngss r _range2colsrPsv*D{{3) #:99S>D KKja1:d1g3F3JK L KK 3 ( ) KrcyNusecolss rmaybe_convert_usecolsrVrcyrRrSrTs rrVrVrWrcyrRrSrTs rrVrVrWrcyrRrSrTs rrVrVrWrcp||St|r tdt|tr 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`. z}Passing an integer for `usecols` is no longer supported. Please pass in a list of int from 0 to `usecols` inclusive instead.)rr isinstancestrrPrTs rrVrVsE ' R  '37## NrcyrRrS freeze_paness rvalidate_freeze_panesrarWrcyrRrSr_s rrararWrc`|,t|dk(rtd|Drytdy)Nc3<K|]}t|tywrR)r\int).0items r z(validate_freeze_panes..s* &*JtS !* sTzLfreeze_panes must be of form (row, column) where row and column are integersF)lenallrr_s rrarasE |  !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_rowlastis rfill_mi_headerrrsr* q6D 1c#h 1~q6D q6R<3q6>CF"KNq6D  rct|rt|tsJt|}nt|trJ|}||}|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\rmax)rn index_colrq header_names rpop_header_namerwsw*I)X...  Ni222 a&K%+$K BQ2$QUW5 55rcR|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 )copyupdate) engine_kwargskwargsresults rcombine_kwargsr~6s.&##% MM& MrN)r ExcelWriter_treturnNone)r))r.r]r/zLiteral['reader', 'writer']rr])rr]rr)r@r]rrf)rLr]r list[int])rUzstr | list[int]rr)rU list[str]rr)rUrrr)rUrrr)rUz1str | list[int] | list[str] | usecols_func | Nonerz+None | list[int] | list[str] | usecols_func)r`ztuple[int, int]rz Literal[True])r`rrzLiteral[False])r`ztuple[int, int] | Nonerbool)rnlist[Hashable]roz list[bool]rz!tuple[list[Hashable], list[bool]])rnrruzint | Sequence[int]rz&tuple[Hashable | None, list[Hashable]])r{zdict[str, Any] | Noner|dictrr)% __future__rcollections.abcrrrrtypingrr r r r r pandas.compat._optionalrpandas.core.dtypes.commonrrpandas.io.excel._basertyperobjectrr__annotations__rr2r7rDrPrVrarrrwr~rSrrrsK" ? 1%M>8*f:L1MNL/1 ,1 " &%RF@B         >0>    "   &0 & F6 6$76+6Dr