관리-도구
편집 파일: babelplugin.cpython-37.pyc
B �C]Z � @ s8 d Z ddlmZ ddlmZ G dd� de�Zdd� ZdS ) z@gettext message extraction via Babel: http://babel.edgewall.org/� )�extract_python)�MessageExtractorc s, e Zd Z� fdd�Zdd� Zdd� Z� ZS )�BabelMakoExtractorc s@ || _ || _d�|�|�d|�dd ��d�| _tt| ��� d S )N� Zinput_encoding�encoding)zcomment-tagsr )�keywords�options�join�get�config�superr �__init__)�selfr �comment_tagsr )� __class__� �E/opt/alt/python37/lib/python3.7/site-packages/mako/ext/babelplugin.pyr s zBabelMakoExtractor.__init__c C s | � |�S )N)Zprocess_file)r �fileobjr r r �__call__ s zBabelMakoExtractor.__call__c c sL | j d }x<t|| j|| j�D ]&\}}}}||d |||| fV qW d S )Nzcomment-tags� )r r r r ) r �codeZcode_linenoZtranslator_stringsr �lineno�funcname�messagesZpython_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 |||�}x|| �D ] }|V qW dS )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 extractor�messager r r �extract, s r N)�__doc__Zbabel.messages.extractr Zmako.ext.extractr r r r r r r �<module> s