HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/site-packages/botocore/__pycache__/serialize.cpython-38.pyc
U

KD�gD��@s\dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZmZmZmZdZd	Zd
Ze�d�Zd$d
d�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Z Gdd�de�Z!Gdd�de e�Z"Gdd �d e �Z#Gd!d"�d"e!e�Z$eeee"e#e$d#�Z%dS)%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)�
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\.\-]+$TcCs&t|�}|r"t��}t�||�}|S�N)�SERIALIZERSrZParamValidatorZParamValidationDecorator)Z
protocol_nameZinclude_validation�
serializer�	validator�r�?/opt/cppython/lib/python3.8/site-packages/botocore/serialize.py�create_serializerDs

rc@sbeZdZdZeZdZdd�Zdd�Zdd�Z	d	d
�Z
dd�Zddd�Zdd�Z
dd�Zdd�Zd
S)�
Serializer�POST�utf-8cCstd��dS)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_requestN��NotImplementedError)�self�
parameters�operation_modelrrrrVs$zSerializer.serialize_to_requestcCsdd|jidd�}|S)N�/��)�url_path�query_string�method�headers�body)�DEFAULT_METHOD)r�
serializedrrr�_create_default_request|s�z"Serializer._create_default_requestcCs|jdkrt}nt}|�|�S)Nr)�microsecond�
ISO8601_MICRO�ISO8601�strftime)r�value�timestamp_formatrrr�_timestamp_iso8601�s
zSerializer._timestamp_iso8601cCstt�|����Sr)�int�calendar�timegm�	timetuple�rr*rrr�_timestamp_unixtimestamp�sz#Serializer._timestamp_unixtimestampcCs"t|tj�r|�|�}t|dd�S)NT)�usegmt)�
isinstance�datetimer2rr1rrr�_timestamp_rfc822�s
zSerializer._timestamp_rfc822NcCs:|dkr|j}|��}t|�}t|d|���}||�}|S)NZ_timestamp_)�TIMESTAMP_FORMAT�lowerr�getattr)rr*r+�datetime_obj�	converterZfinal_valuerrr�_convert_timestamp_to_str�sz$Serializer._convert_timestamp_to_strcCs|j�d|�S�N�name��
serialization�get)r�shape�default_namerrr�_get_serialized_name�szSerializer._get_serialized_namecCs,t|t�r|�|j�}t�|����|j�Sr)r4�str�encode�DEFAULT_ENCODING�base64�	b64encode�strip�decoder1rrr�_get_base64�s
zSerializer._get_base64cCs�|j}|dksd|krdS|d}|jj}dd�|��D�}i}g}|D](}	||	}
t�|
�sh|�|	�|
||	<qH|r�tdd�|��d�d��|j	f|�S)NZ
hostPrefixcSs g|]\}}|j�d�r|�qS)Z	hostLabelr?)�.0�memberrBrrr�
<listcomp>�s�z2Serializer._expand_host_prefix.<locals>.<listcomp>z Invalid value for parameter(s): z, z?. Must contain only alphanumeric characters, hyphen, or period.)�report)
Zendpoint�input_shape�members�items�HOST_PREFIX_RE�match�appendr�join�format)rrrZoperation_endpointZhost_prefix_expressionZ
input_membersZhost_labelsZ
format_kwargsZ
bad_labelsr>�paramrrr�_expand_host_prefix�s.���


�zSerializer._expand_host_prefix)N)�__name__�
__module__�__qualname__r#�dict�MAP_TYPErGrr%r,r2r6r<rDrLrZrrrrrMs&
	rc@speZdZdZdd�Zddd�Zddd�Zdd	d
