+
     Ii  c                   s   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHtHtHt RtR	tR
t]P6                  ! R4      tRtRt]]3tR]3R lt  ! R R4      t! ! R R]!4      t" ! R R]"4      t# ! R R]!4      t$ ! R R]!4      t% ! R R]!4      t& ! R R]!4      t' ! R R]&]$4      t( ! R  R!]&4      t) ! R" R#]']%4      t*R$]#R%]"R&]$R'](R(])R)]*/t+R# )*a  Protocol input serializes.

This module contains classes that implement input serialization
for the various AWS protocol types.

These classes essentially take user input, a model object that
represents what the expected input should look like, and it returns
a dictionary that contains the various parts of a request.  A few
high level design decisions:


* Each protocol type maps to a separate class, all inherit from
  ``Serializer``.
* The return value for ``serialize_to_request`` (the main entry
  point) returns a dictionary that represents a request.  This
  will have keys like ``url_path``, ``query_string``, etc.  This
  is done so that it's a) easy to test and b) not tied to a
  particular HTTP library.  See the ``serialize_to_request`` docstring
  for more details.

Unicode
-------

The input to the serializers should be text (str/unicode), not bytes,
with the exception of blob types.  Those are assumed to be binary,
and if a str/unicode type is passed in, it will be encoded as utf-8.
N)ElementTree)validate)
formatdate)ParamValidationError)register_feature_id)
has_headeris_json_value_headerparse_to_aware_datetimepercent_encodeiso8601z%Y-%m-%dT%H:%M:%SZz%Y-%m-%dT%H:%M:%S.%fZz^[A-Za-z0-9\.\-]+$ZdefaultZmillisecondTc                s    \         V ,          ! VR7      pV'       d,   \        P                  ! 4       p\        P                  ! WC4      pV# )a  Create a serializer for the given protocol.
:param protocol_name: The protocol name to create a serializer for.
:type protocol_name: str
:param include_validation: Whether to include parameter validation.
:type include_validation: bool
:param timestamp_precision: Timestamp precision level.
    - 'default': Microseconds for ISO timestamps, seconds for Unix and RFC
    - 'millisecond': Millisecond precision (ISO/Unix), seconds for RFC
:type timestamp_precision: str
:return: A serializer instance for the given protocol.
)timestamp_precision)SERIALIZERSr   ZParamValidatorZParamValidationDecorator)Zprotocol_nameZinclude_validationr
   Z
serializerZ	validator   &&&  7/usr/lib/python3.14/site-packages/botocore/serialize.pycreate_serializerr   M   s?    " ]+/J ++-	66yM
    c                   s   a  ] tR t^gt o Rt]tRt]3R lt	R t
R tR tR tR tRR
 ltR tR tR tR tR tR tRtV tR	# )
SerializerZPOSTutf-8c                sD    V\         9  d   \        R V 24      hWn        R# )z=Invalid timestamp precision found while creating serializer: N)TIMESTAMP_PRECISION_OPTIONS
ValueError_timestamp_precision)selfr
      &&r   __init__ZSerializer.__init__p   s,    &AAOPcOde  %8!r   c                s    \        R4      h)a  Serialize parameters into an HTTP request.

This method takes user provided parameters and a shape
model and serializes the parameters to an HTTP request.
More specifically, this method returns information about
parts of the HTTP request, it does not enforce a particular
interface or standard for an HTTP request.  It instead returns
a dictionary of:

    * 'url_path'
    * 'host_prefix'
    * 'query_string'
    * 'headers'
    * 'body'
    * 'method'

It is then up to consumers to decide how to map this to a Request
object of their HTTP library of choice.  Below is an example
return value::

    {'body': {'Action': 'OperationName',
              'Bar': 'val2',
              'Foo': 'val1',
              'Version': '2014-01-01'},
     'headers': {},
     'method': 'POST',
     'query_string': '',
     'host_prefix': 'value.',
     'url_path': '/'}

:param parameters: The dictionary input parameters for the
    operation (i.e the user input).
:param operation_model: The OperationModel object that describes
    the operation.
serialize_to_requestZNotImplementedError)r   
parametersoperation_model   &&&r   r   ZSerializer.serialize_to_requestw   s    H ""899r   c           
     s2    R RRRRV P                   R/ RR/pV# )url_pathZ/query_string methodheadersbodyr   )DEFAULT_METHOD)r   
serializeds   & r   _create_default_requestZ"Serializer._create_default_request   s2     Bd))rC

 r   c                s    V P                   \        8X  d1   VP                  R,          pVP                  R4      RVR R2,           # VP                  ^ 8  d   \        pM\
        pVP                  V4      # )zEReturn ISO8601 timestamp with precision based on timestamp_precision.  z%Y-%m-%dT%H:%M:%S.Z03dZZ)r   TIMESTAMP_PRECISION_MILLISECONDmicrosecondZstrftimeISO8601_MICROISO8601)r   valuemillisecondstimestamp_format   &&  r   _timestamp_iso8601ZSerializer._timestamp_iso8601   sr     $$(GG ,,4L23,s9K16MM
   1$#0 #* >>"233r   c                s   V P                   \        8X  dG   \        P                  ! VP	                  4       4      pVP
                  R,          R,          pW#,           # \        \        P                  ! VP	                  4       4      4      # )zBReturn unix timestamp with precision based on timestamp_precision.r&   g     @@)r   r(   calendartimegm	timetupler)   int)r   r,   Zbase_timestampr-   r/   r   _timestamp_unixtimestampZ#Serializer._timestamp_unixtimestamp   sa     $$(GG%__U__->?N!--5?L!00xu'89::r   c                s    \        V\        P                  4      '       d.   \        \        P                  ! VP                  4       4      4      p\        VRR7      # )zSReturn RFC822 timestamp (always second precision - RFC doesn't support sub-second).T)Zusegmt)
