관리-도구
편집 파일: quopri.cpython-34.pyo
� i fa � @ s d Z d d d d g Z d Z d Z d Z d Z y d d l m Z m Z Wn e k rj d Z d Z Yn Xd d � Z d d � Z d d d � Z d d d d � Z d d d � Z d d d � Z d d � Z d d � Z d d � Z e d k r� e � n d S)zHConversions to/from quoted-printable transport encoding as per RFC 1521.�encode�decode�encodestring�decodestring� =�L s 0123456789ABCDEF� � )�a2b_qp�b2a_qpNc C sG | d k r | S| d k r | S| t k pF d | k oC d k n S)z�Decide whether a particular byte ordinal needs to be quoted. The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521. s � _� � ~)�ESCAPE)�c� quotetabs�header� r �+/opt/alt/python34/lib64/python3.4/quopri.py�needsquoting s r c C s0 t | � } t t t | d t | d f � S)zQuote a single character.� )�ordr �bytes�HEX)r r r r �quote$ s r Fc C s� t d k rA | j � } t | d | d | �} | j | � d S| d d d � } d } x>| j � } | sr Pn g } d } | d d � d k r� | d d � } d } n xm | D]e } t | f � } t | | | � r� t | � } n | r| d k r| j d � q� | j | � q� W| d k r6| | � n t j | � } xH t | � t k r�| | d t d � d d �| t d d � } qHW| } q\ W| d k r�| | d | �n d S)av Read 'input', apply quoted-printable encoding, and write to 'output'. 'input' and 'output' are binary file objects. The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521. The 'header' flag indicates whether we are encoding spaces as _ as per RFC 1522.Nr r s c S s� | rN | d d � d k rN | j | d d � t | d d � � | � n7 | d k rt | j t | � | � n | j | | � d S)N� s � .���r r )�writer )�s�output�lineEndr r r r ; s 2zencode.<locals>.writer r r r r s = r r )r �readr �readliner r r �append�EMPTYSTRING�join�len�MAXLINESIZE) �inputr r r �data�odatar Zprevline�lineZoutlineZstrippedr Zthisliner r r r , s@ c C sd t d k r"