U
    \g%i+  ã                   @   s8   d Z ddlmZ ddlmZ G dd„ deƒZdd„ ZdS )	zEgettext message extraction via Babel: https://pypi.org/project/Babel/é    )Úextract_python)ÚMessageExtractorc                       s,   e Zd Z‡ fdd„Zdd„ Zdd„ Z‡  ZS )ÚBabelMakoExtractorc                    s<   || _ || _d |¡| d| dd ¡¡dœ| _tƒ  ¡  d S )Nú Zinput_encodingÚencoding)úcomment-tagsr   )ÚkeywordsÚoptionsÚjoinÚgetÚconfigÚsuperÚ__init__)Úselfr   Úcomment_tagsr	   ©Ú	__class__© úS/var/www/html/api-medvista/venv/lib/python3.8/site-packages/mako/ext/babelplugin.pyr      s     
ÿþzBabelMakoExtractor.__init__c                 C   s
   |   |¡S )N)Zprocess_file)r   Úfileobjr   r   r   Ú__call__   s    zBabelMakoExtractor.__call__c           	      c   sH   | j d }t|| j|| jƒD ]&\}}}}||d  |||| fV  qd S )Nr   é   )r   r   r   r	   )	r   ÚcodeZcode_linenoZtranslator_stringsr   ÚlinenoÚfuncnameÚmessagesZpython_translator_commentsr   r   r   Úprocess_python   s    
û
üz!BabelMakoExtractor.process_python)Ú__name__Ú
__module__Ú__qualname__r   r   r   Ú__classcell__r   r   r   r   r      s   r   c                 c   s   t |||ƒ}|| ƒE dH  dS )a  Extract messages from Mako templates.

    :param fileobj: the file-like object the messages should be extracted from
    :param keywords: a list of keywords (i.e. function names) that should be
                     recognized as translation functions
    :param comment_tags: a list of translator tags to search for and include
                         in the results
    :param options: a dictionary of additional options (optional)
    :return: an iterator over ``(lineno, funcname, message, comments)`` tuples
    :rtype: ``iterator``
    N)r   )r   r   r   r	   Z	extractorr   r   r   Úextract,   s    r!   N)Ú__doc__Zbabel.messages.extractr   Zmako.ext.extractr   r   r!   r   r   r   r   Ú<module>   s   