�Zddd�Zdd
d�Z	ddd�Z
ddd�Zddd�Zdd�Z
dS) �QuerySerializerr
cCs�|j}|��}|j�d|j�|d<ddi|d<|��}|j|d<|jd|d<|dk	rd|�|||�||d<|�	||�}|dk	r�||d	<|S)
Nr �Content-Typez0application/x-www-form-urlencoded; charset=utf-8r!�ActionZ
apiVersion�Versionr"�host_prefix)
rQr%�httprAr#r_r>�metadata�
_serializerZ)rrrrBr$�body_paramsrdrrrr�s&��
z$QuerySerializer.serialize_to_requestrcCs*t|d|j��|j�}|||||d�dS)N�_serialize_type_)�prefix�r9�	type_name�_default_serialize)rr$r*rBrjr rrrrg�s
�zQuerySerializer._serializec	CsR|j}|��D]>\}}||}|�||�}|r<|�d|��}|�||||�qdS)N�.)rRrSrDrg)	rr$r*rBrjrR�key�member_shapeZ
member_prefixrrr�_serialize_type_structure�sz)QuerySerializer._serialize_type_structurecCs�|sd||<dS|�|�r\|}|jj�d�rz|j|jdd�}d�|�d�dd�|g�}n|jj�dd�}|�d|��}t|d�D],\}}	|�d|��}
|j}|�||	||
�q�dS)Nrr>�rCrn���rN�)	�_is_shape_flattenedrNr@rArDrW�split�	enumeraterg)rr$r*rBrjZlist_prefixr>Z	list_name�i�element�element_prefix�
element_shaperrr�_serialize_type_lists
 z$QuerySerializer._serialize_type_listcCs�|�|�r|}n
|�d�}|d}|j}|j}|j|dd�}	|�|d�}
t|d�D]H\}}|j||	d�}
|j||
d�}|�||||
�|�|||||�qRdS)Nz.entryz
.{i}.{suffix}rorrr*rt)rx�suffix)ruror*rDrwrXrg)rr$r*rBrjZfull_prefix�template�	key_shapeZvalue_shapeZ
key_suffixZvalue_suffixrxroZ
key_prefixZvalue_prefixrrr�_serialize_type_maps

z#QuerySerializer._serialize_type_mapcCs|�|�||<dSr�rL�rr$r*rBrjrrr�_serialize_type_blob'sz$QuerySerializer._serialize_type_blobcCs|�||j�d��||<dS�N�timestampFormat�r<r@rAr�rrr�_serialize_type_timestamp+s
�z)QuerySerializer._serialize_type_timestampcCs|rd||<nd||<dS�N�true�falserr�rrr�_serialize_type_boolean0s
z'QuerySerializer._serialize_type_booleancCs|||<dSrrr�rrrrm6sz"QuerySerializer._default_serializecCs|j�d�S)N�	flattenedr?�rrBrrrru9sz#QuerySerializer._is_shape_flattenedN)r)r)r)r)r)r)r)r)r[r\r]r7rrgrqr|r�r�r�r�rmrurrrrr`�s

	





r`c@s"eZdZdZdd�Zddd�ZdS)	�
EC2SerializeraUEC2 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.

    cCsHd|jkr|jdSd|jkr@|jd}|d��|dd�S|SdS)NZ	queryNamer>rrt)r@�upper)rrBrCr>rrrrDGs



z"EC2Serializer._get_serialized_namerc	Cs<t|d�D],\}}|�d|��}|j}|�||||�q
dS)Nrtrn)rwrNrg)	rr$r*rBrjrxryrzr{rrrr|Tsz"EC2Serializer._serialize_type_listN)r)r[r\r]�__doc__rDr|rrrrr�=s	
r�c@sReZdZdZdd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�JSONSerializer�
unixtimestampc	Cs�d�|jd|j�}|jd}|��}|j�d|j�|d<|d|��d�|d<|��}|j}|dk	rr|�	|||�t
�|��|j
�|d<|�||�}|dk	r�||d	<|S)
Nz{}.{}�targetPrefixZjsonVersionr zapplication/x-amz-json-)zX-Amz-Targetrar!r"rd)rXrfr>r%rerAr#r_rQrg�json�dumpsrFrGrZ)	rrr�targetZjson_versionr$r"rQrdrrrr^s,�
��
z#JSONSerializer.serialize_to_requestNcCs(t|d|j��|j�}|||||�dS�Nrirk�rr$r*rBror rrrrgxs
�zJSONSerializer._serializec
Cst|jr|||<n`|dk	r,|��}|||<|}|j}|��D]4\}}||}	d|	jkr^|	jd}|�|||	|�q:dSr=)Zis_document_typer_rRrSr@rg)
rr$r*rBroZnew_serializedrR�
member_key�member_valuerprrrrq�s"


