
    Ki                         	 d dl mZ n# e$ r	 d dlmZ Y nw xY wd dlZd dlZd
dZd
dZ G d de          Z G d d	e	          Z
dS )    )MutableMappingN   c                     t          j        d                    | |                                          t          |dz              d S )NzDeprecated (pylatexenc {}): {}    
stacklevelwarningswarnformatstripDeprecationWarning)vermsgr   s      h/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/pylatexenc/_util.pypylatexenc_deprecated_verr   -   sJ    M)00ciikkBBa<         c                     t          j        d                    |                                           t          |dz              d S )NzfDeprecated (pylatexenc 2.0): {} [see https://pylatexenc.readthedocs.io/en/latest/new-in-pylatexenc-2/]r   r   r	   )r   r   s     r   pylatexenc_deprecated_2r   5   sJ    MS					a<     r   c                   H    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 ZdS )LazyDictay  
    A lazy dictionary that loads its data when it is first queried.

    This is used to store the legacy
    :py:data:`pylatexenc.latexwalker.default_macro_dict` as well as
    :py:data:`pylatexenc.latex2text.default_macro_dict` etc.  Such that these
    "dictionaries" are still exposed at the module-level, but the data is loaded
    only if they are actually queried.
    c                 "    d | _         || _        d S N
_full_dict_generate_dict_fn)selfgenerate_dict_fns     r   __init__zLazyDict.__init__P   s    !1r   c                 J    | j         d S |                                 | _         d S r   r   r   s    r   _ensure_instancezLazyDict._ensure_instanceT   s&    ?&F0022r   c                 ^    |                                   | j                            |          S r   )r"   r   __getitem__r   keys     r   r$   zLazyDict.__getitem__Y   *    **3///r   c                 `    |                                   | j                            ||          S r   )r"   r   __setitem__)r   r&   vals      r   r)   zLazyDict.__setitem__]   s,    **3444r   c                 ^    |                                   | j                            |          S r   )r"   r   __delitem__r%   s     r   r,   zLazyDict.__delitem__a   r'   r   c                 R    |                                   t          | j                  S r   )r"   iterr   r!   s    r   __iter__zLazyDict.__iter__e   s$    DO$$$r   c                 R    |                                   t          | j                  S r   )r"   lenr   r!   s    r   __len__zLazyDict.__len__i   s$    4?###r   c                 \    |                                   | j                                        S r   )r"   r   copyr!   s    r   r4   zLazyDict.copym   s(    ##%%%r   c                 \    |                                   | j                                        S r   )r"   r   clearr!   s    r   r6   zLazyDict.clearq   s(    $$&&&r   N)__name__
__module____qualname____doc__r   r"   r$   r)   r,   r/   r2   r4   r6    r   r   r   r   F   s         2 2 23 3 3
0 0 05 5 50 0 0% % %$ $ $& & &' ' ' ' 'r   r   c                   *     e Zd ZdZ fdZddZ xZS )LineNumbersCalculatorz,
    Utility to calculate line numbers.
    c                     t          t          |                                            d }t           ||                    | _        d S )Nc              3      K   dV  d}|t          |           k     r<|                     d|          }|dk    rd S |dz  }|V  |t          |           k     :d S d S )Nr   
r   )r1   find)xks     r   find_all_new_linesz:LineNumbersCalculator.__init__.<locals>.find_all_new_lines   so      GGGAc!ff**FF4OO77FQ  c!ff******r   )superr=   r   list_pos_new_lines)r   srE   	__class__s      r   r   zLineNumbersCalculator.__init__   sS    #T**33555	 	 	 ##5#5a#8#899r   Fc                     t          j        | j        |          dz
  }|dk    r|t          | j                  k     sJ || j        |         z
  }|rd|z   |dS d|z   |fS )a  
        Return the line and column number corresponding to the given `pos`.

        Return a tuple `(lineno, colno)` giving line number and column number.
        Line numbers start at 1 and column number start at zero, i.e., the
        beginning of the document (`pos=0`) has line and column number `(1,0)`.
        If `as_dict=True`, then a dictionary with keys 'lineno', 'colno' is
        returned instead of a tuple.
        r   r   )linenocolno)bisectbisect_rightrH   r1   )r   posas_dictline_nocol_nos        r   pos_to_lineno_colnoz)LineNumbersCalculator.pos_to_lineno_colno   s}     %d&93??A!||#d.A*B*B B B B Bt*733 	<'kF;;;GV$$r   )F)r7   r8   r9   r:   r   rT   __classcell__)rJ   s   @r   r=   r=   ~   sV         : : : : :&% % % % % % % %r   r=   )r   )collections.abcr   ImportErrorcollectionsr
   rN   r   r   r   objectr=   r;   r   r   <module>rZ      s   >+....... + + +********+        "-' -' -' -' -'~ -' -' -'p,% ,% ,% ,% ,%F ,% ,% ,% ,% ,%s   	 