isinstancedatetimer4   r1   r2   r3   r   r   r,   r   r   _timestamp_rfc822ZSerializer._timestamp_rfc822   s>     eX..//(9:;E%--r   Nc                s    Vf   V P                   pVP                  4       p\        V4      p\        V RV 24      pV! V4      pV# )NZ_timestamp_)TIMESTAMP_FORMATlowerr   getattr)r   r,   r.   datetime_objZ	converterZfinal_value   &&&   r   _convert_timestamp_to_strZ$Serializer._convert_timestamp_to_str   sR    ##44+113.u5DK0@/A"BC	-r   c                s:    VP                   P                  R V4      # )nameserializationget)r   shapedefault_namer   r   _get_serialized_nameZSerializer._get_serialized_name   s     ""&&v|<<r   c                s    \        V\        4      '       d   VP                  V P                  4      p\        P
                  ! V4      P                  4       P                  V P                  4      # N)r6   strencodeDEFAULT_ENCODINGbase64Z	b64encodeZstripZdecoder8   r   r   _get_base64ZSerializer._get_base64   sP     eS!!LL!6!67E&,,.55d6K6KLLr   c                s&   VP                   pVe   RV9  d   R # VR,          pVP                  f   V# VP                  P                  pVP                  4        UUu. uF*  w  rgVP                  P                  R4      '       g   K(  VNK,  	  ppp/ p	. p
V F;  pW,          p\        P                  V4      '       g   V
P                  V4       WV&   K=  	  V
'       d    \        RRP                  V
4       R2R7      hVP                  ! R/ V	B # u uppi )NZ
hostPrefixZ	hostLabelz Invalid value for parameter(s): z, z?. Must contain only alphanumeric characters, hyphen, or period.)Zreport )Zendpointinput_shapemembersitemsrB   rC   HOST_PREFIX_REZmatchappendr   joinformat)r   r   r   Zoperation_endpointZhost_prefix_expressionZinput_membersmemberrD   Zhost_labelsZformat_kwargsZ
bad_labelsr@   Zparams   &&&          r   _expand_host_prefixZSerializer._expand_host_prefix   s   ,55&#55!3L!A&&.))'33;; "/!4!4!6
!6""&&{3 F!6 	 

 
D$E!''..!!$'"'$	  
 &6tyy7L6M N! !  &,,=}==)
s   %DDc                s8    VP                   P                  R 4      # )	flattenedrA   r   rD   r   r   _is_shape_flattenedZSerializer._is_shape_flattened  s    ""&&{33r   c                s    V\        R 4      8X  d   R pV# V\        R4      8X  d   RpV# \        P                  ! V4      '       d   RpV# )ZInfinityz	-InfinityZNaN)floatmathisnanr8   r   r   _handle_floatZSerializer._handle_float  sQ    E*%%E
 	 eK((E  ZZEr   c                sZ    VP                   P                  '       d   R VR,          R&   R# R# )truer!   zx-amzn-query-modeN)service_modelZis_query_compatible)r   r   r$   r   r   _handle_query_compatible_traitZ)Serializer._handle_query_compatible_trait  s)    ((<<<9?Jy!"56 =r   )r   rG   )__name__
__module____qualname____firstlineno__r#   dictMAP_TYPErJ   TIMESTAMP_PRECISION_DEFAULTr   r   r%   r0   r5   r9   r?   rF   rL   rV   rY   r]   r`   __static_attributes____classdictcell____classdict__   @r   r   r   g   se     N
 H+F 8$:L4 ;.=
M >D4@ @r   r   c                   s   a  ] tR tRt o RtR tRR ltRR ltRR ltRR lt	RR lt
RR	 ltRR
 ltRR ltRR ltRR ltRtV tR# )QuerySerializeri  r	   c                sn   VP                   pV P                  4       pVP                  P                  R V P                  4      VR &   RR/VR&   V P                  4       pVP                  VR&   VP                  R,          VR&   Ve   V P                  WQV4       WTR&   V P                  W4      pVe   WdR&   V# )	r    Content-Typez0application/x-www-form-urlencoded; charset=utf-8r!   ZActionZ
apiVersionZVersionr"   host_prefix)
rN   r%   httprC   r#   rf   r@   metadata
_serializerV   )r   r   r   rD   r$   body_paramsro   s   &&&    r   r   Z$QuerySerializer.serialize_to_request  s    ++113
.3377d)) 

8 N!

9
 mmo / 4 4H!0!9!9,!GIOOKU;(6..zK"(3}%r   c                sb    \        V R VP                   2V P                  4      pV! WW4R7       R# )_serialize_type_)prefixNr<   	type_name_default_serialize)r   r$   r,   rD   ru   r       &&&&& r   rr   ZQuerySerializer._serialize1  s5     u/0##

 	z%7r   c                s    VP                   pVP                  4        F?  w  rbWV,          pV P                  Wv4      pV'       d   V R V 2pV P                  WWx4       KA  	  R# )r'   N)rO   rP   rF   rr   )	r   r$   r,   rD   ru   rO   keymember_shapeZmember_prefix	   &&&&&    r   _serialize_type_structureZ)QuerySerializer._serialize_type_structure@  sU    --++-JC"<L 55lHM#)(!M? ;OOJ|K (r   c                s
   V'       g   R W&   R# V P                  V4      '       dw   TpVP                  P                  P                  R4      '       dI   V P	                  VP                  R R7      pRP                  VP                  R4      RR V.,           4      pM-VP                  P                  P                  RR4      pV RV 2p\        V^4       F*  w  rV RV 2p
