o
    "`^h                     @   s  d dl Z d dlmZmZ d dlmZ d dlmZmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ d d	lmZmZmZ d d
lmZmZ d dlmZmZmZmZmZ d dlmZ d dl m!Z! d dl"m#Z#m$Z$ d dl%m&Z& d dl'm(Z( d dl)m*Z*m+Z+ d dl,m-Z- d dl.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5 d dlm6Z6 d dl.m7Z7 d dl.m8Z8 d dl.m9Z9 d dl.m:Z: d dl.m;Z; d dlm<Z< e=dZ>e ?e@ZAe ZBG dd dZCG dd dZDG d d! d!ZEG d"d# d#ZFd$d% ZGdS )&    N)waiter
xform_name)ClientArgsCreator)AUTH_TYPE_MAPSresolve_auth_type)prepare_request_dict)maybe_compress_request)Config)RefreshableCredentials)EndpointDiscoveryHandlerEndpointDiscoveryManager,block_endpoint_discovery_required_operations)ClientMethodDocstringPaginatorDocstring)DataNotFoundError*InvalidEndpointDiscoveryConfigurationErrorOperationNotPageableErrorUnknownServiceErrorUnknownSignatureVersionError)get_global_history_recorder)first_non_none_response)apply_request_checksumresolve_checksum_context)ServiceModel)	Paginator)adaptivestandard)UserAgentString)CachedPropertyEventbridgeSignerSetterS3ControlArnParamHandlerv2S3ExpressIdentityResolverS3RegionRedirectorv2ensure_booleanget_service_module_name)ClientError)S3ArnParamHandler)S3ControlArnParamHandler)S3ControlEndpointSetter)S3EndpointSetter)S3RegionRedirector)UNSIGNED)v2v3v3httpsv4s3s3v4c                   @   s  e Zd ZdZ				d:ddZ								d;ddZd<dd	Zd
d Zdd Zd<ddZ	d<ddZ
dd Zdd Zdd Zdd Zdd Zdd Zdd Zd d! Zd"d# Zd$d% Z				d:d&d'Zd(d) Z				d:d*d+Zd,d- Zd.d/ Zd0d1 Zd2d3 Zd4d5 Zd6d7 Zd8d9 ZdS )=ClientCreatorz%Creates client objects for a service.Nc                 C   s@   || _ || _|| _|| _|| _|| _|| _|| _|	| _|
| _	d S N)
_loader_endpoint_resolver_user_agent_event_emitter_retry_handler_factory_retry_config_translator_response_parser_factory_exceptions_factory_config_store_user_agent_creator)selfloaderendpoint_resolver
user_agentevent_emitterretry_handler_factoryretry_config_translatorresponse_parser_factoryexceptions_factoryconfig_storeuser_agent_creator rI   M/home/air/shanriGPT/back/venv/lib/python3.10/site-packages/botocore/client.py__init__W   s   
zClientCreator.__init__Tc                 C   sD  | j jd|d}t||d}| ||}z| ||}| jd}W n ty5   d }d }t	d| Y nw | 
||}| ||	\}}	|jd }rQt|}n|jd}t| j||	|jd| j|d	}| ||||||||	||
||}|di |}| | | j|d d |	|d
 | j|d | j|d | |||	 |S )Nzchoose-service-nameservice_namedefault
partitionszSNo endpoints ruleset found for service %s, falling back to legacy endpoint routing.authsignatureVersionsigningName)service_signing_namerG   service_signature_version)clientendpoint_bridgeendpoint_urlclient_configscoped_configrV   rI   )r7   emitr   _load_service_model_load_service_endpoints_rulesetr4   	load_datar   loggerinfo_create_client_class_normalize_fips_regionmetadatagetr   ClientEndpointBridger5   r<   _get_client_args_register_retries_register_s3_events_register_s3express_events_register_s3_control_events_register_endpoint_discovery)r>   rM   region_name	is_securerX   verifycredentialsrZ   api_versionrY   
auth_token	responsesservice_modelendpoints_ruleset_datapartition_dataclsrQ   rU   rW   client_argsservice_clientrI   rI   rJ   create_clients   s   	


