HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/awscli/customizations/__pycache__/paginate.cpython-36.opt-1.pyc
3

�T_�.�@s�dZddlZddlmZddlmZddlmZmZddlm	Z	ddl
mZej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|jdt�|jdt�dS)Nzbuilding-argument-tablezdoc-description)�register�unify_paging_paramsZ
register_last�add_paging_description)Zevent_handlers�r�/usr/lib/python3.6/paginate.py�register_paginationLsr
cCsLy|j|�}Wntk
r"dSXy|j|�}Wntk
rFdSX|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�|j	jd|j�|j
d�r�|d}t|�tk	rx|g}djdd�|D��}|j	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_keyz, 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
^s&


r
c	Ks�t||jj|j�}|dkrdStjd|j�t||�|jdd�}i}t|dt	dt
ddd�|�|jj}d}	d	|kr�||d	}
|
j
}	|	t	jkr�td
j|	|j|d	���t|dt	dt|	dd�|�t|d
t	d
t|	dd�|�|j|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_namerrrZparsed_args_event�
shadowed_argsZ
input_membersr-Zlimit_key_shaperrrr	{sR


r	cCs ||kr||||<|||<dS)Nr)r5Zarg_nameZargumentr6rrrr)�sr)cKszddg}x>|D]6}|jdd�}t||�dk	r||krtjd�d|_qW|jsvt||�x|j�D]\}	}
|
||	<qbWdS)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_tokensr6r5�parsed_argsZparsed_globalsrZnormalized_paging_args�token�py_name�key�valuerrrr3�s



	r3csbdddg}dd�|j�D����fdd�|D�}t|�dkr^djd	d�|D��}td
|d��dS)NZstarting_tokenZ	page_sizer7cSsg|]}|jdd��qS)r8r9)r()r�prrrr�sz0ensure_paging_params_not_set.<locals>.<listcomp>cs$g|]}|�krt�|d�r|�qS)N)r:)rrB)r=�shadowed_paramsrrr�srz, cSsg|]}d|jdd��qS)z--r9r8)r()rrBrrrr�sz@Cannot specify --no-paginate along with pagination arguments: %s)�message)�keys�lenrr)r=r6Z
paging_paramsZparams_usedZconverted_paramsr)r=rCrr;�s
r;cCs xt|�D]}d||_q
WdS)NT)r4Z
_UNDOCUMENTED)r5�pagination_config�cli_namerrrr'�sr'ccsJt|�}x|D]}t|d�}|VqWd|krF|d}t|d�}|VdS)Nr8r$)�_get_input_tokensr)rG�tokens�
token_namerHZkey_namerrrr4�s



r4cCs|d}t|t�s|gS|S)NZinput_token)rr)rGrJrrrrI�s
rIcCs(x"|D]}|j|kr|jjd�SqWdS)Nr8)rrH�lstrip)Z
param_objectsrKZparamrrr�
_get_cli_name�s

rMc@sneZdZeeed�Zdd�Zedd��Zedd��Z	edd	��Z
e
jd
d	��Z
edd��Zd
d�Z
dd�ZdS)r*)r r#ZlongcCs4tjdddi�|_||_||_||_||_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)Nz--)rN)rSrrrrH
szPageArgument.cli_namecCs|jS)N)rQ)rSrrr�
cli_type_nameszPageArgument.cli_type_namecCs|jS)N)rR)rSrrr�requiredszPageArgument.requiredcCs
||_dS)N)rR)rSrArrrrWscCs|jS)N)rP)rSrrrrTszPageArgument.documentationcCs |j|j|j|j|jd�dS)N)�destr)�add_argumentrHr?r.rQ)rS�parserrrr�
add_to_parser!szPageArgument.add_to_parsercCs*|dk	r&|jdi�}|||j<||d<dS)NZPaginationConfig)rrO)rSZ
parametersrArGrrr�
add_to_params%s
zPageArgument.add_to_paramsN)�__name__�
__module__�__qualname__�str�intr.rU�propertyrHrVrW�setterrTr[r\rrrrr*�sr*)�__doc__Zlogging�	functoolsrZbotocorerZbotocore.exceptionsrrrZawscli.argumentsrZ	getLoggerr]r%r+r2r1r
rr
r	r)r3r;r'r4rIrMr*rrrr�<module>s,


0