VP                  pV P                  WW4       K,  	  R# )r   Nr@   rE   r'   rU   )	rY   rU   rB   rC   rF   rS   Zsplit	enumeraterr   )r   r$   r,   rD   ru   Zlist_prefixr@   Z	list_nameielementelement_prefixelement_shapes   &&&&&       r   _serialize_type_listZ$QuerySerializer._serialize_type_listI  s    !#J##E** K||))--f5500B0O!hhv||C'8"'='FG2266vxHI#HAi[1K#E1-JA +}AaS1N!LLMOOJO .r   c                s   V P                  V4      '       d   TpMV R 2pVR,           pVP                  pVP                  pV P                  VRR7      p	V P                  VR4      p
\	        V^4       FT  w  rVP                  WR7      pVP                  WR7      pV P                  WW}4       V P                  WV,          W4       KV  	  R# )z.entryz.{i}.{suffix}rz   r~   r,   )r   ZsuffixN)rY   rz   r,   rF   r   rT   rr   )r   r$   r,   rD   ru   Zfull_prefixZtemplate	key_shapeZvalue_shapeZ
key_suffixZvalue_suffixr   rz   Z
key_prefixZvalue_prefix   &&&&&          r   _serialize_type_mapZ#QuerySerializer._serialize_type_map\  s    ##E** K#HF+K0II	kk..yu.M
00gFq)FA!1@J#??Q?DLOOJYCOOJc
KN	 *r   c                ,    V P                  V4      W&   R # rG   rL   r   r$   r,   rD   ru      &&&&&r   _serialize_type_blobZ$QuerySerializer._serialize_type_blobl  s    !--e4
r   c                ^    V P                  W#P                  P                  R 4      4      W&   R# timestampFormatNr?   rB   rC   r   r   r   _serialize_type_timestampZ)QuerySerializer._serialize_type_timestampp  s*    !;;&&**+<=

r   c                s*    V'       d   R W&   R# RW&   R# r^   ZfalseNrM   r   r   r   _serialize_type_booleanZ'QuerySerializer._serialize_type_booleanu  s    !'J!(Jr   c                    W!V&   R # rG   rM   r   r   r   rx   Z"QuerySerializer._default_serialize{  s
    "6r   c                r   rG   )r]   r   r   r   _serialize_type_floatZ%QuerySerializer._serialize_type_float~  s    !//6
r   c                *    V P                  WW44       R # rG   r   r   r   r   _serialize_type_doubleZ&QuerySerializer._serialize_type_double      "":eDr   rM   Nr   )ra   rb   rc   rd   r:   r   rr   r}   r   r   r   r   r   rx   r   r   rh   ri   rj   rl   r   rm   rm     sL      08LP&O 5

)#7E Er   rm   c                   s4   a  ] tR tRt o RtR tRR ltRtV tR# )EC2Serializeri  aA  EC2 specific customizations to the query protocol serializers.

The EC2 model is almost, but not exactly, similar to the query protocol
serializer.  This class encapsulates those differences.  The model
will have be marked with a ``protocol`` of ``ec2``, so you don't need
to worry about wiring this class up correctly.

c                s    R VP                   9   d   VP                   R ,          # RVP                   9   d9   VP                   R,          pV^ ,          P                  4       VR,          ,           # V# )Z	queryNamer@   :   NN)rB   Zupper)r   rD   rE   r@      &&& r   rF   Z"EC2Serializer._get_serialized_name  sb     %---&&{33u*** &&v.D7==?T"X--r   c                sz    \        V^4       F*  w  rVV RV 2pVP                  pV P                  WW4       K,  	  R# )r   r'   N)r   rU   rr   )	r   r$   r,   rD   ru   r   r   r   r   r|   r   r   Z"EC2Serializer._serialize_type_list  s;    #E1-JA &xq_N!LLMOOJO .r   rM   Nr   )	ra   rb   rc   rd   __doc__rF   r   rh   ri   rj   rl   r   r   r     s      P Pr   r   c                   sl   a  ] tR tRt o RtR tRR ltR tR tR t	R	 t
R
 tR tRR ltRR ltRtV tR# )JSONSerializeri  unixtimestampc                s,   R P                  VP                  R,          VP                  4      pVP                  R,          pV P                  4       pVP                  P                  RV P                  4      VR&   RVRRV 2/VR&   V P                  W%4       V P                  4       pVP                  pVe   V P                  WaV4       \        P                  ! V4      P                  V P                  4      VR&   V P                  W4      pVe   WR	&   V# )
z{}.{}targetPrefixZjsonVersionr    zX-Amz-Targetrn   zapplication/x-amz-json-r!   r"   ro   )rT   rq   r@   r%   rp   rC   r#   r`   rf   rN   rr   jsondumpsrI   rJ   rV   )	r   r   r   ZtargetZjson_versionr$   r"   rN   ro   s	   &&&      r   r   Z#JSONSerializer.serialize_to_request  s   $$^4  
 '//>113
.3377d)) 

8 F5l^D!

9 	++OH}}%11"OODk:!ZZ-44T5J5JK
6..zK"(3}%r   Nc                s`    \        V R VP                   2V P                  4      pV! WW44       R# rt   Nrv   r   r$   r,   rD   rz   r    ry   r   rr   ZJSONSerializer._serialize  s3    u/0##

 	z%-r   c                s0   VP                   '       d   W!V&   R # Ve   V P                  4       pWQV&   TpVP                  pVP                  4        FC  w  rxWg,          p	RV	P                  9   d   V	P                  R,          pV P                  WW4       KE  	  R # )Nr@   )Zis_document_typerf   rO   rP   rB   rr   )
