e<SrSSKrSSKJr SSKJr SSKJr /SQr"SS5r S r S r "S S \ \RS 9r \ "SS\ 55r\"5rg)zwPolicy framework for the email package. Allows fine grained feature control of how the package parses and emits data. N)header)charset)_has_surrogates)PolicyCompat32compat32cD^\rSrSrSrU4SjrSrSrSrSr Sr U=r $) _PolicyBaseaKPolicy Object basic framework. This class is useless unless subclassed. A subclass should define class attributes with defaults for any values that are to be managed by the Policy object. The constructor will then allow non-default values to be set for these attributes at instance creation time. The instance will be callable, taking these same attributes keyword arguments, and returning a new instance identical to the called instance except for those values changed by the keyword arguments. Instances may be added, yielding new instances with any non-default values from the right hand operand overriding those in the left hand operand. That is, A + B == A() The repr of an instance can be used to reconstruct the object if and only if the repr of the values can be used to reconstruct those values. c >UR5HVup#[X5(a[[U]X#5 M*[ SR X RR55e g)zrCreate new Policy, possibly overriding some defaults. See class docstring for a list of overridable attributes. *{!r} is an invalid keyword argument for {}N) itemshasattrsuperr __setattr__ TypeErrorformat __class____name__)selfkwnamevaluers 7/opt/imh/python3.13/lib/python3.13/email/_policybase.py__init___PolicyBase.__init__)sY 88:KDt""k$3D@@GGnn55788 &cURR5VVs/sHupSRX5PM nnnSRURRSR U55$s snnf)Nz{}={!r}z{}({})z, )__dict__rrrrjoin)rrrargss r__repr___PolicyBase.__repr__7sd$(MM$7$7$9<$9[T!!$.$9 <t~~66 $HH>: ==..0KD   y 6188:KD4&&@GGnn55788   y 6 & rc[X5(aSnOSn[URURRU55e)Nz'{!r} object attribute {!r} is read-onlyz!{!r} object has no attribute {!r})rAttributeErrorrrr)rrrmsgs rr_PolicyBase.__setattr__Ns7 4  ;C5CSZZ(?(?FGGrc:UR"S0URD6$)zyNon-default values from right operand override those from left. The object returned is a new instance of the subclass. )r)r)rothers r__add___PolicyBase.__add__Us zz+ENN++rr0) r __module__ __qualname____firstlineno____doc__rr"r)rr2__static_attributes__ __classcell__)rs@rr r s(* 8I $H,,rr cfURSS5SnURSS5SnUS-U-$)N r)rsplitsplit)doc added_docs r _append_docrA^s; **T1 a Ca(+I : !!rc"UR(aRURRS5(a2[URSRUR5UlURR 5HupUR(dMURRS5(dM:SUR5H<n[ [ X15S5nU(dM![XBR5Ul M M U$)N+rc3R# UHoR5Ho"v M M g7f)N)mro).0basecs r %_extend_docstrings..hsFMD88:aa:aMs%'r7)r7 startswithrA __bases__rrgetattr)clsrr(rHr?s r_extend_docstringsrOcs {{s{{--c22!#--"2":":CKKH ll((*  <<' in front of them. This is used when the message is being serialized by a generator. Default: False. message_factory -- the class to use to create new message objects. If the value is None, the default is Message. verify_generated_headers -- if true, the generator verifies that each header they are properly folded, so that a parser won't treat it as multiple headers, start-of-body, or part of another header. This is a check against custom Header & fold() implementations. Fr;8bitNNTcLUR(aUeURX5 g)aBased on policy, either raise defect or call register_defect. handle_defect(obj, defect) defect should be a Defect subclass, but in any case must be an Exception subclass. obj is the object on which the defect should be registered if it is not raised. If the raise_on_defect is True, the defect is raised as an error, otherwise the object and the defect are passed to register_defect. This method is intended to be called by parsers that discover defects. The email package parsers always call it with Defect instances. N)raise_on_defectregister_defectrobjdefects r handle_defectPolicy.handle_defects    L S)rc:URRU5 g)aRecord 'defect' on 'obj'. Called by handle_defect if raise_on_defect is False. This method is part of the Policy API so that Policy subclasses can implement custom defect handling. The default implementation calls the append method of the defects attribute of obj. The objects used by the email package by default that get passed to this method will always have a defects attribute with an append method. N)defectsappendrWs rrVPolicy.register_defects 6"rcg)aReturn the maximum allowed number of headers named 'name'. Called when a header is added to a Message object. If the returned value is not 0 or None, and there are already a number of headers with the name 'name' equal to the value returned, a ValueError is raised. Because the default behavior of Message's __setitem__ is to append the value to the list of headers, it is easy to create duplicate headers without realizing it. This method allows certain headers to be limited in the number of instances of that header that may be added to a Message programmatically. (The limit is not observed by the parser, which will faithfully produce as many headers as exist in the message being parsed.) The default implementation returns None for all header names. Nr0)rrs rheader_max_countPolicy.header_max_counts"rc[e)a2Given a list of linesep terminated strings constituting the lines of a single header, return the (name, value) tuple that should be stored in the model. The input lines should retain their terminating linesep characters. The lines passed in by the email package may contain surrogateescaped binary data. NotImplementedError)r sourceliness rheader_source_parsePolicy.header_source_parse "!rc[e)zGiven the header name and the value provided by the application program, return the (name, value) that should be stored in the model. rdrrrs rheader_store_parsePolicy.header_store_parses "!rc[e)aOGiven the header name and the value from the model, return the value to be returned to the application program that is requesting that header. The value passed in by the email package may contain surrogateescaped binary data if the lines were parsed by a BytesParser. The returned value should not contain any surrogateescaped data. rdrks rheader_fetch_parsePolicy.header_fetch_parses "!rc[e)anGiven the header name and the value from the model, return a string containing linesep characters that implement the folding of the header according to the policy controls. The value passed in by the email package may contain surrogateescaped binary data if the lines were parsed by a BytesParser. The returned value should not contain any surrogateescaped data. rdrks rfold Policy.folds "!rc[e)aGiven the header name and the value from the model, return binary data containing linesep characters that implement the folding of the header according to the policy controls. The value passed in by the email package may contain surrogateescaped binary data. rdrks r fold_binaryPolicy.fold_binary rirr0)rr4r5r6r7rUlinesepcte_typemax_line_length mangle_from_message_factoryverify_generated_headersrZrVraabcabstractmethodrgrlrorrrur8r0rrrrps5nOGHOLO#*& #& "" ""  ""  " " ""rr) metaclasscF\rSrSrSrSrSrSrSrSr Sr S r S r S r g ) riz}+ This particular policy is the backward compatibility Policy. It replicates the behavior of the email package version 5.1. Tc[U[5(dU$[U5(a$[R"U[ R US9$U$)Nr header_name) isinstancestrrrHeader_charset UNKNOWN8BITrks r_sanitize_headerCompat32._sanitize_header!sF%%%L 5 ! !==0D0D-13 3LrcUSRSS5up#SRU/USSQ75RS5nX#RS54$)a + 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 joined with all subsequent lines, and stripping any trailing carriage return or linefeed characters. r:r<Nz z )r>r lstriprstrip)rrfrrs rrgCompat32.header_source_parse-sU"!n**32 1QR1299)Dll6*++rcX4$)z.+ The name and value are returned unmodified. r0rks rrlCompat32.header_store_parse9s }rc$URX5$)z+ If the value contains binary data, it is converted into a Header object using the unknown-8bit charset. Otherwise it is returned unmodified. )rrks rroCompat32.header_fetch_parse?s $$T11rc"URXSS9$)z+ Headers are folded using the Header folding algorithm, which preserves existing line breaks in the value, and wraps each resulting line to the max_line_length. Non-ASCII binary data are CTE encoded using the unknown-8bit charset. Tsanitize)_foldrks rrr Compat32.foldFszz$z55rc`URXURS:HS9nURSS5$)a_+ Headers are folded using the Header folding algorithm, which preserves existing line breaks in the value, and wraps each resulting line to the max_line_length. If cte_type is 7bit, non-ascii binary data is CTE encoded using the unknown-8bit charset. Otherwise the original source header is used, with its existing line breaks and/or binary data. 7bitrasciisurrogateescape)rrxencode)rrrfoldeds rruCompat32.fold_binaryPs1D$--2GH}}W&788rc /nURSU-5 [U[5(ae[U5(a@U(a%[R "U[ RUS9nO+URU5 SnO[R "X!S9nOUnUbDSnURb URnURURURUS95 URUR5 SRU5$)Nz%s: r)rr)rw maxlinelenr) r^rrrrrrrryrrwr )rrrrpartshrs rrCompat32._fold\s Vd]# eS ! !u%% e.6.B.B268ALL'AMM%:A =J##/!11 LL$,,:N O T\\"wwu~rr0N)rr4r5r6r7rzrrgrlrorrrurr8r0rrrrs1 L  , 26 9rr)r7r}emailrrr email.utilsr__all__r rArOABCMetarrrr0rrrss  %' I,I,X" d"[CKKd"NcvccL :r