HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/awscli/customizations/__pycache__/paginate.cpython-38.pyc
U

<�^�.�@s�dZddlZddlmZddlmZddlmZmZddlm	Z	ddl
mZe�e
�ZdZd	Zd
Zdd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �ZGd!d"�d"e�ZdS)#a'This module has customizations to unify paging paramters.

For any operation that can be paginated, we will:

    * Hide the service specific pagination params.  This can vary across
    services and we're going to replace them with a consistent set of
    arguments.  The arguments will still work, but they are not
    documented.  This allows us to add a pagination config after
    the fact and still remain backwards compatible with users that
    were manually doing pagination.
    * Add a ``--starting-token`` and a ``--max-items`` argument.

�N)�partial)�
xform_name)�DataNotFoundError�PaginationError)�model)�BaseCLIArgumenta/
<p>A token to specify where to start paginating.  This is the
<code>NextToken</code> from a previously truncated response.</p>
<p>For usage examples, see <a
href="https://docs.aws.amazon.com/cli/latest/userguide/pagination.html"
>Pagination</a> in the <i>AWS Command Line Interface User
Guide</i>.</p>
a`
<p>The total number of items to return in the command's output.
If the total number of items available is more than the value
specified, a <code>NextToken</code> is provided in the command's
output.  To resume pagination, provide the
<code>NextToken</code> value in the <code>starting-token</code>
argument of a subsequent command.  <b>Do not</b> use the
<code>NextToken</code> response element directly outside of the
AWS CLI.</p>
<p>For usage examples, see <a
href="https://docs.aws.amazon.com/cli/latest/userguide/pagination.html"
>Pagination</a> in the <i>AWS Command Line Interface User
Guide</i>.</p>
a�
<p>The size of each page to get in the AWS service call.  This
does not affect the number of items returned in the command's
output.  Setting a smaller page size results in more calls to
the AWS service, retrieving fewer items in each call.  This can
help prevent the AWS service calls from timing out.</p>
<p>For usage examples, see <a
href="https://docs.aws.amazon.com/cli/latest/userguide/pagination.html"
>Pagination</a> in the <i>AWS Command Line Interface User
Guide</i>.</p>
cCs|�dt�|�dt�dS)Nzbuilding-argument-tablezdoc-description)�register�unify_paging_paramsZ
register_last�add_paging_description)Zevent_handlers�r�@/usr/lib/python3/dist-packages/awscli/customizations/paginate.py�register_paginationLsr
cCsPz|�|�}Wntk
r$YdSXz|�|�}Wntk
rJYdSX|S�N)Zget_paginator_modelrZ
get_paginator�
ValueError)�session�service_nameZoperation_nameZpaginator_modelZoperation_paginator_configrrr�get_paginator_configQs�rcKs�t|jtj�sdS|jjj}t|j||jj�}|s6dS|j	j
��|j	�d|j�|�
d�r�|d}t|�tk	rx|g}d�dd�|D��}|j	�d|�dS)Nz�``%s`` is a paginated operation. Multiple API calls may be issued in order to retrieve the entire data set of results. You can disable pagination by providing the ``--no-paginate`` argument.Z
result_key�, cSsg|]}d|�qS)z``%s``r)�.0�srrr�
<listcomp>ssz*add_paging_description.<locals>.<listcomp>z�When using ``--output text`` and the ``--query`` argument on a paginated response, the ``--query`` argument must extract data from the results of the following query expressions: %s)�
isinstance�objrZOperationModel�
service_modelrrr�name�docZstyleZ
new_paragraphZwriteln�get�type�list�join)Zhelp_command�kwargsr�paginator_configZqueriesrrrr
^s4
���
��r
c	Ks�t||jj|j�}|dkrdSt�d|j�t||�|�dd�}i}t|dt	dt
ddd�|�|jj}d}	d	|kr�||d	}
|
j
}	|	t	jkr�td
�|	|j|d	���t|dt	dt|	dd�|�t|d
t	d
t|	dd�|�|�|tttt|��||��dS)Nz-Modifying paging parameters for operation: %szbuilding-argument-table.zoperation-args-parsed.zstarting-token�stringZ
StartingToken)�
parse_type�serialized_name�integer�	limit_keyzCUnsupported pagination type {0} for operation {1} and parameter {2}z	page-sizeZPageSizez	max-itemsZMaxItems)rrrr�logger�debug�!_remove_existing_paging_arguments�replace�add_paging_argument�PageArgument�STARTING_TOKEN_HELPZinput_shape�members�	type_name�type_map�	TypeError�format�PAGE_SIZE_HELP�MAX_ITEMS_HELPrr�check_should_enable_paginationr�_get_all_cli_input_tokens)�argument_tableZoperation_modelZ
event_namerr r!Zparsed_args_event�
shadowed_argsZ
input_membersr/Zlimit_key_shaperrrr	{sr��
���
������
��r	cCs ||kr||||<|||<dSrr)r7Zarg_nameZargumentr8rrrr+�sr+cKsrddg}|D]6}|�dd�}t||�dk	r||krt�d�d|_q|jsnt||�|��D]\}	}
|
||	<q\dS)NZstart_token�	max_items�-�_zPUser has specified a manual pagination arg. Automatically setting --no-paginate.F)r*�getattrr'r(Zpaginate�ensure_paging_params_not_set�items)Zinput_tokensr8r7�parsed_argsZparsed_globalsr Znormalized_paging_args�token�py_name�key�valuerrrr5�s�

	r5csbdddg}dd�|��D����fdd�|D�}t|�dkr^d�d	d�|D��}td
|d��dS)NZstarting_tokenZ	page_sizer9cSsg|]}|�dd��qS)r:r;�r*�r�prrrr�sz0ensure_paging_params_not_set.<locals>.<listcomp>cs$g|]}|�krt�|d�r|�qSr)r<rE�r?Zshadowed_paramsrrr�s�rrcSsg|]}d|�dd��qS)�--r;r:rDrErrrr�sz@Cannot specify --no-paginate along with pagination arguments: %s)�message)�keys�lenrr)r?r8Z
paging_paramsZparams_usedZconverted_paramsrrGrr=�s
���r=cCst|�D]}d||_qdS)NT)r6Z
_UNDOCUMENTED)r7�pagination_config�cli_namerrrr)�sr)ccsFt|�}|D]}t|d�}|Vqd|krB|d}t|d�}|VdS)Nr:r&)�_get_input_tokensr)rL�tokens�
token_namerMZkey_namerrrr6�s

r6cCs|d}t|t�s|gS|S)NZinput_token)rr)rLrOrrrrN�s
rNcCs(|D]}|j|kr|j�d�SqdS)Nr:)rrM�lstrip)Z
param_objectsrPZparamrrr�
_get_cli_name�s
rRc@sneZdZeeed�Zdd�Zedd��Zedd��Z	edd	��Z
e
jd
d	��Z
edd��Zd
d�Z
dd�ZdS)r,)r"r%ZlongcCs4t�dddi�|_||_||_||_||_d|_dS)Nr,rr"F)rZShapeZargument_model�_name�_serialized_name�_documentation�_parse_type�	_required)�selfr�
documentationr#r$rrr�__init__szPageArgument.__init__cCs
d|jS)NrH)rS�rXrrrrM
szPageArgument.cli_namecCs|jSr)rVr[rrr�
cli_type_nameszPageArgument.cli_type_namecCs|jSr�rWr[rrr�requiredszPageArgument.requiredcCs
||_dSrr])rXrCrrrr^scCs|jSr)rUr[rrrrYszPageArgument.documentationcCs |j|j|j|j|jd�dS)N)�destr)�add_argumentrMrAr0rV)rX�parserrrr�
add_to_parser!s
�zPageArgument.add_to_parsercCs*|dk	r&|�di�}|||j<||d<dS)NZPaginationConfig)rrT)rXZ
parametersrCrLrrr�
add_to_params%s
zPageArgument.add_to_paramsN)�__name__�
__module__�__qualname__�str�intr0rZ�propertyrMr\r^�setterrYrbrcrrrrr,�s"�




r,)�__doc__Zlogging�	functoolsrZbotocorerZbotocore.exceptionsrrrZawscli.argumentsrZ	getLoggerrdr'r-r4r3r
rr
r	r+r5r=r)r6rNrRr,rrrr�<module>
s,

	

0