zClientCreator.create_clientc                 C   s   |  ||}| ||S r3   )r]   rb   )r>   rM   rq   rt   rI   rI   rJ   create_client_class   s   z!ClientCreator.create_client_classc           	      C   sd   |  |}| |}||d< tg}|j }| jjd| ||d t|}tt	|t
||}|S )N_PY_TO_OP_NAMEzcreating-client-class.)class_attributesbase_classes)_create_methods_create_name_mapping
BaseClient
service_id	hyphenizer7   r\   r$   typestrtuple)	r>   rM   rt   r}   py_name_to_operation_namebasesr   
class_namerw   rI   rI   rJ   rb      s   


z"ClientCreator._create_client_classc                 C   sf   |d ur/| dd dd}||kr/tdd}|r||}n|}td| d| d |}||fS )	Nzfips- z-fipsT)use_fips_endpointztransforming region from z to zb and setting use_fips_endpoint to true. client should not be configured with a fips psuedo region.)replacer	   merger`   warning)r>   rm   rY   normalized_region_nameconfig_use_fips_endpointrI   rI   rJ   rc      s$   
z$ClientCreator._normalize_fips_regionc                 C   s"   | j j|d|d}t||d}|S )Nz	service-2rq   rL   )r4   load_service_modelr   )r>   rM   rq   
json_modelrt   rI   rI   rJ   r]      s
   z!ClientCreator._load_service_modelc                 C   s   | j j|d|dS )Nzendpoint-rule-set-1r   )r4   r   )r>   rM   rq   rI   rI   rJ   r^      s   z-ClientCreator._load_service_endpoints_rulesetc                 C   s^   |j jjd }|dkr| | d S |dkr"| | | | d S |dkr-| | d S d S )Nmoder   r   legacy)metaconfigretries_register_v2_standard_retries_register_v2_adaptive_retries_register_legacy_retries)r>   rV   
retry_moderI   rI   rJ   rh      s   
zClientCreator._register_retriesc                 C   s<   |j jjd}d|i}|d ur||d< tjdi | d S )Ntotal_max_attemptsrV   max_attemptsrI   )r   r   r   re   r   register_retry_handler)r>   rV   r   kwargsrI   rI   rJ   r     s
   z+ClientCreator._register_v2_standard_retriesc                 C   s   t | d S r3   )r   r   )r>   rV   rI   rI   rJ   r     s   z+ClientCreator._register_v2_adaptive_retriesc           
      C   s   |j jj}|j jj}| }| jd}|sd S | |j jj	}| j
||di |di |}td|j jj | j||}d| }	|j jjd| ||	d d S )N_retryretrydefinitionsz*Registering retry handlers for service: %szretry-config-zneeds-retry.)	unique_id)r   rt   endpoint_prefixr   r   r4   r_   _transform_legacy_retriesr   r   r9   build_retry_configre   r`   debugrM   r8   create_retry_handlereventsregister)
r>   rV   r   r   service_event_nameoriginal_configr   retry_confighandlerr   rI   rI   rJ   r     s0   





z&ClientCreator._register_legacy_retriesc                 C   s:   |d u rd S |  }d|v r|  }|dd |d< |S )Nr      r   )copypop)r>   r   copied_argsrI   rI   rJ   r   -  s   z'ClientCreator._transform_legacy_retriesc                 C   s6   |j jj}|d ur|dd ur|d S |dpdS )Nr   r   r   )r   r   r   re   get_config_variable)r>   rV   rG   client_retriesrI   rI   rJ   _get_retry_mode8  s
   
zClientCreator._get_retry_modec           
      C   s   |d urd S |j jjd u rd S |j j}|j jj }d}|r'|jd ur'|j}n	| jr0| jd}| 	|}|rS| 
||rS|du }t||d}t|}	|	|| d S |dt d S )NFendpoint_discovery_enabledT)always_discoverzbefore-parameter-build)r   rt   endpoint_discovery_operationr   r   r   r   r<   r   $_normalize_endpoint_discovery_config_requires_endpoint_discoveryr   r   r   r   )
r>   rV   rX   r   r   r   enableddiscovermanagerr   rI   rI   rJ   rl   A  s2   
z*ClientCreator._register_endpoint_discoveryc                 C   sL   t |tr|  }|dkr|S |dv rt|S nt |tr!|S t|d)z?Config must either be a boolean-string or string-literal 'auto'auto)truefalse)config_value)
isinstancer   lowerstripr#   boolr   )r>   r   rI   rI   rJ   r   `  s   


