Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/pygments/lexers/__pycache__/mime.cpython-39.pyc
Ðазад
a a�h� � @ sr d Z ddlZddlmZmZ ddlmZ ddlmZm Z m Z mZmZm Z ddlmZmZ dgZG dd� de�ZdS ) z� pygments.lexers.mime ~~~~~~~~~~~~~~~~~~~~ Lexer for Multipurpose Internet Mail Extensions (MIME) data. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. � N)� RegexLexer�include)�get_lexer_for_mimetype)�Text�Name�String�Operator�Comment�Other)�get_int_opt� ClassNotFound� MIMELexerc s� e Zd ZdZdZdgZg d�ZdZdZ� fdd�Z d d � Z dd� Zd d� Zdd� Z dd� Zdd� ZddhZde fdefgdejfdejdfged�de fdefdedfged�d efgd!�Z� ZS )"r aD Lexer for Multipurpose Internet Mail Extensions (MIME) data. This lexer is designed to process nested multipart data. It assumes that the given data contains both header and body (and is split at an empty line). If no valid header is found, then the entire data will be treated as body. Additional options accepted: `MIME-max-level` Max recursion level for nested MIME structure. Any negative number would treated as unlimited. (default: -1) `Content-Type` Treat the data as a specific content type. Useful when header is missing, or this lexer would try to parse from header. (default: `text/plain`) `Multipart-Boundary` Set the default multipart boundary delimiter. This option is only used when `Content-Type` is `multipart` and header is missing. This lexer would try to parse from header by default. (default: None) `Content-Transfer-Encoding` Treat the data as a specific encoding. Or this lexer would try to parse from header by default. (default: None) �MIME�mime)zmultipart/mixedzmultipart/relatedzmultipart/alternativez"https://en.wikipedia.org/wiki/MIMEz2.5c sJ t � jf i |�� |�d�| _|�d�| _|�dd�| _t|dd�| _d S )NzMultipart-BoundaryZContent_Transfer_EncodingZContent_Typez text/plainzMIME-max-level���)�super�__init__�get�boundary�content_transfer_encoding�content_typer �max_nested_level)�self�options�� __class__� ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/pygments/lexers/mime.pyr ; s zMIMELexer.__init__c c s� |� d�}|�� | jv r�|�d�tj|d fV |�d�tj|� d�fV |�d�}|� d�}| � |d|�� f�D ]\}}}|| ||fV qrn|�� t |� � fV d S )N� �:� � �root)�group�lower�attention_headers�startr �Tagr � Whitespace�end�get_tokens_unprocessedr )r �match�field�pos�body�i�t�vr r r �get_header_tokensB s zMIMELexer.get_header_tokensc c s� |� � }|�� }|d dkr>|tjdfV |d }|dd � }| j�d�rP| jsz| �|�D ]\}}}|| ||fV qZd S dt� | j�� d�}t� |tj�}|�|�} | r�|| � � } | � � }}|t|d | � � � fV || tj| �� fV n|} d}|�||�D ]l} | | } | � � }|| |� }| �|�D ]\}}}| | ||fV �q0|| tj| �� fV || � � } �q| | } | t|�k�r�| t|| d � fV d S )Nr � r � multipartz^--z(--)?\n)r&