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__/arguments.cpython-310.pyc
o

.&�a�@s`ddlZddlmZddlZdd�Zdd�ZGdd�de�ZGd	d
�d
e�ZGdd�de�ZdS)
�N)�CustomArgumentcCsN|durdStj�tj�|��}t�tj�tj�|��tj�s%td|��|S)z=Asserts that a path is writable and returns the expanded pathNzUnable to write to file: %s)	�os�path�
expanduser�
expandvars�access�dirname�abspath�W_OK�
ValueError)r�outfile�r
�A/usr/lib/python3/dist-packages/awscli/customizations/arguments.py�resolve_given_outfile_pathsrcCs|dddkS)z-Returns True if a parsed result is successful�ResponseMetadata�HTTPStatusCodei,r
)�
parsed_resultr
r
r�is_parsed_result_successfulsrcs8eZdZdZddiZ�fdd�Zdd�Zdd	�Z�ZS)
�OverrideRequiredArgsArgumenta�An argument that if specified makes all other arguments not required

    By not required, it refers to not having an error thrown when the
    parser does not find an argument that is required on the command line.
    To obtain this argument's property of ignoring required arguments,
    subclass from this class and fill out the ``ARG_DATA`` parameter as
    described below. Note this class is really only useful for subclassing.
    �namezno-required-argscs*||_|��tt|�jdi|j��dS)Nr
)�_session�_register_argument_action�superr�__init__�ARG_DATA)�self�session��	__class__r
rr7sz%OverrideRequiredArgsArgument.__init__cCs|j�d|j�dS)Nz%before-building-argument-table-parser)r�register�override_required_args�rr
r
rr<s�z6OverrideRequiredArgsArgument._register_argument_actioncKs2d|j}||vr|��D]	}d||_q
dSdS)Nz--F)r�keys�required)r�argument_table�args�kwargs�name_in_cmdline�arg_namer
r
rr @s
�z3OverrideRequiredArgsArgument.override_required_args)	�__name__�
__module__�__qualname__�__doc__rrrr �
__classcell__r
r
rrr!srcs8eZdZdZ�fdd�Z�fdd�Zedd��Z�ZS)�StatefulArgumentz+An argument that maintains a stateful valuecs tt|�j|i|��d|_dS�N)rr.r�_value)rr%r&rr
rrLs
zStatefulArgument.__init__cstt|��||�||_dSr/)rr.�
add_to_paramsr0�r�
parameters�valuerr
rr1Ps
zStatefulArgument.add_to_paramscC�|jSr/)r0r!r
r
rr4T�zStatefulArgument.value)	r)r*r+r,rr1�propertyr4r-r
r
rrr.Isr.csLeZdZdZ�fdd�Zedd��Zedd��Z�fdd	�Zd
d�Z	�Z
S)�QueryOutFileArgumentz8An argument that write a JMESPath query result to a filecsP||_||_||_||_d|vrd|j|d<tt|�j|g|�Ri|��dS)N�	help_textz=Saves the command output contents of %s to the given filename)r�_query�_after_call_event�_perm�queryrr8r)rrrr=�after_call_event�permr%r&rr
rr\s�"zQueryOutFileArgument.__init__cCr5r/)r:r!r
r
rr=hr6zQueryOutFileArgument.querycCr5r/)r<r!r
r
rr?lr6zQueryOutFileArgument.permcs>t|�}tt|��||�|jdur|j�|j|j�dSdSr/)	rrr8r1r4rrr;�
save_queryr2rr
rr1ps

�z"QueryOutFileArgument.add_to_paramscKszt|�r;t�|j|�}t|jd�� }|dur|�d�n|�|�t�|j|j	�Wd�dS1s4wYdSdS)z�Saves the result of a JMESPath expression to a file.

        This method only saves the query data if the response code of
        the parsed result is < 300.
        �wN�)
r�jmespath�searchr=�openr4�writer�chmodr?)r�parsedr&�contents�fpr
r
rr@ws
"��zQueryOutFileArgument.save_query)r)r*r+r,rr7r=r?r1r@r-r
r
rrr8Ys

r8)	r�awscli.argumentsrrCrrrr.r8r
r
r
r�<module>s
(