U `1-@s^ddlZddlmZddlmZddZdddZd d ZGd d d eZ Gd ddeZ dS)N) xform_name)get_data_membercCs|D]}|dkrdSqdS)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)iterableelementrrs z,ResourceHandler.__call__..r)r;typer<Zresource_json_definitionsgetr:Zload_from_definitionr(rrdictrrvaluesrangelenrhandle_response_itemr r)r-r*) r0rrr r=Zjson_definition resource_clsrZsearch_responserpluraliZ response_itemrrrr4s^   zResourceHandler.__call__c CsXd|jji}|D]$\}}t|tr0|d}|||<q|f|}|dk rT||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. clientrN)metarLitemsr>r popr ) r0rIrrZ resource_datakwargsrrresourcerrrrH s    z$ResourceHandler.handle_response_item)N)r5r6r7r8r1r4rHrrrrr9s  Lr9)NN) rZbotocorerrrr rr-objectr.r9rrrrs   /1