r   r$   r,   rD   rz   Znew_serializedrO   
member_keymember_valuer{   
   &&&&&     r   r}   Z(JSONSerializer._serialize_type_structure  s    !!!#sO "&"03+
mmG,1KKM(
&2\777!-!;!;F!CJl	 -:r   c                s    V P                  4       pWQV&   VP                  4        F"  w  rgV P                  WWVP                  V4       K$  	  R # rG   )rf   rP   rr   r,   )r   r$   r,   rD   rz   Zmap_objZsub_keyZ	sub_value   &&&&&   r   r   Z"JSONSerializer._serialize_type_map  s;    --/!3"'++-GOOGWE #0r   c                s    . pWQV&   V F:  p/ pV P                  WvVP                  R 4       VP                  VR ,          4       K<  	  R# )Z__current__N)rr   rU   rR   )r   r$   r,   rD   rz   Zlist_objZ	list_itemZwrapperr   r   r   Z#JSONSerializer._serialize_type_list  sD    "3IG
 OOGmLOOGM23 r   c                r   rG   rM   r   r$   r,   rD   rz   r   r   rx   Z!JSONSerializer._default_serialize  s	    3r   c                r   r   r   r   r   r   r   Z(JSONSerializer._serialize_type_timestamp  s)    88&&**+<=

r   c                r   rG   r   r   r   r   r   Z#JSONSerializer._serialize_type_blob  s    **51
r   c                s    \        V\        P                  4      '       d   \        V4      pV P	                  V4      W&   R # rG   )r6   decimalZDecimalrZ   r]   r   r   r   r   Z$JSONSerializer._serialize_type_float  s/    eW__--%LE!//6
r   c                r   rG   r   r   r   r   r   Z%JSONSerializer._serialize_type_double  r   r   rM   rG   r   )ra   rb   rc   rd   r:   r   rr   r}   r   r   rx   r   r   r   r   rh   ri   rj   rl   r   r   r     sE     &8.,F
4 

27
E Er   r   c                   s   a  ] tR tRt o ^ t^t^t^t^t^t	^t
^tRR ltR tR tR tR tR tR	 tR
 tR tR tR tR tR tR tR tR tRtV tR# )CBORSerializeri  Nc                s    \        V R VP                   24      pVf   \        RVP                   R24      hV! WW44       R# )rt   NzUnrecognized C2J type: z, unable to serialize request)r<   rw   r   r   ry   r   _serialize_data_itemZ#CBORSerializer._serialize_data_item  sO    !1%//1BCD>)%//): ;$ %  	z%-r   c                s"   V^ 8  d   V P                   pMV P                  pRV,
          pV P                  V4      w  rgV P                  WV4      pV^ 8X  d   VP	                  V4       R# VP	                  WP                  VR4      ,           4       R# )    bigNr   )UNSIGNED_INT_MAJOR_TYPENEGATIVE_INT_MAJOR_TYPE"_get_additional_info_and_num_bytes_get_initial_byteextendto_bytes)	r   r$   r,   rD   rz   
major_typeadditional_info	num_bytesinitial_byter|   r   _serialize_type_integerZ&CBORSerializer._serialize_type_integer  s    A:55J55J JE%)%L%L&
" --jJ>l+l^^Iu-MMNr   c                r   rG   )r   r   r   r   _serialize_type_longZ#CBORSerializer._serialize_type_long+  s    $$ZCr   c                s   \        V\        4      '       d   VP                  R 4      pM,\        V\        \        34      '       g   VP                  4       p\        V4      pV P                  V4      w  rgV P                  V P                  V4      pV^ 8X  d   VP                  V4       M'VP                  WP                  VR4      ,           4       VP                  V4       R# r   r   N)r6   rH   rI   bytes	bytearrayZreadlenr   r   BLOB_MAJOR_TYPEr   r   )	r   r$   r,   rD   rz   lengthr   r   r   r|   r   r   Z#CBORSerializer._serialize_type_blob.  s    eS!!LL)EEE9#566 JJLEU%)%L%L&
" --  /
 >l+l__Y-NNO% r   c                s8   VP                  R 4      p\        V4      pV P                  V4      w  rxV P                  V P                  V4      p	V^ 8X  d   VP                  W,           4       R# VP                  WP                  VR4      ,           V,           4       R# r   )rI   r   r   r   STRING_MAJOR_TYPEr   r   )
r   r$   r,   rD   rz   Zencodedr   r   r   r   r   r   _serialize_type_stringZ%CBORSerializer._serialize_type_stringB  s    ,,w'W%)%L%L&
" --""O
 >l45y%@@7Jr   c                sD   \        V4      pV P                  V4      w  rgV P                  V P                  V4      pV^ 8X  d   VP	                  V4       M'VP	                  WP                  VR4      ,           4       V F  p	V P                  WVP                  4       K!  	  R# r   r   N)r   r   r   LIST_MAJOR_TYPEr   r   r   rU   )
r   r$   r,   rD   rz   r   r   r   r   itemr   r   r   Z#CBORSerializer._serialize_type_listR  s    U%)%L%L&
" --  /
 >l+l__Y-NNOD%%jE r   c                s   \        V4      pV P                  V4      w  rgV P                  V P                  V4      pV^ 8X  d   VP	                  V4       M'VP	                  WP                  VR4      ,           4       VP                  4        F=  w  rV P                  WVP                  4       V P                  WVP                  4       K?  	  R# r   )
r   r   r   MAP_MAJOR_TYPEr   r   rP   r   rz   r,   )r   r$   r,   rD   rz   r   r   r   r   Zkey_itemr      &&&&&      r   r   Z"CBORSerializer._serialize_type_mapa  s    U%)%L%L&
" --
 >l+l__Y-NNO#kkmNH%%jEIIF%%jD ,r   c                s   Ve   V P                  WVP                  4       VP                  4        UUu/ uF  w  rVVf   K  WVbK  	  ppp\        V4      pV P	                  V4      w  rV P                  V P                  V4      p