�z(JSONSerializer._serialize_type_structurecCs8|��}|||<|��D]\}}|�|||j|�qdSr)r_rSrgr*)rr$r*rBroZmap_objZsub_keyZ	sub_valuerrrr��sz"JSONSerializer._serialize_type_mapcCs>g}|||<|D](}i}|�|||jd�|�|d�qdS)NZ__current__)rgrNrV)rr$r*rBro�list_objZ	list_item�wrapperrrrr|�sz#JSONSerializer._serialize_type_listcCs|||<dSrr�rr$r*rBrorrrrm�sz!JSONSerializer._default_serializecCs|�||j�d��||<dSr�r�r�rrrr��s
�z(JSONSerializer._serialize_type_timestampcCs|�|�||<dSrr�r�rrrr��sz#JSONSerializer._serialize_type_blob)N)r[r\r]r7rrgrqr�r|rmr�r�rrrrr�[s
r�c@s�eZdZdZdZdZdZdZdZdZ	dZ
d*d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd	S)+�CBORSerializerrrt������NcCs>t|d|j���}|dkr,td|j�d���|||||�dS)NrizUnrecognized C2J type: z, unable to serialize request)r9rl�
ValueErrorr�rrr�_serialize_data_item�s�z#CBORSerializer._serialize_data_itemc	Csf|dkr|j}n|j}d|}|�|�\}}|�||�}|dkrL|�|�n|�||�|d��dS)Nrrs�big)�UNSIGNED_INT_MAJOR_TYPE�NEGATIVE_INT_MAJOR_TYPE�"_get_additional_info_and_num_bytes�_get_initial_byte�extend�to_bytes)	rr$r*rBro�
major_type�additional_info�	num_bytes�initial_byterrr�_serialize_type_integer�s�z&CBORSerializer._serialize_type_integercCs|�||||�dSr)r�r�rrr�_serialize_type_long�sz#CBORSerializer._serialize_type_longc	Cs�t|t�r|�d�}nt|ttf�s,|��}t|�}|�|�\}}|�|j	|�}|dkrd|�
|�n|�
||�|d��|�
|�dS�Nrrr�)r4rErF�bytes�	bytearray�read�lenr�r��BLOB_MAJOR_TYPEr�r�)	rr$r*rBro�lengthr�r�r�rrrr��s 
��z#CBORSerializer._serialize_type_blobc
Csd|�d�}t|�}|�|�\}}|�|j|�}	|dkrF|�|	|�n|�|	|�|d�|�dSr�)rFr�r�r��STRING_MAJOR_TYPEr�r�)
rr$r*rBro�encodedr�r�r�r�rrr�_serialize_type_string�s
���z%CBORSerializer._serialize_type_stringc
Cslt|�}|�|�\}}|�|j|�}|dkr8|�|�n|�||�|d��|D]}	|�||	|j�qRdS�Nrr�)r�r�r��LIST_MAJOR_TYPEr�r�r�rN)
rr$r*rBror�r�r�r��itemrrrr|s��z#CBORSerializer._serialize_type_listcCs�t|�}|�|�\}}|�|j|�}|dkr8|�|�n|�||�|d��|��D](\}	}
|�||	|j�|�||
|j	�qVdSr�)
r�r�r��MAP_MAJOR_TYPEr�r�rSr�ror*)rr$r*rBror�r�r�r�Zkey_itemr�rrrr�s��z"CBORSerializer._serialize_type_mapc
Cs�|dk	r|�|||j�dd�|��D�}t|�}|�|�\}}|�|j|�}|dkrb|�|�n|�||�|d��|j	}	|��D]J\}
}|	|
}d|j
kr�|j
d}
|dk	r�|�||
dd�|�|||�q�dS)NcSsi|]\}}|dk	r||�qSrr)rM�k�vrrr�
<dictcomp>%sz<CBORSerializer._serialize_type_structure.<locals>.<dictcomp>rr�r>)r�rrSr�r�r�r�r�r�rRr@r�)
rr$r*rBroZ
map_lengthr�r�r�rRr�r�rprrrrqs8���

�z(CBORSerializer._serialize_type_structurec
Cs~|�|�}d}|�|j|�}|�|�|�|�\}}	|	dkrV|�|j|�}|�|�n$|�|j|�}|�||�|	d��dS)Nrtrr�)r<r��TAG_MAJOR_TYPEr�r�r�r�)
rr$r*rBro�	timestamp�tagr�r�r�rrrr�@s(

����z(CBORSerializer._serialize_type_timestampcCsD|�|�r|�|�|��n$|�|jd�}|�|t�d|��dS)N�z>f��_is_special_numberr��_get_bytes_for_special_numbersr��FLOAT_AND_SIMPLE_MAJOR_TYPE�struct�pack�rr$r*rBror�rrr�_serialize_type_floatVs
��z$CBORSerializer._serialize_type_floatcCsD|�|�r|�|�|��n$|�|jd�}|�|t�d|��dS)N�z>dr�r�rrr�_serialize_type_doubleas
��z%CBORSerializer._serialize_type_doublecCs$|rdnd}|�|�|j|��dS)N��)r�r�r�)rr$r*rBror�rrrr�ls��z&CBORSerializer._serialize_type_booleancCs<|dkr|dfS|dkrdS|dkr(dS|dkr4dSd	SdS)
N�r�)r�rti)�r�l)r�r�)r��rr1rrrr�tsz1CBORSerializer._get_additional_info_and_num_bytescCs|d>}||B�dd�S)Nr�rtr�)r�)rr�r�Zmajor_type_bytesrrrr��sz CBORSerializer._get_initial_bytecCs$t|td�k|td�kt�|�g�S)N�inf�-inf)�any�float�math�isnanr1rrrr��s

��z!CBORSerializer._is_special_numbercCshd}|�|j|�}|td�kr.|t�dd�S|td�krJ|t�dd�St�|�rd|t�dd�SdS)Nr�r�z>Hi|r�i�i~)r�r�r�r�r�r�r�)rr*r�r�rrrr��s�
z-CBORSerializer._get_bytes_for_special_numbers)N)r[r\r]r�r�r�r�r�r�r�r�r�r�r�r�r�r|r�rqr�r�r�r�r�r�r�r�rrrrr��s0
	!	r�c@s�eZdZdZdZdZddddgZdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!�BaseRestSerializera=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
