HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/awscli/customizations/__pycache__/paginate.cpython-310.pyc
o

.&�a�.�@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_params�
register_last�add_paging_description)�event_handlers�r
�@/usr/lib/python3/dist-packages/awscli/customizations/paginate.py�register_paginationLsrcCsJz|�|�}Wn
tyYdSwz|�|�}W|Sty$YdSw�N)�get_paginator_modelr�
get_paginator�
ValueError)�session�service_name�operation_name�paginator_model�operation_paginator_configr
r
r�get_paginator_configQs����rcKs�t|jtj�s	dS|jjj}t|j||jj�}|sdS|j	j
��|j	�d|j�|�
d�rP|d}t|�tur<|g}d�dd�|D��}|j	�d|�dSdS)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.�
result_key�, cSsg|]}d|�qS)z``%s``r
)�.0�sr
r
r�
<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�objr�OperationModel�
service_modelrrr�name�doc�style�
new_paragraph�writeln�get�type�list�join)�help_command�kwargsr�paginator_config�queriesr
r
rr^s2
���
���rc	Ks�t||jj|j�}|durdSt�d|j�t||�|�dd�}i}t|dt	dt
ddd�|�|jj}d}	d	|vra||d	}
|
j
}	|	t	jvrTtd
�|	|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�string�
StartingToken)�
parse_type�serialized_name�integer�	limit_keyzCUnsupported pagination type {0} for operation {1} and parameter {2}z	page-size�PageSizez	max-items�MaxItems)rr"rr#�logger�debug�!_remove_existing_paging_arguments�replace�add_paging_argument�PageArgument�STARTING_TOKEN_HELP�input_shape�members�	type_name�type_map�	TypeError�format�PAGE_SIZE_HELP�MAX_ITEMS_HELPrr�check_should_enable_paginationr*�_get_all_cli_input_tokens)�argument_table�operation_model�
event_namerr-r.�parsed_args_event�
shadowed_args�
input_membersrA�limit_key_shaper
r
rr	{sn��
���
������
��r	cCs ||vr
||||<|||<dSrr
)rI�arg_name�argumentrMr
r
rr<�sr<cKsvddg}|D]}|�dd�}t||�dur!||vr!t�d�d|_q|js7t||�|��D]
\}	}
|
||	<q.dSdS)N�start_token�	max_items�-�_zPUser has specified a manual pagination arg. Automatically setting --no-paginate.F)r;�getattrr8r9�paginate�ensure_paging_params_not_set�items)�input_tokensrMrI�parsed_args�parsed_globalsr-�normalized_paging_args�token�py_name�key�valuer
r
rrG�s
�
	
�
rGcs`gd�}dd�|��D����fdd�|D�}t|�dkr.d�dd�|D��}td|d	��dS)
N)�starting_token�	page_sizerScSsg|]}|�dd��qS)rTrU�r;�r�pr
r
rr�sz0ensure_paging_params_not_set.<locals>.<listcomp>cs$g|]}|�vrt�|d�r|�qSr)rVre�r[�shadowed_paramsr
rr�s�rrcSsg|]
}d|�dd��qS)�--rUrTrdrer
r
rr�sz@Cannot specify --no-paginate along with pagination arguments: %s)�message)�keys�lenr+r)r[rM�
paging_params�params_used�converted_paramsr
rgrrX�s����rXcCst|�D]}d||_qdS)NT)rH�
_UNDOCUMENTED)rI�pagination_config�cli_namer
r
rr:�s�r:ccsL�t|�}|D]
}t|d�}|Vqd|vr$|d}t|d�}|VdSdS)NrTr5)�_get_input_tokensr)rq�tokens�
token_namerr�key_namer
r
rrH�s�


�rHcCs|d}t|t�s|gS|S)N�input_token)rr*)rqrtr
r
rrs�s
rscCs(|D]}|j|kr|j�d�SqdS)NrT)r#rr�lstrip)�
param_objectsru�paramr
r
r�
_get_cli_name�s

��r{c@sneZdZeeed�Zdd�Zedd��Zedd��Z	edd	��Z
e
jd
d	��Z
edd��Zd
d�Z
dd�ZdS)r=)r0r4�longcCs4t�dddi�|_||_||_||_||_d|_dS)Nr=r)r0F)r�Shape�argument_model�_name�_serialized_name�_documentation�_parse_type�	_required)�selfr#�
documentationr2r3r
r
r�__init__s
zPageArgument.__init__cCs
d|jS)Nri)r�r�r
r
rrr
�
zPageArgument.cli_namecC�|jSr)r�r�r
r
r�
cli_type_name�zPageArgument.cli_type_namecCr�r�r�r�r
r
r�requiredr�zPageArgument.requiredcCs
||_dSrr�)r�rar
r
rr�r�cCr�r)r�r�r
r
rr�r�zPageArgument.documentationcCs |j|j|j|j|jd�dS)N)�destr))�add_argumentrrr_rBr�)r��parserr
r
r�
add_to_parser!s

�zPageArgument.add_to_parsercCs.|dur|�di�}|||j<||d<dSdS)N�PaginationConfig)r(r�)r��
parametersrarqr
r
r�
add_to_params%s

�zPageArgument.add_to_paramsN)�__name__�
__module__�__qualname__�str�intrBr��propertyrrr�r��setterr�r�r�r
r
r
rr=�s$�




r=)�__doc__�logging�	functoolsr�botocorer�botocore.exceptionsrrr�awscli.argumentsr�	getLoggerr�r8r>rFrErrrr	r<rGrXr:rHrsr{r=r
r
r
r�<module>s.

	

0