ó
    ‰*£h�2  ã                   óR  • S r SSKJrJrJr  SSKrSSKrSSKrSSKrSSK	r	\R                  R                  S:”  a  \r\rSSKJr  SSKJr  O\rSSKJr  \R,                  " \5      rSSKJr  S	S
KJrJrJrJrJ r J!r!J"r"  S	SK#J$r$  0 r%  SS jr&S r'\RP                  " \'S9r)   SS jr*g)ué	  
The `latexencode` module provides a set of routines that allows you to
convert a unicode string to LaTeX escape sequences.

For basic usage you can use the :py:func:`unicode_to_latex()` function
directly::

  >>> from pylatexenc.latexencode import unicode_to_latex
  >>> print(unicode_to_latex('Ã€ votre santÃ©'))
  \`A votre sant\'e
  >>> print(unicode_to_latex('The length of samples #3 & #4 is 3Î¼m'))
  The length of samples \#3 \& \#4 is 3\ensuremath{\mu}m

The conversion is handled by the class :py:class:`UnicodeToLatexEncoder`.  If
you are converting multiple strings, you may create an instance with the flags
you like and invoke its method
:py:meth:`~UnicodeToLatexEncoder.unicode_to_latex()` as many times as necessary::

  >>> from pylatexenc.latexencode import UnicodeToLatexEncoder
  >>> u = UnicodeToLatexEncoder(unknown_char_policy='replace')
  >>> print(u.unicode_to_latex('Ã€ votre santÃ©'))
  \`A votre sant\'e
  >>> print(u.unicode_to_latex('The length of samples #3 & #4 is 3Î¼m'))
  The length of samples \#3 \& \#4 is 3\ensuremath{\mu}m
  >>> print(u.unicode_to_latex('Ã€ votre santÃ©: ä¹¾æ�¯'))
  No known latex representation for character: U+4E7E - â€˜ä¹¾â€™
  No known latex representation for character: U+676F - â€˜æ�¯â€™
  \`A votre sant\'e: {\bfseries ?}{\bfseries ?}

Example using custom conversion rules::

  >>> from pylatexenc.latexencode import UnicodeToLatexEncoder, \
  ...     UnicodeToLatexConversionRule, RULE_REGEX
  >>> u = UnicodeToLatexEncoder(
  ...     conversion_rules=[
  ...         UnicodeToLatexConversionRule(rule_type=RULE_REGEX, rule=[
  ...             (re.compile(r'-->'), r'\\textrightarrow'),
  ...             (re.compile(r'<--'), r'\\textleftarrow'),
  ...         ]),
  ...         'defaults'
  ...     ]
  ... )
  >>> print(u.unicode_to_latex("Cheers --> Ã€ votre santÃ©"))
  Cheers {\textrightarrow} \`A votre sant\'e

See :py:class:`UnicodeToLatexEncoder` and
:py:class:`UnicodeToLatexConversionRule`.  Note for regex rules, the replacement
text is expanded like the second argument of `re.sub()` and backslashes need to
be escaped even inside raw strings.

.. versionadded:: 2.0

   The class :py:class:`UnicodeToLatexEncoder` along with its helper functions
   and classes were introduced in `pylatexenc 2.0`.

   The earlier function :py:func:`utf8tolatex()` that was available in
   `pylatexenc 1.x` is still provided unchanged, so code written for `pylatexenc
   1.x` should work without changes.  New code is however strongly encouraged to
   employ the new API.
é    )Úprint_functionÚabsolute_importÚunicode_literalsNé   )ÚMappingProxyType)Úgetfullargspec)Ú
getargspec)Ú_utilé   )Úget_builtin_uni2latex_dictÚ	RULE_DICTÚ
RULE_REGEXÚRULE_CALLABLEÚUnicodeToLatexConversionRuleÚget_builtin_conversion_rulesÚUnicodeToLatexEncoder)ÚPartialLatexToLatexEncoderc                 ó€   • XUU4nU[         ;   a
  [         U   nO[        UUUUS9nU[         U'   UR                  U 5      $ )a`  
Shorthand for constructing a :py:class:`UnicodeToLatexEncoder` instance and
calling its :py:meth:`~UnicodeToLatexEncoder.unicode_to_latex()` method.

The :py:class:`UnicodeToLatexEncoder` instances for given option settings
are cached, making repeated calls to :py:func:`unicode_to_latex()` possible
without creating a new instance upon each call.

The parameters `non_ascii_only`, `replacement_latex_protection`,
`unknown_char_policy`, and `unknown_char_warning` are directly passed on to
the :py:class:`UnicodeToLatexEncoder` constructor.  See the class doc for
:py:class:`UnicodeToLatexEncoder` for more information about what they do.

