File: //lib/python3.6/site-packages/awscli/__pycache__/argprocess.cpython-36.pyc
3
�T_�Q � @ s4 d Z ddlZddlZddlmZ ddlmZmZ ddlm Z m
Z
ddlmZ ddlm
Z
ddlmZ ejd �ZG d
d� de�ZG dd
� d
e�ZG dd� de�ZG dd� de�Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd-d#d$�Zd%d&� Z G d'd(� d(e!�Z"G d)d*� d*e"�Z#G d+d,� d,e"�Z$dS ).zModule for processing CLI args.� N)�six)�OrderedDict�json)�SCALAR_TYPES�
COMPLEX_TYPES)� shorthand)�%find_service_and_method_in_event_name)�is_json_value_headerzawscli.argprocessc s e Zd Z� fdd�Z� ZS )�
ParamErrorc s, d||f }t t| �j|� || _|| _dS )aB
:type cli_name: string
:param cli_name: The complete cli argument name,
e.g. "--foo-bar". It should include the leading
hyphens if that's how a user would specify the name.
:type message: string
:param message: The error message to display to the user.
z Error parsing parameter '%s': %sN)�superr
�__init__�cli_name�message)�selfr
r �full_message)� __class__� � /usr/lib/python3.6/argprocess.pyr s
zParamError.__init__)�__name__�
__module__�__qualname__r �
__classcell__r r )r r r
s r
c @ s e Zd ZdS )�ParamSyntaxErrorN)r r r r r r r r 0 s r c s e Zd Z� fdd�Z� ZS )�ParamUnknownKeyErrorc s* dj |�}d||f }tt| �j|� d S )Nz, z'Unknown key '%s', valid choices are: %s)�joinr r r )r �keyZ
valid_keysr )r r r r 5 s
zParamUnknownKeyError.__init__)r r r r r r r )r r r 4 s r c @ s e Zd ZdS )�TooComplexErrorN)r r r r r r r r = s r c C s: t |dd�}| jd|||f ||||d�}|dk r6|}|S )a
Unpack an argument's value from the commandline. This is part one of a two
step process in handling commandline arguments. Emits the load-cli-arg
event with service, operation, and parameter names. Example::
load-cli-arg.ec2.describe-instances.foo
�nameZ anonymouszload-cli-arg.%s.%s.%s)�param�value�service_name�operation_nameN)�getattrZemit_first_non_none_response)Zsessionr r! �cli_argumentr Z
param_nameZvalue_overrider r r �unpack_argumentA s r$ c C s g }t | |�S )N)�_detect_shape_structure)r �stackr r r �detect_shape_structureY s r'