z2ClientCreator._normalize_endpoint_discovery_configc                 C   s   |dkr	|j jjS |S )Nr   )r   rt   endpoint_discovery_required)r>   rV   r   rI   rI   rJ   r   m  s   
z*ClientCreator._requires_endpoint_discoveryc                 C   s4   |j jjdkr	d S t| j|j j|d|j j d S )Nr   )r@   regionrX   )r   rt   rM   r   r5   rm   r   r   )r>   rV   rW   rX   rI   rI   rJ   _register_eventbridge_eventsr  s   z*ClientCreator._register_eventbridge_eventsc                 C   s$   |j jjdkr	d S t|t  d S )Nr0   )r   rt   rM   r!   r
   r   r>   rV   rW   rX   rY   rZ   rI   rI   rJ   rj   }  s   z(ClientCreator._register_s3express_eventsc                 C   sF   |j jjdkr	d S td |  | |j || |j jd| j d S )Nr0   zbefore-parameter-build.s3)r   rt   rM   r"   r   !_set_s3_presign_signature_versionr   _inject_s3_input_parametersr   rI   rI   rJ   ri     s   z!ClientCreator._register_s3_eventsc                 C   s&   |j jjdkr	d S t |j j d S )N	s3control)r   rt   rM   r    r   r   r   rI   rI   rJ   rk     s   z)ClientCreator._register_s3_control_eventsc                 C   sx   t d||}|d urd S | jd|j}|jdkr |j|vr d S | jd|j}|d }d|vr2d S |jd| j d S )Nr0   z
aws-globalsignatureVersionszchoose-signer.s3)	!_get_configured_signature_versionr5   get_available_endpoints	partitionrm   construct_endpointr   r   _default_s3_presign_to_sigv2)r>   client_metarY   rZ   provided_signature_versionregionsendpointsignature_versionsrI   rI   rJ   r     s(   

z/ClientCreator._set_s3_presign_signature_versionc                 K   s2   i |d< d}|D ]}||v r|| |d |< qd S )Ninput_params)BucketDeleteKeyPrefixrI   )r>   paramscontextr   inject_parametersinject_parameterrI   rI   rJ   r     s   z)ClientCreator._inject_s3_input_parametersc                 K   sB   | drdS | dr|S dD ]}||rd|   S qdS )a@  
        Returns the 's3' (sigv2) signer if presigning an s3 request. This is
        intended to be used to set the default signature version for the signer
        to sigv2. Situations where an asymmetric signature is required are the
        exception, for example MRAP needs v4a.

        :type signature_version: str
        :param signature_version: The current client signature version.

        :type signing_name: str
        :param signing_name: The signing name of the service.

        :return: 's3' if the request is an s3 presign request, None otherwise
        v4aNzv4-s3express)z-queryz-presign-postr0   )
startswithendswith)r>   signature_versionr   suffixrI   rI   rJ   r     s   


z*ClientCreator._default_s3_presign_to_sigv2c                 C   sD   t | j| j| j| j| j| j| jd}||||||||||	|
||S )N)rG   rH   )	r   r7   r6   r:   r4   r;   r<   r=   get_client_args)r>   rt   rm   rn   rX   ro   rp   rZ   rY   rW   rr   ru   rv   args_creatorrI   rI   rJ   rg     s.   	zClientCreator._get_client_argsc                 C   s.   i }|j D ]}t|}| |||||< q|S r3   )operation_namesr   _create_api_method)r>   rt   op_dictoperation_namepy_operation_namerI   rI   rJ   r     s   

zClientCreator._create_methodsc                 C   s$   i }|j D ]
}t|}|||< q|S r3   )r   r   )r>   rt   mappingr   r   rI   rI   rJ   r   $  s
   

z"ClientCreator._create_name_mappingc                    sJ    fdd}t |_| }t| | j|jd dd}||_|S )Nc                    s   |r	t  d|  |S )Nz"() only accepts keyword arguments.)	TypeError_make_api_call)r>   argsr   r   r   rI   rJ   	_api_call0  s
   z3ClientCreator._create_api_method.<locals>._api_callzresponse = client.F)operation_modelmethod_namerB   method_descriptionexample_prefixinclude_signature)r   __name__r   r   r7   documentation__doc__)r>   r   r   rt   r   r   	docstringrI   r   rJ   r   -  s   

z ClientCreator._create_api_method)NNNN)TNNNNNNNr3   )r   
__module____qualname__r   rK   rz   r{   rb   rc   r]   r^   rh   r   r   r   r   r   rl   r   r   r   rj   ri   rk   r   r   r   rg   r   r   r   rI   rI   rI   rJ   r2   T   sb    

 