Zrfc822�uri�querystring�headerr!c
Cs,|��}|j�d|j�|d<|j}|dkr<|jd|d<|S|j}|��|��|��|��d�}|��D]"\}}|dkrzqh|�||||�qh|�	|jd|d�|d<d|jkr�|�	|jd|d�|d<|d|d	<|d
r�|d
|d
<|�
|||||�|�|||�|�||�}	|	dk	�r(|	|d<|S)Nr Z
requestUrir)�uri_path_kwargs�query_string_kwargs�body_kwargsr!r�ZauthPathZ	auth_pathr�rr!rd)
r%rerAr#rQrRr_rS�_partition_parameters�_render_uri_template�_serialize_payload�_serialize_content_typerZ)
rrrr$rB�
shape_members�partitioned�
param_name�param_valuerdrrrr�s`����
��
z'BaseRestSerializer.serialize_to_requestcCsZi}t�d|�D]<}|�d�r<t||dd�dd�||<qt||�||<q|jf|�S)Nz{(.*?)}�+rsz/~)�safe)�re�findall�endswithr	rX)rZuri_template�paramsZencoded_paramsZtemplate_paramrrrr��s
��
z'BaseRestSerializer._render_uri_templatec	Cs�|j�d�}|�||�r8|�|d�}|�|�}||d<nr|dk	rv|�|�}|dk	rh|�|||�|d<q�|��|d<n4|dr�|�|d|�|d<n|�|�r�|��|d<dS)N�payloadrr"r�)r@rA�_has_streaming_payload�_encode_payload�_serialize_body_params�_serialize_empty_body�_requires_empty_body)	rr�rr$rBr�Zpayload_member�body_payloadrhrrrr�s(


�
�

z%BaseRestSerializer._serialize_payloadcCsdS)Nrr�rrrrr�&sz(BaseRestSerializer._serialize_empty_bodycCsdS)z�
        Some protocols require varied Content-Type headers
        depending on user input. This allows subclasses to apply
        this conditionally.
        Nr)rr$rBr�rrrr�)sz*BaseRestSerializer._serialize_content_typecCsdS)z�
        Some protocols require a specific body to represent an empty
        payload. This allows subclasses to apply this conditionally.
        Frr�rrrr�1sz'BaseRestSerializer._requires_empty_bodycCs|dk	o||jdkS)z5Determine if payload is streaming (a blob or string).N)Zblob�string)rl)rr�r�rrrr�8sz)BaseRestSerializer._has_streaming_payloadcCst|t�r|�|j�S|Sr)r4rErFrG)rr"rrrr�?s
z"BaseRestSerializer._encode_payloadcCs4||}|j�d�}|j�d|�}|dkr8||d|<n�|dkr�t|t�rZ|d�|�ndt|t�r~t|���}||d|<n@|jdkr�|j�d|j	�}	|�
||	�}
|
|d|<n||d|<np|d	k�r||}|s�|jd
kr�dS|�||�}t|�|d|<n.|dk�r$|}
|�|
|d|�n||d|<dS)
N�locationr>r�r�r�r�r�r�r��listr!r�)
r@rAr4r^�update�boolrEr8rl�QUERY_STRING_TIMESTAMP_FORMATr<�_convert_header_value�_do_serialize_header_map)rr�r�r�r�rNr��key_nameZbool_strr+r�rBr*�
header_prefixrrrr�DsH


��

�z(BaseRestSerializer._partition_parameterscCs&|��D]\}}||}|||<qdSr)rS)rrr!Z
user_inputro�valZfull_keyrrrrusz+BaseRestSerializer._do_serialize_header_mapcCstd��dS�Nr�r)rr�rBrrrr�zsz)BaseRestSerializer._serialize_body_paramscs��jdkr<t|�}t�|���}�j�d�j�}��||�S�jdkrd��fdd�|D�}d�	|�St
��r���tj
|dd��S|SdS)	Nr�r�r�cs"g|]}|dk	r���j|��qSr)rrN)rMr�r�rrrO�s�z<BaseRestSerializer._convert_header_value.<locals>.<listcomp>�,)r�:)�
separators)rlrr.r/�utctimetupler@rA�HEADER_TIMESTAMP_FORMATr<rWrrLr�r�)rrBr*r:r�r+Zconverted_valuerr�rr}s 
�
�
z(BaseRestSerializer._convert_header_valueN)r[r\r]r�rrZKNOWN_LOCATIONSrr�r�r�r�r�r�r�r�rr�rrrrrr��s 
; 1r�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�BaseRpcV2Serializera`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.

    cCsZ|��}|jjd}|j}d|�d|��|d<|j}|dk	rJ|�|||�|�||�|S)Nr�z	/service/z/operation/r)r%Z
service_modelrfr>rQr��_serialize_headers)rrrr$�service_nameZoperation_namerQrrrr�s�z(BaseRpcV2Serializer.serialize_to_requestcCs|�||�}||d<dS)Nr")r�)rrr$rBr�rrrr��sz&BaseRpcV2Serializer._serialize_payloadcCstd��dS)Nrr)rr$rrrrr�sz&BaseRpcV2Serializer._serialize_headerscCstd��dSrr)rrrBrrrr��sz*BaseRpcV2Serializer._serialize_body_paramsN)r[r\r]r�rr�rr�rrrrr
�s
r
c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�RestJSONSerializercCsdS)Ns{}rr�rrrr��sz(RestJSONSerializer._serialize_empty_bodycCs(|j��D]\}}d|jkr
dSq
dS)zq
        Serialize an empty JSON object whenever the shape has
        members not targeting a location.
        r�TF)rRrSr@)rrBrNrrrrr��s
