o ãÄd®-ã@sZddlZddlmZddlmZdd„Zddd„Zd d „ZGd d „d ƒZGd d„dƒZ dS)éN)Ú xform_nameé)Úget_data_membercCs|D] }|dur dSqdS)zÍ Return True if all elements of the iterable are not None (or if the iterable is empty). This is like the built-in ``all``, except checks against None, so 0 and False are allowable values. NFT©)ÚiterableÚelementrrús/private/var/folders/v1/_jykv66s6qd26_69j1njbrl80000gr/T/pip-target-p1gutpg6/lib/python/boto3/resources/response.pyÚ all_not_nones ÿr c Cs¨g}|D]M}|j}|j}|dkrt |j|¡}n0|dkr$t |j|¡}n$|dkr1t|t|jƒƒ}n|dkri}|S|jdkrGg}|S|jdkrNi}|S)a� Creates an appropriate empty response for the type that is expected, based on the service model's shape type. For example, a value that is normally a list would then return an empty list. A structure would return an empty dict, and a number would return None. :type search_path: string :param search_path: JMESPath expression to search in the response :type operation_name: string :param operation_name: Name of the underlying service operation. :type service_model: :ref:`botocore.model.ServiceModel` :param service_model: The Botocore service model :rtype: dict, list, or None :return: An appropriate empty value NÚ.z [0123456789]$Z structureÚlistz&Search path hits shape type {} from {}Úmap) Úoperation_modelZ output_shapeÚsplitÚstripÚ type_nameÚmembersÚmemberrÚformat)Ú search_pathÚoperation_nameÚ service_modelr r!ÚshapeÚitemrrrÚbuild_empty_responseNs0     ÿÿ  û ýr-c@s eZdZdZdd„Zdd„ZdS)Ú RawHandleraG A raw action response handler. This passed through the response dictionary, optionally after performing a JMESPath search if one has been defined for the action. :type search_path: string :param search_path: JMESPath expression to search in the response :rtype: dict :return: Service response cCs ||_dS©N)r()Úselfr(rrrÚ__init__�s zRawHandler.__init__cCs"|jr|jdkrt |j|¡}|S)á, :type parent: ServiceResource :param parent: The resource instance to which this action is attached. :type params: dict :param params: Request parameters sent to the service. :type response: dict :param response: Low-level operation response. ú$)r(rr)r0rrr rrrÚ__call__�s zRawHandler.__call__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r1r4rrrrr.�s r.c@s,eZdZdZ d dd„Zdd„Zdd„ZdS) ÚResourceHandleraf Creates a new resource or list of new resources from the low-level response based on the given response resource definition. :type search_path: string :param search_path: JMESPath expression to search in the response :type factory: ResourceFactory :param factory: The factory that created the resource class to which this action is attached. :type resource_model: :py:class:`~boto3.resources.model.ResponseResource` :param resource_model: Response resource model. :type service_context: :py:class:`~boto3.utils.ServiceContext` :param service_context: Context about the AWS service :type operation_name: string :param operation_name: Name of the underlying service operation, if it exists. :rtype: ServiceResource or list :return: New resource instance(s). NcCs"||_||_||_||_||_dSr/)r(ÚfactoryÚresource_modelr)Úservice_context)r0r(r:r;r<r)rrrr1ºs  zResourceHandler.__init__c Csü|jj}|jj |¡}|jj|||jd�}|}d}|jr#t  |j|¡}t t |jj |||ƒƒ} dd„|   ¡Dƒ} | r[g}tt| dƒƒD]} d} |rM|| } | | ||| | ¡¡qC|St|   ¡ƒrk| ||| |¡}|Sd}|jdur|t|j|j|jjƒ}|S)r2)Ú resource_nameZsingle_resource_json_definitionr<NcSsg|] }t|tƒr|‘qSr)Ú isinstancer)Ú.0ÚvrrrÚ òsz,ResourceHandler.__call__..r)r;Útyper<Zresource_json_definitionsÚgetr:Zload_from_definitionr(rrÚdictrrÚvaluesÚrangeÚlenrÚhandle_response_itemr r)r-r*) r0rrr r=Zjson_definitionÚ resource_clsrZsearch_responserÚpluralÚiZ response_itemrrrr4ÈsX ÿý ÿÿÿÿ ëÿö ýzResourceHandler.__call__c Cs\d|jji}| ¡D]\}}t|tƒr| d¡}|||<q |di|¤Ž}|dur,||j_|S)a� Handles the creation of a single response item by setting parameters and creating the appropriate resource instance. :type resource_cls: ServiceResource subclass :param resource_cls: The resource class to instantiate. :type parent: ServiceResource :param parent: The resource instance to which this action is attached. :type identifiers: dict :param identifiers: Map of identifier names to value or values. :type resource_data: dict or None :param resource_data: Data for resource attributes. :rtype: ServiceResource :return: New resource instance. ÚclientrNr)ÚmetarLÚitemsr>rÚpopr ) r0rIrrZ resource_dataÚkwargsrrÚresourcerrrrHsÿ   z$ResourceHandler.handle_response_itemr/)r5r6r7r8r1r4rHrrrrr9 s  ú Tr9)NN) rZbotocorerrrr rr-r.r9rrrrÚs   .3