P


	

+	'		r2   c                   @   s   e Zd ZdZdZddgZ						d#ddZ	d$d	d
Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" ZdS )%rf   a  Bridges endpoint data and client creation

    This class handles taking out the relevant arguments from the endpoint
    resolver and determining which values to use, taking into account any
    client configuration options and scope configuration options.

    This class also handles determining what, if any, region to use if no
    explicit region setting is provided. For example, Amazon S3 client will
    utilize "us-east-1" by default if no region can be resolved.z {service}.{region}.amazonaws.comr0   z
s3-controlNc                 C   s4   || _ || _|| _|| _|p| j| _|| _|| _d S r3   )rT   r@   rZ   rY   DEFAULT_ENDPOINTdefault_endpointrG   rU   )r>   r@   rZ   rY   r   rT   rG   rU   rI   rI   rJ   rK   Y  s   

zClientEndpointBridge.__init__Tc                 C   st   |  ||}| |}| d}| jj||||d}|s'| jj||d||d}|r2| |||||S | ||||S )Nr   )use_dualstack_endpointr   aws)partition_namer  r   )_check_default_region_resolve_use_dualstack_endpoint$_resolve_endpoint_variant_config_varr@   r   _create_endpoint_assume_endpoint)r>   rM   rm   rX   rn   r  r   resolvedrI   rI   rJ   resolvek  s8   	
zClientEndpointBridge.resolvec                 C      | j jS r3   )r@   uses_builtin_datar>   rI   rI   rJ   resolver_uses_builtin_data  s   z/ClientEndpointBridge.resolver_uses_builtin_datac                 C   s.   |d ur|S | j r| j jd ur| j jS d S d S r3   )rY   rm   )r>   rM   rm   rI   rI   rJ   r    s
   z*ClientEndpointBridge._check_default_regionc           	   	   C   sf   |  |||\}}|d u r| |d||dg }| ||}| ||}| j|||||||dS )Nhostname	protocols)rM   rm   signing_regionsigning_namerX   rd   r   )_pick_region_values	_make_urlre   _resolve_signature_version_resolve_signing_name_create_result)	r>   r	  rM   rm   rX   rn   r  r   r  rI   rI   rJ   r    s,   
z%ClientEndpointBridge._create_endpointc                 C   s@   | j }d}|rt||d urt||S | jd ur| j|}|S )NF)rY   getattrrG   r   )r>   
config_varrY   
config_valrI   rI   rJ   r    s   

z9ClientEndpointBridge._resolve_endpoint_variant_config_varc                 C   s    |  |}|d ur|S | dS )Nr  )_is_s3_dualstack_moder  )r>   rM   s3_dualstack_moderI   rI   rJ   r    s   
z4ClientEndpointBridge._resolve_use_dualstack_endpointc                 C   sl   || j vrd S | j}|d ur|jd urd|jv r|jd S | jd ur2| jdi d}|dv r4dS d S d S )Nr  r0   )TTruer   T)_DUALSTACK_CUSTOMIZED_SERVICESrY   r0   rZ   re   )r>   rM   rY   r   rI   rI   rJ   r    s   




