%PDF- %PDF-
Direktori : /usr/local/lib/python3.8/email/__pycache__/ |
Current File : //usr/local/lib/python3.8/email/__pycache__/header.cpython-38.pyc |
U p©ßa&^ ã @ sê d Z dddgZddlZddlZddlZddlZddlmZ ddlm Z e jZdZd Z d ZdZdZd ZdZedƒZedƒZe dejejB ¡Ze d¡Ze d¡ZejjZdd„ Zddd„ZG dd„ dƒZG dd„ dƒZ G dd„ de!ƒZ"dS )z+Header encoding and decoding functionality.ÚHeaderÚ decode_headerÚmake_headeré N)ÚHeaderParseError)ÚcharsetÚ ú ó z Ú éN z úus-asciizutf-8ai =\? # literal =? (?P<charset>[^?]*?) # non-greedy up to the next ? is the charset \? # literal ? (?P<encoding>[qQbB]) # either a "q" or a "b", case insensitive \? # literal ? (?P<encoded>.*?) # non-greedy up to the next ?= is the encoded string \?= # literal ?= z[\041-\176]+:$z \n[^ \t]+:c C s˜ t | dƒrdd„ | jD ƒS t | ¡s.| dfgS g }| ¡ D ]€}t |¡}d}|r:| d¡}|rj| ¡ }d}|r~| |ddf¡ |rL| d¡ ¡ }| d¡ ¡ }| d¡}| |||f¡ qLq:g } t |ƒD ]J\} }| dkrÈ|d rÈ|| d d rÈ|| d d ¡ rÈ| | d ¡ qÈt| ƒD ]}||= qg } |D ]Ê\}}}|dkrV| ||f¡ n¤|d kr|t j |¡}| ||f¡ n~|dkrît|ƒd }|r¬|d dd| … 7 }zt j |¡}W n tjk rÜ tdƒ‚Y nX | ||f¡ ntd| ƒ‚q2g }d }}| D ]v\}}t|tƒr,t|dƒ}|dkr@|}|}nB||krb| ||f¡ |}|}n |dkrz|t| 7 }n||7 }q| ||f¡ |S )a; Decode a message header value without converting charset. Returns a list of (string, charset) pairs containing each of the decoded parts of the header. Charset is None for non-encoded parts of the header, otherwise a lower-case string containing the name of the character set specified in the encoded string. header may be a string that may or may not contain RFC2047 encoded words, or it may be a Header object. An email.errors.HeaderParseError may be raised when certain decoding error occurs (e.g. a base64 decoding exception). Ú_chunksc S s( g | ] \}}t |t|ƒ¡t|ƒf‘qS © )Ú_charsetZ_encodeÚstr)Ú.0Ústringr r r ú(/usr/local/lib/python3.8/email/header.pyÚ <listcomp>M s ÿz!decode_header.<locals>.<listcomp>NTr Fé é ÚqÚbé z===zBase64 decoding errorzUnexpected encoding: zraw-unicode-escape)Úhasattrr ÚecreÚsearchÚ splitlinesÚsplitÚpopÚlstripÚappendÚlowerÚ enumerateÚisspaceÚreversedÚemailÚ quoprimimeZ header_decodeÚlenZ base64mimeÚdecodeÚbinasciiÚErrorr ÚAssertionErrorÚ isinstancer ÚbytesÚBSPACE)ÚheaderZwordsÚlineÚpartsÚfirstZ unencodedr ÚencodingÚencodedZdroplistÚnÚwÚdZ decoded_wordsZencoded_stringZwordZpaderrZ collapsedZ last_wordÚlast_charsetr r r r = s| ÿ 4 c C sF t |||d}| D ].\}}|dk r4t|tƒs4t|ƒ}| ||¡ q|S )a¼ Create a Header from a sequence of pairs as returned by decode_header() decode_header() takes a header value string and returns a sequence of pairs of the format (decoded_string, charset) where charset is the string name of the character set. This function takes one of those sequence of pairs and returns a Header instance. Optional maxlinelen, header_name, and continuation_ws are as in the Header constructor. )Ú maxlinelenÚheader_nameÚcontinuation_wsN)r r- ÚCharsetr! )Zdecoded_seqr: r; r<