L i ddlmZmZmZmZmZmZmZmZgdZ Gdde Z Gdde Z Gdde Z dd eed ed ed ed eeeff dZeddZGddeZdeeeeeefd efdZy))AnyDictNoReturnPatternTupleTypeTypeVarUnion) ProtocolErrorLocalProtocolErrorRemoteProtocolErrorvalidatebytesifyc&eZdZdZddededdfdZy)r aMException indicating a violation of the HTTP/1.1 protocol. This as an abstract base class, with two concrete base classes: :exc:`LocalProtocolError`, which indicates that you tried to do something that HTTP/1.1 says is illegal, and :exc:`RemoteProtocolError`, which indicates that the remote peer tried to do something that HTTP/1.1 says is illegal. See :ref:`error-handling` for details. In addition to the normal :exc:`Exception` features, it has one attribute: .. attribute:: error_status_hint This gives a suggestion as to what status code a server might use if this error occurred as part of a request. For a :exc:`RemoteProtocolError`, this is useful as a suggestion for how you might want to respond to a misbehaving peer, if you're implementing a server. For a :exc:`LocalProtocolError`, this can be taken as a suggestion for how your peer might have responded to *you* if h11 had allowed you to continue. The default is 400 Bad Request, a generic catch-all for protocol violations. msgerror_status_hintreturnNcvt|tur tdtj ||||_y)Nz+tried to directly instantiate ProtocolError)typer TypeError Exception__init__r)selfrrs O/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/h11/_util.pyrzProtocolError.__init__)s2 : &IJ J4%!2)i)__name__ __module__ __qualname____doc__strintrrrr r s!83C3C3$3rr ceZdZdefdZy)r rct|_|N)r __class__rs r!_reraise_as_remote_protocol_errorz4LocalProtocolError._reraise_as_remote_protocol_error<s- rN)rrrrr(r"rrr r ;s8rr c eZdZy)r N)rrrr"rrr r Psrr regexdatar format_argsrc|j|}|s|r|j|}t||jSr%) fullmatchformatr groupdict)r*r+rr,matchs rrrTs@ OOD !E  #**k*C %% ?? r _T_SentinelSentinel)boundc ^eZdZdeededeedfdeee fde def fd Z defd Z xZ S) r3clsnamebases. namespacekwdsrc T|tfk(sJt|||||fi|}||_|Sr%)r3super__new__r&)r6r7r8r9r:vr&s rr=zSentinel.__new__ls: ### GOCui @4 @ rc|jSr%)rr's r__repr__zSentinel.__repr__xs }}r) rrrrr2r rrrrr=r@ __classcell__)r&s@rr3r3ksb  +   T3Y S>     #rsct|tur|St|tr|j d}t|t r t dt|S)Nasciiz#expected bytes-like object, not int)rbytes isinstancer encoder!r)rBs rrrsJ Aw%!S HHW !S=>> 8OrN)zmalformed data)typingrrrrrrr r __all__rr r r rEr rr2rr3 bytearray memoryviewr!rr"rrrLsLLL !3I!3^* - 4D 5>!&-0SV #u*(m:6 t(eY C<=%r