z*ClientEndpointBridge._is_s3_dualstack_modec              	   C   s~   |d u r| j j||d}| ||ddg}td| d| d|  | |ddgi}| j|i d	}| j||||||i d
S )N)servicer   httphttpszAssuming an endpoint for z, z: r   r/   )r	  )rM   rm   r  r  r   rX   rd   )r   formatr  r`   r   r  r  r  )r>   rM   rm   rX   rn   r  r   r  rI   rI   rJ   r    s.   

z%ClientEndpointBridge._assume_endpointc                 C   s   |||||||dS )N)rM   rm   r  r  rX   r   rd   rI   )r>   rM   rm   r  r  rX   r   rd   rI   rI   rJ   r    s   z#ClientEndpointBridge._create_resultc                 C   s$   |r	d|v r	d}nd}| d| S )Nr!  r   z://rI   )r>   r  rn   supported_protocolsschemerI   rI   rJ   r    s   zClientEndpointBridge._make_urlc                 C   s0   d|v rd|d v r|d d S | j r| j S |S )NcredentialScoper  )rT   )r>   rM   r	  rI   rI   rJ   r    s   z*ClientEndpointBridge._resolve_signing_namec                 C   s@   |}|d u r|d }|}d|v rd|d v r|d d }||fS )NendpointNamer%  r   rI   )r>   r	  rm   rX   r  rI   rI   rJ   r  %  s   z(ClientEndpointBridge._pick_region_valuesc                 C   s   t || j| j}|d ur|S |dg }| jd ur"| jtvr"| jg}d|v r?|dkr,dS d|v r2dS |D ]
}|tv r>|  S q4t|d)Nr   r0   r1   r/   )r   )r   rY   rZ   re   rU   _LEGACY_SIGNATURE_VERSIONSr   r   )r>   rM   r	  configured_versionpotential_versionsknownrI   rI   rJ   r  ;  s.   

z/ClientEndpointBridge._resolve_signature_version)NNNNNNNNT)r   r   r   r   r   r  rK   r
  r  r  r  r  r  r  r  r  r  r  r  r  rI   rI   rI   rJ   rf   K  s2    


'rf   c                   @   s   e Zd Zi Z		d(ddZdd Zdd Zdd	 Zed
d Z	dd Z
dd Z			d)ddZdd Z	d*ddZdd Zdd Zdd Zdd Zed d! Zed"d# Zd$d% Zd&d' ZdS )+r   Nc                 C   s   || _ || _|| _|| _|| _i | _|| _|| _t|| j|j	|| j
|	| _|
| _d | _|| _| jd u r<t | j| _|   d S r3   )_serializer	_endpoint_ruleset_resolver_response_parser_request_signer_cacher4   _client_config
ClientMetahostr|   r   r;   _exceptionsr=   r   from_environmentwith_client_config_register_handlers)r>   
serializerr   response_parserrB   request_signerrt   r?   rY   r   rF   endpoint_ruleset_resolverrH   rI   rI   rJ   rK   e  s2   
zBaseClient.__init__c                 C   sX   | j j }d| d| }| jjj|| d\}}|d ur|S td| jj d| d)Nzgetattr..r[   'z' object has no attribute ')	_service_modelr   r   r   r   emit_until_responseAttributeError	__class__r   )r>   itemr   
event_namer   event_responserI   rI   rJ   __getattr__  s   
zBaseClient.__getattr__c                 C   s   | j   dS )z'Closes underlying endpoint connections.N)r-  closer  rI   rI   rJ   rG    s   zBaseClient.closec                 C   s,   | j jj }| j jd| | jj d S )Nzrequest-created.)r   rt   r   r   r   r   r0  r   )r>   r   rI   rI   rJ   r8    s   zBaseClient._register_handlersc                 C   r  r3   )r   rt   r  rI   rI   rJ   r?       zBaseClient._service_modelc                 C   s  | j |}| j j}td|||d |jrtd|| | jj	| jj
|j|j|jd}| j|||d}| |||\}}}|rE||d< | j|||||d}	t|	|| | j j }
| jjjd|
 d	| ||	| j|d
\}}|d ury|\}}nt| jj
|	| t|	 | ||	|\}}| jjjd|
 d	| ||||d |jdkr|di }|dp|d}| j|}||||S )NAPI_CALL)r  	operationr   zWarning: %s.%s() is deprecated)client_regionrY   has_streaming_input	auth_typeunsigned_payload)
api_paramsr   r   endpoint_properties)rO  r   rX   r   headerszbefore-call.r=  )modelr   r;  r   zafter-call.)http_responseparsedrR  r   i,  ErrorQueryErrorCodeCode)r?  r   rM   history_recorderrecord
deprecatedr`   r   r   rm   r   rL  resolved_auth_typerN  _emit_api_params_resolve_endpoint_ruleset_convert_to_request_dictr   r   r   r   r@  r0  r   r   _make_requestr\   status_codere   
exceptions	from_code)r>   r   rO  r   rM   request_contextrX   additional_headers
propertiesrequest_dictr   r   rE  r   parsed_response
error_info
error_codeerror_classrI   rI   rJ   r     s   	




zBaseClient._make_api_callc              
   C   sV   z| j ||W S  ty* } z| jjjd| jj  d|j	 ||d  d }~ww )Nzafter-call-error.r=  )	exceptionr   )
