o
    h                     @   sV   d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlmZ G dd deeZdS )    N)	Extractor)get_extractor)Message)MessageExtractorc                   @   s6   e Zd ZdZdZdgZdddZddd	Zd
d ZdS )LinguaMakoExtractorzMako templatesFz.makozutf-8 )encodingzcomment-tagsNc                 c   sp    || _ || _td| _|d u rt|d}nt|}|}| |E d H  W d    d S 1 s1w   Y  d S )Nzx.pyr)optionsfilenamer   python_extractoropen
contextlibnullcontextprocess_file)selfr   r
   fileobjctxfile_ r   i/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/mako/ext/linguaplugin.py__call__   s   

"zLinguaMakoExtractor.__call__c              
   c   s    |   }|dr'|dv s|drd}n|dr#|dd  }|d7 }t|}| | j| j||d D ]}|rSt	|j
|j|j|jd	||jg |j|j}|V  q8d S )
N:)ztry:zelse:exceptr   elif   pass    )getvaluestripendswith
startswithioStringIOr   r   r
   r   msgctxtmsgidmsgid_pluralflagsjoincommenttcommentlocation)r   codecode_linenotranslator_stringssourcemsgr   r   r   process_python#   s0   


	z"LinguaMakoExtractor.process_python)N)	__name__
__module____qualname____doc__	use_bytes
extensionsdefault_configr   r2   r   r   r   r   r      s    

r   )	r   r#   lingua.extractorsr   r   r   mako.ext.extractr   r   r   r   r   r   <module>   s   