AlkantarClanX12
Current Path : /proc/thread-self/root/opt/alt/python33/lib64/python3.3/email/__pycache__/ |
Current File : //proc/thread-self/root/opt/alt/python33/lib64/python3.3/email/__pycache__/policy.cpython-33.pyc |
� ��fj! c @ s� d Z d d l m Z m Z m Z m Z d d l m Z d d l m Z d d d d d d d d g Z e Gd d � d e � � Z e � Z e ` e j d d � Z e j d d � Z e j d d d d � Z d S( uc This will be the home for the policy that hooks in the new code that adds all the email6 features. i ( u Policyu Compat32u compat32u _extend_docstrings( u _has_surrogates( u HeaderRegistryu Compat32u compat32u Policyu EmailPolicyu defaultu strictu SMTPu HTTPc s� | Ee Z d Z d Z d Z e � Z � f d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d d � Z � S( u EmailPolicyu + PROVISIONAL The API extensions enabled by this policy are currently provisional. Refer to the documentation for details. This policy adds new header parsing and folding algorithms. Instead of simple strings, headers are custom objects with custom attributes depending on the type of the field. The folding algorithm fully implements RFCs 2047 and 5322. In addition to the settable attributes listed above that apply to all Policies, this policy adds the following additional attributes: refold_source -- if the value for a header in the Message object came from the parsing of some source, this attribute indicates whether or not a generator should refold that value when transforming the message back into stream form. The possible values are: none -- all source values use original folding long -- source values that have any line that is longer than max_line_length will be refolded all -- all values are refolded. The default is 'long'. header_factory -- a callable that takes two arguments, 'name' and 'value', where 'name' is a header field name and 'value' is an unfolded header field value, and returns a string-like object that represents that header. A default header_factory is provided that understands some of the RFC5322 header field types. (Currently address fields and date fields have special treatment, while all other fields are treated as unstructured. This list will be completed before the extension is marked stable.) u longc s9 d | k r% t j | d t � � n t � j | � d S( Nu header_factory( u objectu __setattr__u HeaderRegistryu superu __init__( u selfu kw( u __class__( u1 /opt/alt/python33/lib64/python3.3/email/policy.pyu __init__B s u EmailPolicy.__init__c C s | j | j S( u� + The implementation for this class returns the max_count attribute from the specialized header class that would be used to construct a header of type 'name'. ( u header_factoryu max_count( u selfu name( ( u1 /opt/alt/python33/lib64/python3.3/email/policy.pyu header_max_countI s u EmailPolicy.header_max_countc C sU | d j d d � \ } } | j d � d j | d d � � } | | j d � f S( uc + The name is parsed as everything up to the ':' and returned unmodified. The value is determined by stripping leading whitespace off the remainder of the first line, joining all subsequent lines together, and stripping any trailing carriage return or linefeed characters. (This is the same as Compat32). i u :i u u Nu ( u splitu lstripu joinu rstrip( u selfu sourcelinesu nameu value( ( u1 /opt/alt/python33/lib64/python3.3/email/policy.pyu header_source_parse[ s &u EmailPolicy.header_source_parsec C s� t | d � r4 | j j � | j � k r4 | | f St | t � rj t | j � � d k rj t d � � n | | j | | � f S( u� + The name is returned unchanged. If the input value has a 'name' attribute and it matches the name ignoring case, the value is returned unchanged. Otherwise the name and value are passed to header_factory method, and the resulting custom header object is returned as the value. In this case a ValueError is raised if the input value contains CR or LF characters. u namei uD Header values may not contain linefeed or carriage return characters( u hasattru nameu loweru isinstanceu stru lenu splitlinesu ValueErroru header_factory( u selfu nameu value( ( u1 /opt/alt/python33/lib64/python3.3/email/policy.pyu header_store_parseh s * 'u EmailPolicy.header_store_parsec C s2 t | d � r | S| j | d j | j � � � S( ui + If the value has a 'name' attribute, it is returned to unmodified. Otherwise the name and the value with any linesep characters removed are passed to the header_factory method, and the resulting custom header object is returned. Any surrogateescaped bytes get turned into the unicode unknown-character glyph. u nameu ( u hasattru header_factoryu joinu splitlines( u selfu nameu value( ( u1 /opt/alt/python33/lib64/python3.3/email/policy.pyu header_fetch_parsey s u EmailPolicy.header_fetch_parsec C s | j | | d d �S( u + Header folding is controlled by the refold_source policy setting. A value is considered to be a 'source value' if and only if it does not have a 'name' attribute (having a 'name' attribute means it is a header object of some sort). If a source value needs to be refolded according to the policy, it is converted into a custom header object by passing the name and the value with any linesep characters removed to the header_factory method. Folding of a custom header object is done by calling its fold method with the current policy. Source values are split into lines using splitlines. If the value is not to be refolded, the lines are rejoined using the linesep from the policy and returned. The exception is lines containing non-ascii binary data. In that case the value is refolded regardless of the refold_source setting, which causes the binary data to be CTE encoded using the unknown-8bit charset. u refold_binaryT( u _foldu True( u selfu nameu value( ( u1 /opt/alt/python33/lib64/python3.3/email/policy.pyu fold� s u EmailPolicy.foldc C s1 | j | | d | j d k �} | j d d � S( u� + The same as fold if cte_type is 7bit, except that the returned value is bytes. If cte_type is 8bit, non-ASCII binary data is converted back into bytes. Headers with binary data are not refolded, regardless of the refold_header setting, since there is no way to know whether the binary data consists of single byte characters or multibyte characters. u refold_binaryu 7bitu asciiu surrogateescape( u _foldu cte_typeu encode( u selfu nameu valueu folded( ( u1 /opt/alt/python33/lib64/python3.3/email/policy.pyu fold_binary� s !u EmailPolicy.fold_binaryc s t | d � r | j d | � S| j r1 | j n t d � � | j � } | j d k p� | j d k o� | r� t | d � t | � d � k p� t � f d d � | d d � D� � } | s� | r� t | � r� | j | d j | � � j d | � S| d | j j | � | j S( Nu nameu policyu infu allu longi i c 3 s! | ] } t | � � k Vq d S( N( u len( u .0u x( u maxlen( u1 /opt/alt/python33/lib64/python3.3/email/policy.pyu <genexpr>� s u$ EmailPolicy._fold.<locals>.<genexpr>i u u : ( u hasattru foldu max_line_lengthu floatu splitlinesu refold_sourceu lenu anyu _has_surrogatesu header_factoryu joinu linesep( u selfu nameu valueu refold_binaryu linesu refold( ( u maxlenu1 /opt/alt/python33/lib64/python3.3/email/policy.pyu _fold� s *)%u EmailPolicy._foldF( u __name__u __module__u __qualname__u __doc__u refold_sourceu HeaderRegistryu header_factoryu __init__u header_max_countu header_source_parseu header_store_parseu header_fetch_parseu foldu fold_binaryu Falseu _fold( u __locals__( ( u __class__u1 /opt/alt/python33/lib64/python3.3/email/policy.pyu EmailPolicy s ) u raise_on_defectu linesepu u max_line_lengthNT( u __doc__u email._policybaseu Policyu Compat32u compat32u _extend_docstringsu email.utilsu _has_surrogatesu email.headerregistryu HeaderRegistryu __all__u EmailPolicyu defaultu header_factoryu cloneu Trueu strictu SMTPu Noneu HTTP( ( ( u1 /opt/alt/python33/lib64/python3.3/email/policy.pyu <module> s$ " �