r-  make_request	Exceptionr   r   r\   r?  r   r   name)r>   r   rf  rc  erI   rI   rJ   r_    s   zBaseClient._make_requestTc           	      C   s`   | j ||}| jjs|dd  |d ur|d | |r$| j }nd }t||||d |S )Nhost_prefixrQ  )rX   rA   r   )	r,  serialize_to_requestr2  inject_host_prefixr   updater=   	to_stringr   )	r>   rO  r   rX   r   rQ  set_user_agent_headerrf  rA   rI   rI   rJ   r^    s"   	z#BaseClient._convert_to_request_dictc                 C   sf   |j }| jj }| jjjd| d| |||d}t||d}| jjjd| d| |||d |S )Nzprovide-client-params.r=  )r   rR  r   rN   zbefore-parameter-build.)rn  r?  r   r   r   r   r\   r   )r>   rO  r   r   r   r   rs   rI   rI   rJ   r\  *  s    zBaseClient._emit_api_paramsFc                 C   s   | j du r| jj}i }i }nC| j j|||d}|j}|j}|j}|jd}	|	durQ| j |	}
|
\}}||d< d|v rA|rA|d= d|v rM|d 	| n||d< |||fS )a  Returns endpoint URL and list of additional headers returned from
        EndpointRulesetResolver for the given operation and params. If the
        ruleset resolver is not available, for example because the service has
        no endpoints ruleset file, the legacy endpoint resolver's value is
        returned.

        Use ignore_signing_region for generating presigned URLs or any other
        situation where the signing region information from the ruleset
        resolver should be ignored.

        Returns tuple of URL and headers dictionary. Additionally, the
        request_context dict is modified in place with any signing information
        returned from the ruleset resolver.
        N)r   	call_argsrc  authSchemesrM  r   signing)
r.  r   rX   r   urlrQ  re  re   auth_schemes_to_signing_ctxrs  )r>   r   r   rc  ignore_signing_regionrX   rd  rP  endpoint_infoauth_schemes	auth_inforM  signing_contextrI   rI   rJ   r]  C  s2   

z$BaseClient._resolve_endpoint_rulesetc           
      C   s   |  |s
t|d| j| }dd }| jd | }t|| jj| jj|dd|_t	| jj}| d| }t
|tfd|i}| j|}|t| |||}	|	S )	a  Create a paginator for an operation.

        :type operation_name: string
        :param operation_name: The operation name.  This is the same name
            as the method name on the client.  For example, if the
            method name is ``create_foo``, and you'd normally invoke the
            operation as ``client.create_foo(**kwargs)``, if the
            ``create_foo`` operation can be paginated, you can use the
            call ``client.get_paginator("create_foo")``.

        :raise OperationNotPageableError: Raised if the operation is not
            pageable.  You can use the ``client.can_paginate`` method to
            check if an operation is pageable.

        :rtype: ``botocore.paginate.Paginator``
        :return: A paginator object.

        )r   c                 [   s   t j| fi |S r3   )r   paginate)r>   r   rI   rI   rJ   r    s   z*BaseClient.get_paginator.<locals>.paginatepage_configF)paginator_namerB   rt   paginator_configr   z.Paginator.r  )can_paginater   r|   r1  r   r   r   rt   r   r$   r   r   r?  r   r  )
r>   r   actual_operation_namer  r  service_module_namepaginator_class_namedocumented_paginator_clsr   	paginatorrI   rI   rJ   get_paginatorw  s>   


	zBaseClient.get_paginatorc                 C   sj   d| j vr)z| j| jjd| jjd }|| j d< W n ty(   i | j d< Y nw | j| }|| j d v S )aM  Check if an operation can be paginated.

        :type operation_name: string
        :param operation_name: The operation name.  This is the same name
            as the method name on the client.  For example, if the
            method name is ``create_foo``, and you'd normally invoke the
            operation as ``client.create_foo(**kwargs)``, if the
            ``create_foo`` operation can be paginated, you can use the
            call ``client.get_paginator("create_foo")``.

        :return: ``True`` if the operation can be paginated,
            ``False`` otherwise.

        r  zpaginators-1
pagination)r1  r4   r   r?  rM   rq   r   r|   )r>   r   r  r  rI   rI   rJ   r    s   

zBaseClient.can_paginatec                 C   sX   d| j vr'z| j| jjd| jj}|| j d< W n ty&   i | j d< Y nw | j d S )Nwaiter_configz	waiters-2)r1  r4   r   r?  rM   rq   r   )r>   r  rI   rI   rJ   _get_waiter_config  s   

zBaseClient._get_waiter_configc                 C   sh   |   }|std| t|}i }|jD ]}||t|< q||vr+td| t|| || S )aK  Returns an object that can wait for some condition.

        :type waiter_name: str
        :param waiter_name: The name of the waiter to get. See the waiters
            section of the service docs for a list of available waiters.

        :returns: The specified waiter object.
        :rtype: ``botocore.waiter.Waiter``
        zWaiter does not exist: )r  
ValueErrorr   WaiterModelwaiter_namesr   create_waiter_with_client)r>   waiter_namer   rR  r   rn  rI   rI   rJ   
get_waiter  s   



zBaseClient.get_waiterc                 C   s*   |   }|sg S t|}dd |jD S )z(Returns a list of all available waiters.c                 S   s   g | ]}t |qS rI   )r   ).0rn  rI   rI   rJ   
<listcomp>  s    z+BaseClient.waiter_names.<locals>.<listcomp>)r  r   r  r  )r>   r   rR  rI   rI   rJ   r    s
   
zBaseClient.waiter_namesc                 C   s   | j d u r
|  | _ | j S r3   )r5  _load_exceptionsr  rI   rI   rJ   ra    s   

zBaseClient.exceptionsc                 C   s   | j | jS r3   )r;   create_client_exceptionsr?  r  rI   rI   rJ   r  
  s   zBaseClient._load_exceptionsc                 C   r  )z
        This private interface is subject to abrupt breaking changes, including
        removal, in any botocore release.
        )r0  _credentialsr  rI   rI   rJ   _get_credentials  s   zBaseClient._get_credentials)NNr+  )F)r   r   r   r|   rK   rF  rG  r8  propertyr?  r   r_  r^  r\  r]  r  r  r  r  r   r  ra  r  r  rI   rI   rI   rJ   r   \  s:    
*
V

4A


r   c                   @   s`   e Zd ZdZdd Zedd Zedd Zedd	 Zed
d Z	edd Z
edd ZdS )r3  a~  Holds additional client methods.

    This class holds additional information for clients.  It exists for
    two reasons:

        * To give advanced functionality to clients
        * To namespace additional client attributes from the operation
          names which are mapped to methods at runtime.  This avoids
          ever running into collisions with operation names.

    c                 C   s(   || _ || _|| _|| _|| _|| _d S r3   )r   r2  _endpoint_urlr?  _method_to_api_mapping