z'RestJSONSerializer._requires_empty_bodycCsN|j�d�}|�||�rdS|ddk}td|d�}|rJ|sJd|dd<dS)z?Set Content-Type to application/json for all structured bodies.r�Nr"rrar!zapplication/json)r@rAr�r)rr$rBr�r��has_body�has_content_typerrrr��sz*RestJSONSerializer._serialize_content_typecCs(|��}|�|||�t�|��|j�Sr)r_rgr�r�rFrG)rr�rBZserialized_bodyrrrr��sz)RestJSONSerializer._serialize_body_paramsN)r[r\r]r�r�r�r�rrrrr�s
rc@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�RestXMLSerializerr
cCs@|jd}t�d�}|�||||�t|�d}tj||jd�S)Nr>rr)�encoding)r@rZElementrgr��tostringrG)rr�rBZ	root_nameZpseudo_rootZ	real_rootrrrr��s


z(RestXMLSerializer._serialize_body_paramscCs(t|d|j��|j�}|||||�dSr�rk)rrBr��xmlnoder>r rrrrg�s
�zRestXMLSerializer._serializec
Cs�t�||�}d|jkrN|jd}d}|�d�r@|d|d��7}|d|j|<|��D]`\}}	|j|}
|
j�d|�}|	dkr�dS|
j�d�r�|
jd}|	|j|<qV|�|
|	||�qVdS)NZxmlNamespaceZxmlnsrjr	r�r>ZxmlAttribute)r�
SubElementr@rAZattribrSrRrg)
rrr�rBr>Zstructure_nodeZnamespace_metadataZattribute_nameror*rp�member_nameZxml_attribute_namerrrrq�s"





z+RestXMLSerializer._serialize_type_structurec	CsT|j}|j�d�r|}|}n|j�dd�}t�||�}|D]}|�||||�q:dS)Nr�r>rN)rNr@rArrrg)	rrr�rBr>rpZelement_nameZ	list_noder�rrrr|sz&RestXMLSerializer._serialize_type_listcCsrt�||�}|��D]X\}}t�|d�}|j|jdd�}	|j|jdd�}
|�|j|||	�|�|j|||
�qdS)N�entryrorrr*)rrrSrDror*rg)rrr�rBr>�noderor*Z
entry_noderZval_namerrrr�s	�z%RestXMLSerializer._serialize_type_mapcCs$t�||�}|rd}nd}||_dSr�)rr�text)rrr�rBr>rZ	str_valuerrrr�&s
z)RestXMLSerializer._serialize_type_booleancCst�||�}|�|�|_dSr)rrrLr�rrr�rBr>rrrrr�1sz&RestXMLSerializer._serialize_type_blobcCs&t�||�}|�||j�d��|_dSr�)rrr<r@rArrrrrr�5s

�z+RestXMLSerializer._serialize_type_timestampcCst�||�}t|�|_dSr)rrrErrrrrrm;sz$RestXMLSerializer._default_serializeN)
r[r\r]r7r�rgrqr|r�r�r�r�rmrrrrr�src@s eZdZdZdd�Zdd�ZdS)�RpcV2CBORSerializerr�cCst�}|�|||�t|�Sr)r�r�r�)rrrQr"rrrr�Csz*RpcV2CBORSerializer._serialize_body_paramscCsZd|dd<|jrd}nd}|ddk}td|d�}||dd	<|sV|rV||dd<dS)
Nzrpc-v2-cborr!zsmithy-protocolz"application/vnd.amazon.eventstreamzapplication/cborr"rra�Accept)Zhas_event_stream_outputr)rr$rZ
header_valrrrrrrHsz&RpcV2CBORSerializer._serialize_headersN)r[r\r]r7r�rrrrrr@sr)Zec2�queryr�z	rest-jsonzrest-xmlzsmithy-rpc-v2-cbor)T)&r�rHr.r5r�r�r�r�Z	xml.etreerZbotocorerZbotocore.compatrZbotocore.exceptionsrZbotocore.utilsrrrr	ZDEFAULT_TIMESTAMP_FORMATr(r'�compilerTrrr`r�r�r�r�r
rrrrrrrr�<module>
sJ

	lYso' e