V	^ 8X  d   VP                  V
4       M'VP                  WP                  V	R4      ,           4       VP                  pVP                  4        F\  w  rW,          pRVP                  9   d   VP                  R,          pVf   K7  V P                  WR R 4       V P                  WV4       K^  	  R # u uppi )Nr   r@   )r   r   rP   r   r   r   r   r   r   rO   rB   r   )r   r$   r,   rD   rz   ZkvZ
map_lengthr   r   r   rO   r   r   r{   r   r   r}   Z(CBORSerializer._serialize_type_structureq  s(   ?%%juG #(++-A-$!1-AZ
%)%L%L&
" --
 >l+229eDD --(-$J".L333)77?
'++JD$O))l )6# Bs   EEc                s   V P                  V4      p^pV P                  V P                  V4      pVP                  V4       V P	                  V4      w  rV	^ 8X  d0   V P                  V P
                  V4      pVP                  V4       R# V P                  V P
                  V4      pVP                  WuP                  V	R4      ,           4       R# )r   r   N)r?   r   TAG_MAJOR_TYPEr   r   r   r   )
r   r$   r,   rD   rz   	timestampZtagr   r   r   r   r   r   Z(CBORSerializer._serialize_type_timestamp  s    2259	--d.A.A3G,'%)%L%L&
" >11,,iL l+11,,oL 11)UCCr   c                s
   V P                  V4      '       d#   VP                  V P                  V4      4       R# V P                  V P                  ^4      pVP                  V\
        P                  ! RV4      ,           4       R# )   z>fN_is_special_numberr   _get_bytes_for_special_numbersr   FLOAT_AND_SIMPLE_MAJOR_TYPEstructpackr   r$   r,   rD   rz   r   ry   r   r   Z$CBORSerializer._serialize_type_float  l    ""5))33E:  1100"L lV[[u-EEFr   c                s
   V P                  V4      '       d#   VP                  V P                  V4      4       R# V P                  V P                  ^4      pVP                  V\
        P                  ! RV4      ,           4       R# )   z>dNr   r   ry   r   r   Z%CBORSerializer._serialize_type_double  r   r   c                st    V'       d   ^M^pVP                  V P                  V P                  V4      4       R# )i   N)r   r   r   )r   r$   r,   rD   rz   r   ry   r   r   Z&CBORSerializer._serialize_type_boolean  s2     %"2""00/	
r   c                sR    V^8  d   V^ 3# VR8  d   R# VR8  d   R# VR8  d   R# R# )   i   i   l        )r   r   )   i   )r   i   )r   i   rM   r8   r   r   r   Z1CBORSerializer._get_additional_info_and_num_bytes  sF     2:!8O S[L U]L ZL Lr   c                sD    V^,          pW2,          P                  ^R4      # )i   r   )r   )r   r   r   Zmajor_type_bytesr   r   r   Z CBORSerializer._get_initial_byte  s$     &? 2<<QFFr   c                sv    \        V\        R 4      8H  V\        R4      8H  \        P                  ! V4      .4      # )inf-inf)ZanyrZ   r[   r\   r8   r   r   r   Z!CBORSerializer._is_special_number  s8    u%v&

5!
 	
r   c                sn   ^pV P                  V P                  V4      pV\        R4      8X  d   V\        P                  ! RR4      ,           # V\        R4      8X  d   V\        P                  ! RR4      ,           # \
        P                  ! V4      '       d   V\        P                  ! RR4      ,           # R# )r   r   z>Hi |  r   i   i ~  N)r   r   rZ   r   r   r[   r\   )r   r,   r   r   r/   r   r   Z-CBORSerializer._get_bytes_for_special_numbers  s    --,,o
 E%L &++dF";;;eFm#&++dF";;;ZZ&++dF";;; r   rM   rG   )ra   rb   rc   rd   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r}   r   r   r   r   r   r   r   r   rh   ri   rj   rl   r   r   r     s     OONN"#.O$D!( FE B,	G	G
,G

< 
<r   r   c                   s   a  ] tR tRt o RtRtRt. ROtR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tRtV tR# )BaseRestSerializeri  a)  Base class for rest protocols.

The only variance between the various rest protocols is the
way that the body is serialized.  All other aspects (headers, uri, etc.)
are the same and logic for serializing those aspects lives here.

Subclasses must implement the ``_serialize_body_params`` method.

r	   Zrfc822c           	     sf   V P                  4       pVP                  P                  R V P                  4      VR &   VP                  pV P                  W4      pVe   WSR&   Vf   VP                  R,          VR&   V# VP                  pRV P                  4       RV P                  4       RV P                  4       RV P                  4       /pVP                  4        F  w  rV	f   K  V P                  WxW4       K  	  V P                  VP                  R,          VR,          4      VR&   RVP                  9   d.   V P                  VP                  R,          VR,          4      VR	&   VR,          VR
&   VR,          '       d   VR,          VR&   V P                  WqW4V4       V P                  W4V4       V# )r    ro   Z
requestUrir   uri_path_kwargsquery_string_kwargsbody_kwargsr!   ZauthPathZ	auth_pathr   )r%   rp   rC   r#   rN   rV   rO   rf   rP   _partition_parameters_render_uri_template_serialize_payload_serialize_content_type)
r   r   r   r$   rD   ro   shape_memberspartitioned
param_nameparam_values
   &&&       r   r   Z'BaseRestSerializer.serialize_to_request
  s   113
.3377d)) 

