
    `2f%                         d dl Z d dlmZ d dlmZ d dlmZ ddlmZ ddl	m
Z
 ddlmZmZ  e j                  e      Z G d	 d
      Z G d de      Z G d d      Z G d d      Zy)    N)
xform_name)ActionDocstring)inject_attribute   )Action)create_request_parameters)
RawHandlerResourceHandlerc                       e Zd ZdZddZd Zy)ServiceActiona  
    A class representing a callable action on a resource, for example
    ``sqs.get_queue_by_name(...)`` or ``s3.Bucket('foo').delete()``.
    The action may construct parameters from existing resource identifiers
    and may return either a raw response or a new resource instance.

    :type action_model: :py:class`~boto3.resources.model.Action`
    :param action_model: The action model.

    :type factory: ResourceFactory
    :param factory: The factory that created the resource class to which
                    this action is attached.

    :type service_context: :py:class:`~boto3.utils.ServiceContext`
    :param service_context: Context about the AWS service
    Nc                     || _         |j                  }|r4t        |j                  ||||j                  j
                        | _        y t        |j                        | _        y )N)search_pathfactoryresource_modelservice_contextoperation_name)_action_modelresourcer
   pathrequest	operation_response_handlerr	   )selfaction_modelr   r   resource_response_models        V/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/boto3/resources/action.py__init__zServiceAction.__init__.   s^    ) #/"7"7"%43886 /+33==&D" &00A0A%BD"    c                    t        | j                  j                  j                        }t	        || j                  j                        }|j                  |       t        j                  d|j                  j                  ||        t        |j                  j                  |      |i |}t        j                  d|       | j                  |||      S )a  
        Perform the action's request operation after building operation
        parameters and build any defined resources from the response.

        :type parent: :py:class:`~boto3.resources.base.ServiceResource`
        :param parent: The resource instance to which this action is attached.
        :rtype: dict or ServiceResource or list(ServiceResource)
        :return: The response, either as a raw dict or resource instance(s).
        Calling %s:%s with %rResponse: %r)r   r   r   r   r   updateloggerdebugmetaservice_namegetattrclientr   )r   parentargskwargsr   paramsresponses          r   __call__zServiceAction.__call__?   s     $D$6$6$>$>$H$HI
 +643E3E3M3MNf#KK$$		
 ?76;;--~>OO^X.%%ffh??r   )NN__name__
__module____qualname____doc__r   r.    r   r   r   r      s    "C"@r   r   c                       e Zd ZdZd Zy)BatchActiona  
    An action which operates on a batch of items in a collection, typically
    a single page of results from the collection's underlying service
    operation call. For example, this allows you to delete up to 999
    S3 objects in a single operation rather than calling ``.delete()`` on
    each one individually.

    :type action_model: :py:class`~boto3.resources.model.Action`
    :param action_model: The action model.

    :type factory: ResourceFactory
    :param factory: The factory that created the resource class to which
                    this action is attached.

    :type service_context: :py:class:`~boto3.utils.ServiceContext`
    :param service_context: Context about the AWS service
    c                 N   d}d}g }t        | j                  j                  j                        }|j	                         D ]  }i }	t        |      D ]X  \  }
}||j                  j                  }||j                  j                  }t        || j                  j                  |	|
       Z |	s |S |	j                  |       t        j                  d|||	        t        ||      |i |	}t        j                  d|       |j                  | j                  ||	|              |S )a  
        Perform the batch action's operation on every page of results
        from the collection.

        :type parent:
            :py:class:`~boto3.resources.collection.ResourceCollection`
        :param parent: The collection iterator to which this action
                       is attached.
        :rtype: list(dict)
        :return: A list of low-level response dicts from each call.
        N)r,   indexr    r!   )r   r   r   r   pages	enumerater%   r&   r(   r   r"   r#   r$   r'   appendr   )r   r)   r*   r+   r&   r(   	responsesr   pager,   r8   r   r-   s                r   r.   zBatchAction.__call__r   s1    	#D$6$6$>$>$H$HI
 LLN  	ODF#,T? x  '#+==#=#=L>%]]11F)&&..!	    MM&!LL'~v 7wv~6GGHLL2T33FFHMNA 	OD r   N)r0   r1   r2   r3   r.   r4   r   r   r6   r6   _   s    $6r   r6   c                       e Zd ZdZd Zd Zy)WaiterActiona/  
    A class representing a callable waiter action on a resource, for example
    ``s3.Bucket('foo').wait_until_bucket_exists()``.
    The waiter action may construct parameters from existing resource
    identifiers.

    :type waiter_model: :py:class`~boto3.resources.model.Waiter`
    :param waiter_model: The action waiter.
    :type waiter_resource_name: string
    :param waiter_resource_name: The name of the waiter action for the
                                 resource. It usually begins with a
                                 ``wait_until_``
    c                      || _         || _        y )N)_waiter_model_waiter_resource_name)r   waiter_modelwaiter_resource_names      r   r   zWaiterAction.__init__   s    )%9"r   c                    t        | j                  j                        }t        || j                        }|j	                  |       t
        j                  d|j                  j                  | j                  |       |j                  j                  }|j                  |      } |j                  di |}t
        j                  d|       y)z
        Perform the wait operation after building operation
        parameters.

        :type parent: :py:class:`~boto3.resources.base.ServiceResource`
        :param parent: The resource instance to which this action is attached.
        r    r!   Nr4   )r   rA   waiter_namer   r"   r#   r$   r%   r&   rB   r(   
get_waiterwait)	r   r)   r*   r+   client_waiter_namer,   r(   waiterr-   s	            r   r.   zWaiterAction.__call__   s     ((:(:(F(FG
 +643E3EFf#KK$$&&		
 ##""#566;;((^X.r   Nr/   r4   r   r   r?   r?      s    :/r   r?   c                       e Zd ZdZd Zd Zy)CustomModeledActionz3A custom, modeled action to inject into a resource.c                 <    || _         || _        || _        || _        y)a  
        :type action_name: str
        :param action_name: The name of the action to inject, e.g.
            'delete_tags'

        :type action_model: dict
        :param action_model: A JSON definition of the action, as if it were
            part of the resource model.

        :type function: function
        :param function: The function to perform when the action is called.
            The first argument should be 'self', which will be the resource
            the function is to be called on.

        :type event_emitter: :py:class:`botocore.hooks.BaseEventHooks`
        :param event_emitter: The session event emitter.
        N)namemodelfunctionemitter)r   action_namer   rP   event_emitters        r   r   zCustomModeledAction.__init__   s     $  	!
 $r   c                 L   |j                  d      d   }t        | j                  | j                  i       }| j                  | j                  _        t        || j                  ||j                  d      | j                  _	        t        || j                  | j                         y )N.F)resource_namerS   r   service_modelinclude_signature)rsplitr   rN   rO   rP   r0   r   rQ   rX   r3   r   )r   class_attributesr   
event_namer+   rW   actions          r   injectzCustomModeledAction.inject   s~    "))#.r2		4::r2!% /',,)77#!
 	)499dmmDr   N)r0   r1   r2   r3   r   r^   r4   r   r   rL   rL      s    =%.Er   rL   )loggingbotocorer   boto3.docs.docstringr   boto3.utilsr   rO   r   r,   r   r-   r	   r
   	getLoggerr0   r#   r   r6   r?   rL   r4   r   r   <module>rd      sc      0 (  - 1			8	$@@ @@FI- IX./ ./b%E %Er   