U  e3@sJddlmZddlmZddlZddlmZddlmZGdddZdS))BytesIO)StringION)lexer) parsetreec@s,eZdZdZddZddZeddZdS) MessageExtractorTccs4tj||jdd}||EdHdS)Nencoding)input_encoding)rLexerreadconfigparse extract_nodesZ get_children)selffileobjZ template_noder>/opt/hc_python/lib/python3.8/site-packages/mako/ext/extract.py process_files  zMessageExtractor.process_fileccs`g}d}|jdpd}ttdtd|jd}|D]"}d}|r\t|tjr\|j s\q6t|tj r|j }|r| | |j|q6|D]&} || rd}| | |j|qq6t|tjr|jj} |j}nt|tjr|jj} |j}nt|tjr|jj} |j}nt|tjr(|jj} ntt|tjrD|j} |j}nXt|tjrh|jr`d}q6|j } n4t|tjrd}|jj} nt|tjr6|jj} nq6|r|dd|jd krg}d d |D} t| tr|jr| |d } d} |jrt!d | } n t"d| } |#| |jd | D]} | Vd} q&| rBg}d}|r6|$|EdHq6dS)NFrasciiz\s+z comment-tagsTrcSsg|] }|dqS)rr).0commentrrr [sz2MessageExtractor.extract_nodes..backslashreplace  )%r listfilterresplit isinstancerTextcontentstripCommenttextextend_split_commentlineno startswithZDefTagZ function_declcodenodesZBlockTagZ body_declZCallTagZPageTagZCallNamespaceTagZ expressionZ ControlLineZisendZCode Expressionstr use_bytesencoderrZprocess_pythonr )rr+Ztranslator_commentsZin_translator_commentsrZ comment_tagsnodeZ child_nodesvalueZ comment_tagr*Ztranslator_stringsZused_translator_commentsmessagerrrr s               zMessageExtractor.extract_nodescsfddt|DS)zzReturn the multiline comment at lineno split into a list of comment line numbers and the accompanying comment linecsg|]\}}||fqSrr)rindexliner(rrr~sz3MessageExtractor._split_comment..) enumerate splitlines)r(rrr5rr'zs  zMessageExtractor._split_commentN)__name__ __module__ __qualname__r.rr staticmethodr'rrrrrs br)iorrrmakorrrrrrrs