o
    ‹åg+  ã                   @   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ú Úinput_encodingÚencoding)úcomment-tagsr   )ÚkeywordsÚoptionsÚjoinÚgetÚconfigÚsuperÚ__init__)Úselfr	   Úcomment_tagsr
   ©Ú	__class__© úP/var/www/html/flaskapp/venv/lib/python3.10/site-packages/mako/ext/babelplugin.pyr      s   ÿþzBabelMakoExtractor.__init__c                 C   s
   |   |¡S )N)Úprocess_file)r   Úfileobjr   r   r   Ú__call__   s   
zBabelMakoExtractor.__call__c           	      c   sJ   � | j d }t|| j|| jƒD ]\}}}}||d  |||| fV  qd S )Nr   é   )r   r   r	   r
   )	r   ÚcodeÚcode_linenoÚtranslator_stringsr   ÚlinenoÚfuncnameÚmessagesÚ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
   Ú	extractorr   r   r   Úextract,   s   €r'   N)Ú__doc__Úbabel.messages.extractr   Úmako.ext.extractr   r   r'   r   r   r   r   Ú<module>   s
   