o
    h+                     @   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__ h/var/www/html/construction_image-detection-poc/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
   