8  ++..zK"(3}%=%4%9%9,%GJz" t}}!4==?4==?t}}	
 (2'7'7'9#J"&&	 (: "&!:!:  .<M0N"

: ---&*&?&?$$Z0-.'J{# &11F%G
>"y!!$/	$:Jy!Z	
 	$$ZFr   c                s    / p\         P                  ! R V4       FG  pVP                  R4      '       d   \        W$RR ,          RR7      W4&   K4  \        W$,          4      W4&   KI  	  VP                  ! R/ VB # )z{(.*?)}Z+Nz/~)Zsafer   rM   )reZfindallZendswithr   rT   )r   Zuri_templateparamsZencoded_paramsZtemplate_paramr   r   r   Z'BaseRestSerializer._render_uri_templateF  sx      jj\BN&&s++1?#2./d2. 2@*2. C ""4^44r   c                s   VP                   P                  R 4      pV P                  We4      '       d*   VP                  VR4      pV P                  V4      pWsR&   R# VeH   VP                  V4      pVe   V P	                  WV,          4      VR&   R# V P                  4       VR&   R# VR,          '       d   V P	                  VR,          V4      VR&   R# V P                  V4      '       d   V P                  4       VR&   R# R# )payloadr   r"   Nr   )rB   rC   _has_streaming_payload_encode_payload_serialize_body_params_serialize_empty_body_requires_empty_body)	r   r   r   r$   rD   r   Zpayload_memberbody_payloadrs   s	   &&&&&&   r   r   Z%BaseRestSerializer._serialize_payloadY  s     ,,00;&&~EE &>>.#>L//=L!-v' %..8K&%)%@%@~!>&
6" &*%?%?%A
6"''!%!<!<M*E"Jv &&u--!%!;!;!=Jv .r   c                    R # )r   rM   r      &r   r   Z(BaseRestSerializer._serialize_empty_bodyy  s    r   c                    R# )z
Some protocols require varied Content-Type headers
depending on user input. This allows subclasses to apply
this conditionally.
NrM   )r   r$   rD   r   s   &&&&r   r   Z*BaseRestSerializer._serialize_content_type|  s     	r   c                r   )z{
Some protocols require a specific body to represent an empty
payload. This allows subclasses to apply this conditionally.
FrM   rX   r   r   r   Z'BaseRestSerializer._requires_empty_body  s    
 r   c                sD    VRJ;'       d    W!,          P                   R9   # )z5Determine if payload is streaming (a blob or string).N)Zblobstring)rw   )r   r   r   r   r   r   Z)BaseRestSerializer._has_streaming_payload  s/    d" 
 
}'='G'G L
 (
 	
r   c                sh    \        V\        4      '       d   VP                  V P                  4      # V# rG   )r6   rH   rI   rJ   )r   r"   r   r   r   Z"BaseRestSerializer._encode_payload  s)    dC  ;;t4455r   c                s   WB,          pVP                   P                  R 4      pVP                   P                  RV4      pVR8X  d   V P                  W54      pWR,          V&   R# VR8X  d   \        V\        4      '       d   VR,          P                  V4       R# VP                  R8X  d8   V U	u. uF  p	V P                  WP                  4      NK   	  p
p	WR,          V&   R# V P                  W54      p
WR,          V&   R# VR8X  dA   WB,          pV'       g   VP                  R8X  d   R# V P                  W4      VR	,          V&   R# VR	8X  d   TpV P                  WR	,          V4       R# W1R
,          V&   R# u up	i )locationr@   urir   querystringr   listheaderNr!   r   )
rB   rC   _get_uri_and_query_string_valuer6   re   Zupdaterw   rU   _convert_header_value_do_serialize_header_map)r   r   r   r   r   rU   r   key_nameZuri_path_valuer,   Z	new_paramrD   header_prefixs   &&&&&        r   r   Z(BaseRestSerializer._partition_parameters  s    *''++J7''++FJ?u!AAN 8F)*84&+t,,1299+F!!V+ "-!, 88N!,   @I128< @@	 @I128<!!-E5??f#</3/I/I0K	"8, " %M
 ))95{ 6A&z2=s   1$E:c                s@   VP                   R 8X  d   \        V4      P                  4       # VP                   R8X  d8   VP                  P	                  RV P
                  4      pV P                  W4      # VP                   R9   d   \        V P                  V4      4      # V# )booleanr   r   rZ   Zdouble)rw   rH   r;   rB   rC   QUERY_STRING_TIMESTAMP_FORMATr?   r]   )r   r   rU   r.   r   r   r   Z2BaseRestSerializer._get_uri_and_query_string_value  s    y({#))++,%3377!4#E#E  11  !44t))+677r   c                sP    VP                  4        F  w  rEW,           pWRV&   K  	  R # rG   )rP   )r   r   r!   Z
user_inputrz   valZfull_key   &&&&   r   r   Z+BaseRestSerializer._do_serialize_header_map  s'    "((*HC$*H #H +r   c                    \        R 4      hr   r   )r   r   rD   r   r   r   Z)BaseRestSerializer._serialize_body_params      !":;;r   c                sp   VP                   R 8X  dp   \        V4      p\        P                  ! VP	                  4       4      pVP
                  P                  RV P                  4      p\        V P                  WE4      4      # VP                   R8X  d   VP                  P                   R8X  d(   V Uu. uF  pVf   K	  V P                  V4      NK  	  ppM1V Uu. uF%  pVf   K	  V P                  VP                  V4      NK'  	  ppRP                  V4      # \        V4      '       d(   V P                  \         P"                  ! VRR7      4      # VP                   R8X  d   \        V4      P%                  4       # VP                   R9   d   \        V P'                  V4      4      # \        V4      # u upi u upi )	r   r   r   r   ,)Z
separatorsr   )r  :r   )rw   r   r1   r2   ZutctimetuplerB   rC   HEADER_TIMESTAMP_FORMATrH   r?   rU   _escape_header_list_stringr   rS   r   rL   r   r   r;   r]   )r   rD   r,   r=   r   r.   r   Zconverted_value   &&&     r   r   Z(BaseRestSerializer._convert_header_value  s   ??k)259L (A(A(CDI$2266!4#?#?  ..yK  __&||%%1 ##" 7D33A6"   # ##" @D..u||Q?"   #
 88O,,!%(( ##DJJu$LMM__	)u:##%%__ 33t))%011u:+##s   1F.<F.F3# F3c                sb    R V9   g   RV9   d!   R VP                  R R4      ,           R ,           # V# )Z"r  z\")Zreplacer8   r   r   r
  Z-BaseRestSerializer._escape_header_list_string  s1     %<3%<sE22S88Lr   rM   N)r   r   r   r!   )ra   rb   rc   rd   r   r  r	  ZKNOWN_LOCATIONSr   r   r   r   r   r   r   r   r   r   r   r   r   r
  rh   ri   rj   rl   r   r   r     sp      %.!& BO:x5&>@

1Af$
<!F r   r   c                   s<   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	BaseRpcV2Serializeri  aH  Base class for RPCv2 protocols.

The only variance between the various RPCv2 protocols is the
way that the body is serialized.  All other aspects (headers, uri, etc.)
are the same and logic for serializing those aspects lives here.

Subclasses must implement the ``_serialize_body_params``  and
``_serialize_headers`` methods.

c                s&   V P                  4       pVP                  P                  R ,          pVP                  pRV RV 2VR&   VP                  pVe   V P                  WV4       V P                  W4      pVe   WsR&   V P                  W24       V# )r   z	/service/z/operation/r   ro   )r%   r_   rq   r@   rN   r   rV   _serialize_headers)r   r   r   r$   Zservice_nameZoperation_namerN   ro   r  r   r   Z(BaseRpcV2Serializer.serialize_to_request  s    113
&44==nM(--~[0@A 	: &11"##JKH..zK"(3}%
<r   c                s0    V P                  W4      pWBR &   R# )r"   Nr  )r   r   r$   rD   r   s   &&&& r   r   Z&BaseRpcV2Serializer._serialize_payload,  s    22:E)6r   c                r  )r  r   )r   r$   r   r   r   r  Z&BaseRpcV2Serializer._serialize_headers0  s    !"677r   c                r  r  r   )r   r   rD   r   r   r   Z*BaseRpcV2Serializer._serialize_body_params3  r  r   rM   N)ra   rb   rc   rd   r   r   r   r  r   rh   ri   rj   rl   r   r  r    s#     	(*8< <r   r  c                   s8   a  ] tR tRt o R tR tR tR tRtV t	R# )RestJSONSerializeri7  c                r   )s   {}rM   r   r   r   r   Z(RestJSONSerializer._serialize_empty_body8  s    r   c                st    VP                   P                  4        F  w  r#RVP                  9  g   K   R# 	  R# )zY
Serialize an empty JSON object whenever the shape has
members not targeting a location.
r   TF)rO   rP   rB   )r   rD   rU   r  r/   r   r   Z'RestJSONSerializer._requires_empty_body;  s3    
 !==..0KF!2!22 1 r   c                s    VP                   P                  R4      pV P                  WC4      '       d   R# VR,          R8g  p\        RVR,          4      pV'       d   V'       g   RVR,          R&   R# R# R# )z?Set Content-Type to application/json for all structured bodies.r   Nr"   r   rn   r!   zapplication/json)rB   rC   r   r   )r   r$   rD   r   r   has_bodyhas_content_typer  r   r   Z*RestJSONSerializer._serialize_content_typeE  si    %%)))4&&w>>f%,%nj6KL,4FJy!.1 -8r   c                s    V P                  4       pV P                  W1V4       \        P                  ! V4      P	                  V P
                  4      # rG   )rf   rr   r   r   rI   rJ   )r   r   rD   Zserialized_bodyr   r   r   Z)RestJSONSerializer._serialize_body_paramsQ  s;    --/7zz/*11$2G2GHHr   rM   N)
ra   rb   rc   rd   r   r   r   r   rh   ri   rj   rl   r   r  r  7  s!     
GI Ir   r  c                   sl   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tRtV tR# )RestXMLSerializeriW  r	   c                s    VP                   R ,          p\        P                  ! R4      pV P                  W!WC4       \	        V4      ^ ,          p\        P
                  ! WPP                  R7      # )r@   r   )Zencoding)rB   r    ZElementrr   r   ZtostringrJ   )r   r   rD   Z	root_nameZpseudo_rootZ	real_rootr>   r   r   Z(RestXMLSerializer._serialize_body_paramsZ  sV    ''/	!))"-{>%a(	##I8M8MNNr   c                s`    \        V R VP                   2V P                  4      pV! W2W4       R# r   rv   )r   rD   r   xmlnoder@   r    ry   r   rr   ZRestXMLSerializer._serializea  s3    u/0##

 	w,r   c                s   \         P                  ! W4      pV P                  W54       VP                  4        F  w  rgVP                  V,          pVP
                  P                  R V4      p	Vf    R# VP
                  P                  R4      '       d$   VP
                  R ,          p
WuP                  V
&   K  V P                  WWY4       K  	  R# )r@   NZxmlAttribute)	r    
SubElement_add_xml_namespacerP   rO   rB   rC   attribrr   )r   r  r   rD   r@   structure_noderz   r,   r{   Zmember_nameZxml_attribute_namer   r   r}   Z+RestXMLSerializer._serialize_type_structurei  s    $//>6 ,,.JC ==-L&4488EK
 }))--n==%1%?%?%G"<A%%&89OOLM )r   c                s&   VP                   pVP                  P                  R 4      '       d   TpTpM2VP                  P                  RR4      p\        P                  ! W4      pV P                  W74       V F  pV P                  WXWv4       K  	  R# )rW   r@   rU   N)rU   rB   rC   r    r  r  rr   )	r   r  r   rD   r@   r{   Zelement_nameZ	list_noder   r|   r   r   Z&RestXMLSerializer._serialize_type_list~  sz    ||"";//LI'5599&(KL#..w=I1DOOL	H r   c                s$   V P                  V4      '       g(   \        P                  ! W4      pV P                  W54       VP	                  4        F  w  rgV P                  V4      '       d   \        P                  ! W4      M\        P                  ! XR 4      pV P                  VP                  RR7      p	V P                  VP                  RR7      p
