Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/boto3/resources/__pycache__/collection.cpython-39.pyc
Ðазад
a v�hiJ � @ s� d dl Z d dlZd dlmZ d dlmZ ddlmZ ddlm Z ddl mZ dd lm Z e�e�ZG d d� de�ZG dd � d e�ZG dd� de�ZdS )� N)� xform_name)�merge_dicts� )�BatchAction)�create_request_parameters)�ResourceHandler� )� docstringc @ sX e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Zdd� ZdS )�ResourceCollectiona� Represents a collection of resources, which can be iterated through, optionally with filtering. Collections automatically handle pagination for you. See :ref:`guide_collections` for a high-level overview of collections, including when remote service requests are performed. :type model: :py:class:`~boto3.resources.model.Collection` :param model: Collection model :type parent: :py:class:`~boto3.resources.base.ServiceResource` :param parent: The collection's parent resource :type handler: :py:class:`~boto3.resources.response.ResourceHandler` :param handler: The resource response handler used to create resource instances c K s0 || _ || _t|jj�| _|| _t�|�| _ d S �N) �_model�_parentr �request� operation�_py_operation_name�_handler�copy�deepcopy�_params)�self�model�parent�handler�kwargs� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/boto3/resources/collection.py�__init__. s �zResourceCollection.__init__c C s( d� | jj| jd� | jjj| jjj��S �Nz {0}({1}, {2})z{0}.{1}� �format� __class__�__name__r �meta�service_namer �resource�type�r r r r �__repr__6 s ��zResourceCollection.__repr__c c sT | j �dd�}d}| �� D ]4}|D ]*}|V |d7 }|dur"||kr" dS q"qdS )a� A generator which yields resource instances after doing the appropriate service operation calls and handling any pagination on your behalf. Page size, item limit, and filter parameters are applied if they have previously been set. >>> bucket = s3.Bucket('boto3') >>> for obj in bucket.objects.all(): ... print(obj.key) 'key1' 'key2' �limitNr r )r �get�pages)r r( �count�page�itemr r r �__iter__@ s zResourceCollection.__iter__c K s: t �| j�}t||dd� | j| j| j| jfi |��}|S )aO Create a clone of this collection. This is used by the methods below to provide a chainable interface that returns copies rather than the original. This allows things like: >>> base = collection.filter(Param1=1) >>> query1 = base.filter(Param2=2) >>> query2 = base.filter(Param3=3) >>> query1.params {'Param1': 1, 'Param2': 2} >>> query2.params {'Param1': 1, 'Param3': 3} :rtype: :py:class:`ResourceCollection` :return: A clone of this resource collection T�Zappend_lists)r r r r r r r r )r r �params�cloner r r �_clone] s ��zResourceCollection._clonec c s6 | j jj}| j�� }|�dd�}|�dd�}t| j | jj�}t ||dd� |� | j�r�t� d| j jj| j|� |�| j�}|jf d||d�i|��}n0t� d | j jj| j|� t|| j�f i |��g}d }|D ]b} g } | �| j || �D ],}| �|� |d7 }|dur�||kr� �qq�| V |dur�||kr� �q2q�dS )a� A generator which yields pages of resource instances after doing the appropriate service operation calls and handling any pagination on your behalf. Non-paginated calls will return a single page of items. Page size, item limit, and filter parameters are applied if they have previously been set. >>> bucket = s3.Bucket('boto3') >>> for page in bucket.objects.pages(): ... for obj in page: ... print(obj.key) 'key1' 'key2' :rtype: list(:py:class:`~boto3.resources.base.ServiceResource`) :return: List of resource instances r( N� page_sizeTr/ zCalling paginated %s:%s with %rZPaginationConfig)ZMaxItemsZPageSizezCalling %s:%s with %rr r )r r"