_partition)r>   r   rY   rX   rt   method_to_api_mappingr   rI   rI   rJ   rK   $  s   	
zClientMeta.__init__c                 C      | j S r3   )r?  r  rI   rI   rJ   rt   4     zClientMeta.service_modelc                 C   r  r3   )r2  rm   r  rI   rI   rJ   rm   8  rH  zClientMeta.region_namec                 C   r  r3   )r  r  rI   rI   rJ   rX   <  r  zClientMeta.endpoint_urlc                 C   r  r3   )r2  r  rI   rI   rJ   r   @  r  zClientMeta.configc                 C   r  r3   )r  r  rI   rI   rJ   r  D  r  z ClientMeta.method_to_api_mappingc                 C   r  r3   )r  r  rI   rI   rJ   r   H  r  zClientMeta.partitionN)r   r   r   r   rK   r  rt   rm   rX   r   r  r   rI   rI   rI   rJ   r3    s    




r3  c                 C   s\   |r
|j dur
|j S |dur,|| }|dur,t|tr,|d}|r,td| | |S dS )z
    Gets the manually configured signature version.

    :returns: the customer configured signature version, or None if no
        signature version was configured.
    Nr   zWSwitching signature version for service %s to version %s based on config file override.)r   re   r   dictr`   r   )rM   rY   rZ   service_configversionrI   rI   rJ   r   M  s   


r   )Hloggingbotocorer   r   botocore.argsr   botocore.authr   r   botocore.awsrequestr   botocore.compressr   botocore.configr	   botocore.credentialsr
   botocore.discoveryr   r   r   botocore.docs.docstringr   r   botocore.exceptionsr   r   r   r   r   botocore.historyr   botocore.hooksr   botocore.httpchecksumr   r   botocore.modelr   botocore.paginater   botocore.retriesr   r   botocore.useragentr   botocore.utilsr   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   	frozensetr'  	getLoggerr   r`   rX  r2   rf   r   r3  r   rI   rI   rI   rJ   <module>   sX   $
   z     >6