V P                  VP                  WhV	4       V P                  VP                  WxV
4       K  	  R# )Zentryrz   r~   r,   N)	rY   r    r  r  rP   rF   rz   r,   rr   )r   r  r   rD   r@   noderz   r,   Zsub_noder   Zval_namer   r   r   Z%RestXMLSerializer._serialize_type_map  s     ''..))'8D##E0 ,,.JC ++E22 &&w5 ++D': 
 000OH00' 1 H OOEIIsh?OOEKK(C )r   c                sz    \         P                  ! W4      pV'       d   R pMRpWen        V P                  W54       R# r   )r    r  textr  )r   r  r   rD   r@   r  Z	str_values   &&&&&  r   r   Z)RestXMLSerializer._serialize_type_boolean  s4     %%g4II	,r   c                s    \         P                  ! W4      pV P                  V4      Vn        V P	                  W54       R # rG   )r    r  rL   r  r  r   r  r   rD   r@   r  ry   r   r   Z&RestXMLSerializer._serialize_type_blob  s2    %%g4$$V,	,r   c                s    \         P                  ! W4      p\        V P                  W#P                  P                  R 4      4      4      Vn        V P                  W54       R# r   )r    r  rH   r?   rB   rC   r  r  r  ry   r   r   Z+RestXMLSerializer._serialize_type_timestamp  sQ    %%g4**++//0AB
	
 	,r   c                s    \         P                  ! W4      p\        V P                  V4      4      Vn        V P                  W54       R # rG   )r    r  rH   r]   r  r  r  ry   r   r   Z'RestXMLSerializer._serialize_type_float  s7    %%g4**623	,r   c                r   rG   r   )r   r  r   rD   r@   r   r   r   Z(RestXMLSerializer._serialize_type_double  s    ""7E@r   c                st    \         P                  ! W4      p\        V4      Vn        V P	                  W54       R # rG   )r    r  rH   r  r  r  ry   r   rx   Z$RestXMLSerializer._default_serialize  s+    %%g4K	,r   c                sR   R VP                   9   d   VP                   R ,          pRp\        V\        4      '       dC   VP                  R4      '       d   VRVR,           2,          pVR,          VP                  V&   R# \        V\
        4      '       d   W2P                  V&   R# R# R# )ZxmlNamespaceZxmlnsru   r  r   N)rB   r6   re   rC   r  rH   )r   rD   r  Znamespace_metadataZattribute_namer   r   r  Z$RestXMLSerializer._add_xml_namespace  s    U000!&!4!4^!D$N,d33%))(33"*<X*F)G&HHN8J9%%n5 .448J%%n5 5 1r   rM   N)ra   rb   rc   rd   r:   r   rr   r}   r   r   r   r   r   r   r   rx   r  rh   ri   rj   rl   r   r  r  W  sS      O-N*
