3 \:@sddlZddlmZddlmZddlmZdddgZGdd d Zd d Z d d Z Gdddeej dZ e Gddde Z e ZdS)N)header)charset)_has_surrogatesPolicyCompat32compat32cs<eZdZfddZddZddZddZd d ZZS) _PolicyBasec sLxF|jD]:\}}t||r0tt|j||q tdj||jjq WdS)Nz*{!r} is an invalid keyword argument for {}) itemshasattrsuperr __setattr__ TypeErrorformat __class____name__)selfkwnamevalue)r)/usr/lib64/python3.6/email/_policybase.py__init__)s  z_PolicyBase.__init__cCs*dd|jjD}dj|jjdj|S)NcSsg|]\}}dj||qS)z{}={!r})r).0rrrrr 8sz(_PolicyBase.__repr__..z{}({})z, )__dict__r rrrjoin)rargsrrr__repr__7sz_PolicyBase.__repr__cKsz|jj|j}x$|jjD]\}}tj|||qWx@|jD]4\}}t||sdtdj||jj tj|||q>W|S)Nz*{!r} is an invalid keyword argument for {}) r__new__rr objectr r r rr)rrZ newpolicyattrrrrrclone<s z_PolicyBase.clonecCs,t||rd}nd}t|j|jj|dS)Nz'{!r} object attribute {!r} is read-onlyz!{!r} object has no attribute {!r})r AttributeErrorrrr)rrrmsgrrrr Ns z_PolicyBase.__setattr__cCs|jf|jS)N)r!r)rotherrrr__add__Usz_PolicyBase.__add__) r __module__ __qualname__rrr!r r% __classcell__rr)rrrs  rcCs,|jddd}|jddd}|d|S)N r)rsplitsplit)docZ added_docrrr _append_doc^sr.cCs|jr(|jjdr(t|jdj|j|_xf|jjD]X\}}|jr4|jjdr4xhsz%_extend_docstrings..__doc__)r4 startswithr. __bases__rr getattr)clsrr r2r-rrr_extend_docstringscs r9c@seZdZdZdZdZdZdZdZddZ dd Z d d Z e j d d Ze j ddZe j ddZe j ddZe j ddZdS)rFr)Z8bitNNcCs|jr ||j||dS)N)raise_on_defectregister_defect)robjdefectrrr handle_defectszPolicy.handle_defectcCs|jj|dS)N)Zdefectsappend)rr=r>rrrr<s zPolicy.register_defectcCsdS)Nr)rrrrrheader_max_countszPolicy.header_max_countcCstdS)N)NotImplementedError)r sourcelinesrrrheader_source_parseszPolicy.header_source_parsecCstdS)N)rB)rrrrrrheader_store_parseszPolicy.header_store_parsecCstdS)N)rB)rrrrrrheader_fetch_parses zPolicy.header_fetch_parsecCstdS)N)rB)rrrrrrfolds z Policy.foldcCstdS)N)rB)rrrrrr fold_binaryszPolicy.fold_binary)rr&r'r;linesepcte_typemax_line_length mangle_from_Zmessage_factoryr?r<rAabcabstractmethodrDrErFrGrHrrrrrps2    ) metaclassc@sHeZdZdZddZddZddZdd Zd d Zd d Z ddZ dS)rTcCs0t|ts|St|r(tj|tj|dS|SdS)N)r header_name) isinstancestrrrHeader_charset UNKNOWN8BIT)rrrrrr_sanitize_headers   zCompat32._sanitize_headercCs>|djdd\}}|jddj|dd}||jdfS)Nr:r*z z )r,lstriprrstrip)rrCrrrrrrD%szCompat32.header_source_parsecCs||fS)Nr)rrrrrrrE1szCompat32.header_store_parsecCs |j||S)N)rV)rrrrrrrF7szCompat32.header_fetch_parsecCs|j||ddS)NT)sanitize)_fold)rrrrrrrG>sz Compat32.foldcCs"|j|||jdkd}|jddS)NZ7bit)r[asciisurrogateescape)r\rJencode)rrrZfoldedrrrrHHs zCompat32.fold_binarycCsg}|jd|t|tr\t|rL|rs   L  f