o
    gV                     @   sB   d Z dZddlZddlmZ ddlmZ G dd deZe Z	dS )zL
This package contains modules for language-dependent features of Docutils.
reStructuredText    N)import_module)normalize_language_tagc                   @   s@   e Zd ZdZdZdZdZdd Zddd	Zd
d Z	dddZ
dS )LanguageImportera  Import language modules.

    When called with a BCP 47 language tag, instances return a module
    with localisations from `docutils.languages` or the PYTHONPATH.

    If there is no matching module, warn (if a `reporter` is passed)
    and fall back to English.
    )zdocutils.languages. zHLanguage "%s" not supported: Docutils-generated text will be in English.enc                 C   s
   i | _ d S N)cache)self r   Y/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/docutils/languages/__init__.py__init__#   s   
zLanguageImporter.__init__Nc              
   C   sv   d}| j D ]3}zt|| }| | W  |S  ttfy8   |r+|r+|d|  n|r6|d||   Y qw |S )z/Try loading module `name` from `self.packages`.Nz+%s is no complete Docutils language module.zModule "%s" not found.)packagesr   check_contentImportErrorAttributeErrorinfo)r
   namereportermodulepackager   r   r   import_from_packages&   s"   
z%LanguageImporter.import_from_packagesc                 C   s,   t |jtrt |jtrt |jtstdS )z+Check if we got a Docutils language module.N)
isinstancelabelsdictbibliographic_fieldsauthor_separatorslistr   )r
   r   r   r   r   r   7   s   

zLanguageImporter.check_contentc                 C   s   z| j | W S  ty   Y nw t|D ]}|dd}| ||}|d ur( nq|r3|| j|  | jr<| | j}|rK|dkrK|d||f  || j |< |S )N-_r   zUsing %s for language "%s".)	r	   KeyErrorr   replacer   warningwarn_msgfallbackr   )r
   language_coder   tagr   r   r   r   __call__>   s&   
zLanguageImporter.__call__r   )__name__
__module____qualname____doc__r   r#   r$   r   r   r   r'   r   r   r   r   r      s    
r   )
r+   __docformat__sys	importlibr   docutils.utilsr   objectr   get_languager   r   r   r   <module>   s   
?