B \ (@sndZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z e eZGdddeZdS)zInternal module to help with normalizing botocore client args. This module (and all function/classes within this module) should be considered internal, and *not* a public API. N) RequestSigner)Config)EndpointCreatorc@sLeZdZddZddZddZddZd d Zd d Zd dZ ddZ dS)ClientArgsCreatorcCs"||_||_||_||_||_dS)N)_event_emitter _user_agent_response_parser_factory_loader_exceptions_factory)self event_emitter user_agentresponse_parser_factoryloaderexceptions_factoryr1/tmp/pip-build-uw_ogi45/botocore/botocore/args.py__init__"s zClientArgsCreator.__init__c  CsB|||| ||||} | d} | d} | d} | d}| d}| d}| ddd}| d }| d }| d }|dkr|dkr|| | \}}||d <t|j}t|j|| d | d ||}||d<tf|}t|}|j ||| d||j |j |j |j |jf||jd }tj|| }tj|}|||||||j|||jd S)N service_nameparameter_validationendpoint_configprotocol config_kwargs s3_configmetadata partitionsocket_optionssigning_region region_nameZ signing_namesignature_versions3 endpoint_url) rr!verifyrmax_pool_connectionsproxiestimeoutr client_cert) serializerendpointresponse_parserr Zrequest_signer service_modelr client_configrr)compute_client_argsget_get_default_s3_regioncopyrrZ service_idrrZcreate_endpointrr#r$connect_timeout read_timeoutr&botocore serializeZcreate_serializerparsers create_parserr r )r r*r is_securer!r" credentials scoped_configr+endpoint_bridgeZ final_argsrrrrrrrrrZendpoint_region_namer ZsignerZ new_configZendpoint_creatorr(r'r)rrrget_client_args*s^      z!ClientArgsCreator.get_client_argsc Cs|j}|jd} d} |r$|js$d} n"|rF|d} | dk rFtj| } |||||} |j} |dk r|j dk rt|j } |j dk r| d|j 7} t | d| d| d}|dk r|j |j |j|j|j|j|j|jd |||}|| | | | ||||d S) NrTFrz %srr)rrr )r0r1r#r$retriesr&inject_host_prefix)rrr rrrrr)Zendpoint_prefixrrr-r2utilsensure_booleanresolverr Zuser_agent_extradictupdater0r1r#r$r;r&r<compute_s3_config_compute_socket_options)r r*r+r9rr!r6r8rrrZ raw_valuerr rrrrrr,gsP        z%ClientArgsCreator.compute_client_argscCsd}|dk rJ|d}t|ts0td|d}|rJdddg}|||}|dk r|jdk r|dkrl|j}n|}||j|S)Nr zEThe s3 config key is not a dictionary type, ignoring its value of: %sZuse_accelerate_endpointZuse_dualstack_endpointZpayload_signing_enabled) r- isinstancer@loggerdebug_convert_config_to_boolr r/rA)r r8r+Zs3_configurationZ boolean_keysrrrrBs(    z#ClientArgsCreator.compute_s3_configcs@|fdd|D}x |D]}tj||<q WS)Ncsg|]}|kr|qSrr).0k) config_copyrr sz=ClientArgsCreator._convert_config_to_bool..)r/r2r=r>)r Z config_dictkeysZ present_keyskeyr)rJrrGs  z)ClientArgsCreator._convert_config_to_boolcCs&|dkr"|d}|d|dfSdS)Nr rr)NN)r?)r rr9r(rrrr.s z(ClientArgsCreator._get_default_s3_regioncCs>tjtjdfg}|r:||ddr:|tjtjdf|S)NZ tcp_keepaliveF)socket IPPROTO_TCP TCP_NODELAY_ensure_booleanr-append SOL_SOCKET SO_KEEPALIVE)r r8rrrrrCs z)ClientArgsCreator._compute_socket_optionscCst|tr|S|dkSdS)Ntrue)rDboollower)r valrrrrRs z!ClientArgsCreator._ensure_booleanN) __name__ __module__ __qualname__rr:r,rBrGr.rCrRrrrrr!s=6(   r)__doc__r/loggingrOZbotocore.serializer2Zbotocore.utilsZbotocore.signersrZbotocore.configrZbotocore.endpointr getLoggerrZrEobjectrrrrrs