You may only use arguments to this function that are python hashable (like
`True`, `False`, or simple strings) to help us keep a cache of previously
constructed :py:class:`UnicodeToLatexEncoder` instances.  For instance, it
is not possible to provide a callable to `unknown_char_policy`.  It is also
not possible to specify custom conversion rules with this helper function.
If you need any of these features, simply create a
:py:class:`UnicodeToLatexEncoder` instance directly.
)Únon_ascii_onlyÚreplacement_latex_protectionÚunknown_char_policyÚunknown_char_warning)Ú_u2l_obj_cacher   Úunicode_to_latex)Úsr   r   r   r   ÚkeyÚus          Ú\/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pylatexenc/latexencode/__init__.pyr   r   �   s[   € ð0 Ð9LØð!€Cð ŒnÓÜ˜3Ñ‰ä!°Ø?[Ø6IØ7KñMˆð  Œ�sÑà×Ñ˜aÓ Ð ó    c                  ó.   • SSK Jn   U R                  5       $ )Nr   )Ú	uni2latex)Ú_uni2latexmapr!   Úcopy)Ú
_uni2latexs    r   Ú_get_deprecated_utf82latexr%   ¾   s   € õ" 7Ø�?‰?ÓÐr   )Úgenerate_dict_fnc                 ó  • [        U 5      n [        R                  " SU 5      n U (       d  gSnU  HÒ  nU(       a  [        U5      S:  a  XV-  nM  [        R                  [        U5      S5      nUb  XR(       a  USS S:X  a  SU-   S	-   OU-  nM_  [        U5      S
:¼  a  [        U5      S::  d  US;   a  XV-  nM‰  S[        U5      U4-  nU(       a  [        U5      e[        R                  U5        U(       a  US-  nMÎ  XV-  nMÔ     U$ )u<  
.. note::

   Since `pylatexenc 2.0`, it is recommended to use the the
   :py:func:`unicode_to_latex()` function or the
   :py:class:`UnicodeToLatexEncoder` class instead of the earlier function
   `utf8tolatex()`.

   The new routines provide much more flexibility and versatility.  For
   instance, you can specify custom escape sequences for certain characters.
   Some cheap benchmarks seem to indicate that the new routines are not
   significantly slower than the `utf8tolatex()` function.  Also, the name
   `utf8tolatex()` was poorly chosen, since the argument is in fact not
   'utf-8'-encoded but rather a Python unicode string object.

   The function `utf8tolatex()` is still provided unchanged from `pylatexenc
   1.x`.  We do not plan to remove this function in the near future so it is
   not (yet) considered as deprecated and we will continue to provide it in
   near future versions of `pylatexenc`.  Bug reports, improvements, and new
   features will however be directed to :py:func:`UnicodeToLatexEncoder()`.

Encode a UTF-8 string to a LaTeX snippet.

If `non_ascii_only` is set to `True`, then usual (ascii) characters such as ``#``,
``{``, ``}`` etc. will not be escaped.  If set to `False` (the default), they are
escaped to their respective LaTeX escape sequences.

If `brackets` is set to `True` (the default), then LaTeX macros are enclosed in
brackets.  For example, ``santÃ©`` is replaced by
``sant{\'e}`` if `brackets=True` and by ``sant\'e`` if `brackets=False`.

.. warning::
    Using `brackets=False` might give you an invalid LaTeX string, so avoid
    it! (for instance, ``maÃ®tre`` will be
    replaced incorrectly by ``ma\^\itre`` resulting in an unknown macro ``\itre``).

If `substitute_bad_chars=True`, then any non-ascii character for which no LaTeX escape
sequence is known is replaced by a question mark in boldface. Otherwise (by default),
the character is left as it is.

If `fail_bad_chars=True`, then a `ValueError` is raised if we cannot find a
character substitution for any non-ascii character.

.. versionchanged:: 1.3

    Added `fail_bad_chars` switch
ÚNFCÚ é   Nr   r   Ú\Ú{Ú}é    z
	z5Character cannot be encoded into LaTeX: U+%04X - `%s'z{\bfseries ?})	ÚunicodeÚunicodedataÚ	normalizeÚordÚ
utf82latexÚgetÚ
ValueErrorÚloggerÚwarning)	r   r   ÚbracketsÚsubstitute_bad_charsÚfail_bad_charsÚresultÚchÚlchÚmsgs	            r   Úutf8tolatexr?   ð   s   € ôd 	�‹
€AÜ×Ò˜e QÓ'€AæØà€FÛˆæœs 2›w¨›}Ø‰LŠFô —.‘.¤ R£¨$Ó/ˆCØ‘ð ­H¸¸Q¸q¸ÀTÓ9I˜S ™W Sš[Ø ñ$’ä�r“7˜b“=¤S¨£W°£^Ø˜“>à‘’ð OÔRUÐVXÓRYÐ[]ÐQ^Ñ^�Þ!Ü$ S›/Ð)ä—‘˜sÔ#Þ'ØÐ.Ñ.’Fð ‘L’Fñ9 ð< €Mr   )FÚbracesÚkeepT)FTFF)+Ú__doc__Ú
__future__r   r   r   r0   ÚloggingÚsysÚ	functoolsÚ	itertoolsÚversion_infoÚmajorÚstrr/   Ú
basestringÚtypesr   Ú_MappingProxyTypeÚinspectr   Údictr	   Ú	getLoggerÚ__name__r6   r)   r
   Ú_unicode_to_latex_encoderr   r   r   r   r   r   r   Ú_partial_latex_encoderr   r   r   r%   ÚLazyDictr3   r?   © r   r   Ú<module>rV      s»   ðñ4;÷z IÑ Hã Û Û 
Û Û à×Ñ×Ñ˜AÓØ€GØ€Jå;æ&àÐå4à	×	Ò	˜8Ó	$€õ ÷÷ ñ õð €ð LTØFJô$!ò\ð* �^Š^Ð-GÑH€
ðð8 NSØ$õWr   