ID4
--
--
A-
K Kr   r  c                   sB   a a ] tR tRt oRtV 3R ltR tR tRtVt	V ;t
# )RpcV2CBORSerializeri  r   c                s8   < \        R 4       \        SV `	  W4      # )ZPROTOCOL_RPC_V2_CBOR)r   Zsuperr   )r   r   r   	__class__s   &&&r   r   Z(RpcV2CBORSerializer.serialize_to_request  s    23w+JHHr   c                sP    \        4       pV P                  W1V4       \        V4      # rG   )r   r   r   )r   r   rN   r"   r   r   r   Z*RpcV2CBORSerializer._serialize_body_params  s#    {!!$K@T{r   c                s    R VR,          R&   VP                   '       d   RpMRpV P                  W!4       VR,          R8g  p\        RVR,          4      pW1R,          R&   V'       g   V'       d   W1R,          R&   R	# R	# R	# )
zrpc-v2-cborr!   zsmithy-protocolz"application/vnd.amazon.eventstreamzapplication/cborr"   r   rn   ZAcceptN)Zhas_event_stream_outputr`   r   )r   r$   r   Z
header_valr  r  r>   r   r  Z&RpcV2CBORSerializer._serialize_headers  s~    3@
9/0222=J+J++OHf%,%nj6KL*49h'H4>y!.1 %-r   rM   )ra   rb   rc   rd   r:   r   r   r  rh   ri   Z__classcell__)r  rk   s   @@r   r  r    s      &I
? ?r   r  Zec2Zqueryr   z	rest-jsonzrest-xmlzsmithy-rpc-v2-cbor),r   rK   r1   r7   r   r   r[   r   r   Z	xml.etreer    Zbotocorer   Zbotocore.compatr   Zbotocore.exceptionsr   Zbotocore.useragentr   Zbotocore.utilsr   r   r   r   ZDEFAULT_TIMESTAMP_FORMATr+   r*   ZcompilerQ   rg   r(   r   r   r   rm   r   r   r   r   r  r  r  r  r   rM   r   r   <module>r     sL  8       	  !  & 4 2  % 
'12' "/ #  34l@ l@^lEj lE^PO P<`EZ `EFo<Z o<dQ Qh(<* (<VI+^ I@K* KD?-~ ?< 
=_
N#!-r   