HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/sphinx/locale/__pycache__/__init__.cpython-310.pyc
o

�$�a�"�
@s�UdZddlZddlZddlmZmZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZmZGdd�de�Zee�ae
eeefefed<	
d0dee
ede
ed
ededeeeff
dd�Zd1dedeeeefddfdd�Zded
edeeeffdd�Zd0d
ededefdd�Zd0d
ededefdd�Zd
edededefdd�Zd2d
edede	fd d!�Zed	�Zed	d"�Zed#�ed$�ed%�ed&�ed'�ed(�ed)�ed*�ed+�ed,�d-�
ZiZ e
eefed.<iZ!e
eefed/<dS)3z�
    sphinx.locale
    ~~~~~~~~~~~~~

    Locale utilities.

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�
UserString�defaultdict)�NullTranslations)�Any�Callable�Dict�Iterable�List�Optional�Tuple�Unionc@sneZdZdZdZdededefdd�Zde	efdd	�Z
dededd
fdd�Zedefd
d��Z
d1dededefdd�Zdeefdd�Zdefdd�Zdedefdd�Zdedefdd�Zdedefdd�Zdedefdd�Zdedefd d!�Zdedefd"d#�Zd$edefd%d&�Zde	ee	ed'fffd(d)�Zd*e	ee	efdd
fd+d,�Zd2d-d.�Zdefd/d0�Zd
S)3�_TranslationProxya
    Class for proxy strings from gettext translations. This is a helper for the
    lazy_* functions from this module.

    The proxy implementation attempts to be as complete as possible, so that
    the lazy objects should mostly work as expected, for example for sorting.

    This inherits from UserString because some docutils versions use UserString
    for their Text nodes, which then checks its argument for being either a
    basestring or UserString, otherwise calls str() -- not unicode() -- on it.
    ��_func�_args�func�args�returncGs|st|�St�|�S�N)�str�object�__new__)�clsrr�r�8/usr/lib/python3/dist-packages/sphinx/locale/__init__.pyr s
z_TranslationProxy.__new__cCs|jf|jSrr��selfrrr�__getnewargs__&sz _TranslationProxy.__getnewargs__NcGs||_||_dSrr)rrrrrr�__init__)s
z_TranslationProxy.__init__cCs|j|j�Srrrrrr�data-sz_TranslationProxy.data�encoding�errorscCs,|r|r|j�||�S|j�|�S|j��Sr)r�encode)rr r!rrrr"4s

z_TranslationProxy.encodecCstt�Sr)�dirrrrrr�__dir__=sz_TranslationProxy.__dir__cCs
t|j�Sr)rrrrrr�__str__@�
z_TranslationProxy.__str__�othercCs
|j|Sr�r�rr'rrr�__add__Cr&z_TranslationProxy.__add__cCs
||jSrr(r)rrr�__radd__Fr&z_TranslationProxy.__radd__cCs
|j|Srr(r)rrr�__mod__Ir&z_TranslationProxy.__mod__cCs
||jSrr(r)rrr�__rmod__Lr&z_TranslationProxy.__rmod__cCs
|j|Srr(r)rrr�__mul__Or&z_TranslationProxy.__mul__cCs
||jSrr(r)rrr�__rmul__Rr&z_TranslationProxy.__rmul__�namecCs|dkr|��St|j|�S)N�__members__)r$�getattrr)rr0rrr�__getattr__Usz_TranslationProxy.__getattr__.cCs|j|jfSrrrrrr�__getstate__Z�z_TranslationProxy.__getstate__�tupcCs|\|_|_dSrr)rr6rrr�__setstate__]sz_TranslationProxy.__setstate__cCs|Srrrrrr�__copy__`sz_TranslationProxy.__copy__cCs4z
dtt|j��WStyd|jjYSw)N�iz<%s broken>)�reprrr�	Exception�	__class__�__name__rrrr�__repr__cs
�z_TranslationProxy.__repr__)NN)rr
)r=�
__module__�__qualname__�__doc__�	__slots__rrrrrrr�propertyr�bytesr"r	r$r%r*r+r,r-rr.r/r3r4r7r8r>rrrrr
s,	
r
�translators�sphinx�general�locale_dirs�language�catalog�	namespacerc		Cs�t�||f�}|jturd}d}|r d|vr ||�d�dg}n|r&|g}nd}|D]!}ztj|||d�}|dur<|}n|�|�Wq*tyKYq*w|durUt�}d}|t||f<||fS)aLook for message catalogs in `locale_dirs` and *ensure* that there is at
    least a NullTranslations catalog set in `translators`. If called multiple
    times or if several ``.mo`` files are found, their contents are merged
    together (thus making ``init`` reentrant).
    NT�_r)�	localedir�	languagesF)	rE�getr<r�split�gettext�translation�add_fallbackr;)	rHrIrJrK�
translator�has_translationrN�dir_�transrrr�initms0

��rX�category�valuecCs*z	t�||�WdStjyYdSw)a�Update locale settings.

    This does not throw any exception even if update fails.
    This is workaround for Python's bug.

    For more details:

    * https://github.com/sphinx-doc/sphinx/issues/5724
    * https://bugs.python.org/issue18378#msg215215

    .. note:: Only for internal use.  Please don't call this method from extensions.
              This will be removed in future.
    N)�locale�	setlocale�Error)rYrZrrrr\�s
�r\�
locale_dircCs<z
t�tj�\}}Wntyd}Ynwt|g||d�S)z>Initialize locale for console.

    .. versionadded:: 1.8
    N�console)r[�	getlocale�LC_MESSAGES�AttributeErrorrX)r^rJrIrLrrr�init_console�s�rccCst||fSr�rE�rJrKrrr�get_translator�r5rfcCs||ftvSrrdrerrr�is_translator_registered�r5rg�messagecCst||�}|�|�S)zcUsed instead of _ when creating TranslationProxy, because _ is
    not bound yet at that time.
    )rfrQ)rJrKrhrTrrr�_lazy_translate�s

rics dtdtdtf��fdd�}|S)aAGet a translation function based on the *catalog* and *namespace*.

    The extension can use this API to translate the messages on the
    extension::

        import os
        from sphinx.locale import get_translation

        MESSAGE_CATALOG_NAME = 'myextension'  # name of *.pot, *.po and *.mo files
        _ = get_translation(MESSAGE_CATALOG_NAME)
        text = _('Hello Sphinx!')


        def setup(app):
            package_dir = os.path.abspath(os.path.dirname(__file__))
            locale_dir = os.path.join(package_dir, 'locales')
            app.add_message_catalog(MESSAGE_CATALOG_NAME, locale_dir)

    With this code, sphinx searches a message catalog from
    ``${package_dir}/locales/${language}/LC_MESSAGES/myextension.mo``.
    The :confval:`language` is used for the searching.

    .. versionadded:: 1.8
    rhrrcsNt���stt��|�St���}t|�dkr|�|�S|�||d|d�S)N�r)rgr
rirf�lenrQ�ngettext)rhrrTrerrrQ�s


z get_translation.<locals>.gettext)rr)rJrKrQrrer�get_translation�srmr_�	Attention�Caution�Dangerr]�Hint�	Important�NotezSee also�Tip�Warning)
�	attention�caution�danger�error�hint�	important�note�seealso�tip�warning�
versionlabels�pairindextypes)rFrGr)rG)"rArQr[�collectionsrrr�typingrrrrr	r
rrr
rEr�__annotations__�boolrX�intr\rcrfrgrirmrL�__�admonitionlabelsr�r�rrrr�<module>sJ
( X���

�$**
