B ㊇c@sdZddlZddlZddlZddlZddlZddlZddlZddl Zddl Zddl Zddlm Z m Z mZmZmZmZmZmZmZddlmZmZddlmZmZmZmZmZmZddlm Z ddl!m"Z"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(m)Z)m*Z*dd l+m,Z,dd l-m.Z.dd l/m0Z0dd l1m2Z2dd l3m4Z4m5Z5m6Z6e7e8Z9GdddZ:GdddZ;GdddeZdS)zV This module contains the main interface to the botocore package, the Session object. N) UNSIGNED __version__handlersinvoke_initializers monitoringpaginate retryhandler translatewaiter)HAS_CRTMutableMapping)!BOTOCORE_DEFAUT_SESSION_VARIABLESConfigChainFactoryConfigValueStoreDefaultConfigResolverSmartDefaultsConfigStoreFactory&create_botocore_default_config_mapping)ClientExceptionsFactory)ConfigNotFoundInvalidDefaultsModePartialCredentialsErrorProfileNotFoundUnknownServiceError) EventAliaserHierarchicalEmitterfirst_non_none_response) create_loader) ServiceModel)ResponseParserFactory)EndpointResolver) EVENT_ALIASESIMDSRegionProvidervalidate_region_namec @seZdZdZeeZdZd|ddZddZ d d Z d d Z d dZ ddZ ddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zed)d*Zd+d,Zed-d.Zd}d/d0Zd1d2Zd3d4Z d5d6Z!d7d8Z"ed9d:Z#d;d<Z$d=d>Z%d~d?d@Z&dAdBZ'dCdDZ(dEdFZ)dGdHZ*ddIdJZ+ddKdLZ,ddMdNZ-ddOdPZ.dQdRZ/ddTdUZ0ddVdWZ1ddXdYZ2dd[d\Z3dd]d^Z4d_d`Z5dadbZ6dcddZ7dedfZ8dgdhZ9didjZ:dkdlZ;ddmdnZdsdtZ?dudvZ@dwdxZAddzd{ZBdS)Sessionae The Session object collects together useful functionality from `botocore` as well as important data such as configuration information and credentials into a single, easy-to-use object. :ivar available_profiles: A list of profiles defined in the config file associated with this session. :ivar profile: The current profile. z4%(asctime)s - %(name)s - %(levelname)s - %(message)sNTcCs|dkrt|_n||_t|j|_|r4||jd|_t|_d|_d|_ d|_ d|_ d|_ d|_ i|_|dk r|||jd<d|_d|_t|_t|_|t||j|_|dk r|j|t|dS)a Create a new Session object. :type session_vars: dict :param session_vars: A dictionary that is used to override some or all of the environment variables associated with this session. The key/value pairs defined in this dictionary will override the corresponding variables defined in ``SESSION_VARIABLES``. :type event_hooks: BaseEventHooks :param event_hooks: The event hooks object to use. If one is not provided, an event hooks object will be automatically created for you. :type include_builtin_handlers: bool :param include_builtin_handlers: Indicates whether or not to automatically register builtin handlers. :type profile: str :param profile: The name of the profile to use for this session. Note that the profile can only be set when the session is created. NZBotocoreprofile)rZ_original_handlerr_events_register_builtin_handlersuser_agent_nameruser_agent_versionuser_agent_extra_profile_config _credentials _auth_token _profile_map_session_instance_vars_client_config_last_client_region_usedComponentLocator _components_internal_components_register_componentsSessionVarDictSESSION_VARIABLESsession_var_mapupdater)self session_varsZ event_hooksZinclude_builtin_handlersr%r=k/private/var/folders/8c/hx9_v10d5x38qmnzt13b7b8j1k3n5b/T/pip-target-x6xd5gna/lib/python/botocore/session.py__init__\s4     zSession.__init__cCs\|||||||||| | dS)N) _register_credential_provider_register_token_provider_register_data_loader_register_endpoint_resolver_register_event_emitter!_register_response_parser_factory_register_exceptions_factory_register_config_store_register_monitor!_register_default_config_resolver _register_smart_defaults_factory)r;r=r=r>r6szSession._register_componentscCs|jd|jdS)N event_emitter)r4register_componentr&)r;r=r=r>rDszSession._register_event_emittercCs|jd|jdS)Ntoken_provider)r4lazy_register_component_create_token_resolver)r;r=r=r>rAsz Session._register_token_providercCs tj|S)N)botocoretokensZcreate_token_resolver)r;r=r=r>rOszSession._create_token_resolvercCs|jd|jdS)Ncredential_provider)r4rN_create_credential_resolver)r;r=r=r>r@sz%Session._register_credential_providercCstjj||jdS)N) region_name)rP credentialsZcreate_credential_resolverr2)r;r=r=r>rSsz#Session._create_credential_resolvercsjdfdddS)N data_loadercstdS)N data_path)rget_config_variabler=)r;r=r>z/Session._register_data_loader..)r4rN)r;r=)r;r>rBszSession._register_data_loadercsfdd}jd|dS)Ncs.d}|d\}}||}t||dS)NrV endpoints)Zuses_builtin_data) get_componentZload_data_with_pathZis_builtin_pathr)loaderr[pathZ uses_builtin)r;r=r>create_default_resolvers  zDSession._register_endpoint_resolver..create_default_resolverendpoint_resolver)r5rN)r;r_r=)r;r>rCs z#Session._register_endpoint_resolvercsfdd}jd|dS)Ncsd}|d}t|S)NrVzsdk-default-configuration)r\ load_datar)r]defaults)r;r=r>create_default_config_resolvers  zQSession._register_default_config_resolver..create_default_config_resolverdefault_config_resolver)r5rN)r;rcr=)r;r>rIs z)Session._register_default_config_resolvercsfdd}jd|dS)Ncsd}td}t||S)Nrd)session)_get_internal_componentr!r)rdZimds_region_provider)r;r=r>create_smart_defaults_factorys  zOSession._register_smart_defaults_factory..create_smart_defaults_factorysmart_defaults_factory)r5rN)r;rgr=)r;r>rJs z(Session._register_smart_defaults_factorycCs|jdtdS)Nresponse_parser_factory)r4rLr)r;r=r=r>rEsz)Session._register_response_parser_factorycCs|jdtdS)Nexceptions_factory)r5rLr)r;r=r=r>rFsz$Session._register_exceptions_factorycCsrxltjD]b}t|dkr.|\}}|||q|\}}}|tjkrR|j||q|tjkr|j||qWdS)N) rZBUILTIN_HANDLERSlenregisterZREGISTER_FIRSTr&Zregister_firstZ REGISTER_LASTZ register_last)r;eventsspec event_namehandlerZ register_typer=r=r>r's     z"Session._register_builtin_handlerscCs tt|d}|jd|dS)N)mapping config_store)rrr4rL)r;config_store_componentr=r=r>rGs zSession._register_config_storecCs|jd|jdS)Nmonitor)r5rN_create_csm_monitor)r;r=r=r>rHszSession._register_monitorc Csd|dr`|d}|d}|d}tjttjttjtj||tj|ddd}|SdS)NZ csm_enabled csm_client_idZcsm_hostZcsm_port)rw)sockethostport serializer)adapterZ publisher) rXrZMonitorZMonitorEventAdapterZSocketPublisherrxAF_INET SOCK_DGRAMZ CSMSerializer)r;Z client_idryrzrqr=r=r>rv s    zSession._create_csm_monitorcCs(yddl}|jStk r"dSXdS)NrUnknown)awscrtrAttributeError)r;rr=r=r>_get_crt_versions zSession._get_crt_versioncCst|S)N)list_build_profile_mapkeys)r;r=r=r>available_profiles%szSession.available_profilescCs|jdkr|jd|_|jS)Nprofiles)r/ full_config)r;r=r=r>r)s  zSession._build_profile_mapcCs |jdkr|d}||_|jS)Nr%)r+rX)r;r%r=r=r>r%1s  zSession.profilecCs$|dk r|||S|d|S)Nrs)(_get_config_variable_with_custom_methodsr\rX)r; logical_namemethodsr=r=r>rX8s  zSession.get_config_variablecCst||d}t|}xl|jD]^\}}|\}}} } | | d} d|krN|| d<d|kr^|| d<d|krn|| d<|jf| ||<q Wt|d } | |} | S) N)rer)conversion_funcdefaultinstance instance_nameenv env_var_namesconfigconfig_property_name)rr)SubsetChainConfigFactoryrr9itemscreate_config_chainrrX)r;rrZ chain_builderrrnameconfig_options config_nameenv_varsrtypecastZbuild_chain_config_argsrtvaluer=r=r>rAs"    z0Session._get_config_variable_with_custom_methodscCstd||||j|<dS)aSet a configuration variable to a specific value. By using this method, you can override the normal lookup process used in ``get_config_variable`` by explicitly setting a value. Subsequent calls to ``get_config_variable`` will use the ``value``. This gives you per-session specific configuration values. :: >>> # Assume logical name 'foo' maps to env var 'FOO' >>> os.environ['FOO'] = 'myvalue' >>> s.get_config_variable('foo') 'myvalue' >>> s.set_config_variable('foo', 'othervalue') >>> s.get_config_variable('foo') 'othervalue' :type logical_name: str :param logical_name: The logical name of the session variable you want to set. These are the keys in ``SESSION_VARIABLES``. :param value: The value to associate with the config variable. z$Setting config variable for %s to %rN)loggerdebugr0)r;rrr=r=r>set_config_variable]s zSession.set_config_variablecCs t|jS)N)copyr0)r;r=r=r>instance_variables|szSession.instance_variablescCsF|d}|}|dkr&|diS||kr:t|dn||SdS)a5 Returns the config values from the config file scoped to the current profile. The configuration data is loaded **only** from the config file. It does not resolve variables based on different locations (e.g. first from the session instance, then from environment variables, then from the config file). If you want this lookup behavior, use the ``get_config_variable`` method instead. Note that this configuration is specific to a single profile (the ``profile`` session variable). If the ``profile`` session variable is set and the profile does not exist in the config file, a ``ProfileNotFound`` exception will be raised. :raises: ConfigNotFound, ConfigParseError, ProfileNotFound :rtype: dict r%Nr)r%)rXrgetr)r;Z profile_nameZ profile_mapr=r=r>get_scoped_configs   zSession.get_scoped_configcCs|jdkry|d}tj||_Wntk rDdii|_YnXyb|d}tj|}xF|D]>}||}||jdkr||jd|<qd|jd||qdWWntk rYnX|jS)zReturn the parsed config file. The ``get_config`` method returns the config associated with the specified profile. This property returns the contents of the **entire** config file. :rtype: dict N config_filerZcredentials_file)r,rXrPZ configloader load_configrZraw_config_parser:)r;rZ cred_fileZ cred_profilesr%Z cred_varsr=r=r>rs$    zSession.full_configcCs|jS)aRetrieves the default config for creating clients :rtype: botocore.client.Config :returns: The default client config object when creating clients. If the value is ``None`` then there is no default config object attached to the session. )r1)r;r=r=r>get_default_client_configsz!Session.get_default_client_configcCs ||_dS)a1Sets the default config for creating clients :type client_config: botocore.client.Config :param client_config: The default client config object when creating clients. If the value is ``None`` then there is no default config object attached to the session. N)r1)r; client_configr=r=r>set_default_client_configsz!Session.set_default_client_configcCstj||||_dS)aO Manually create credentials for this session. If you would prefer to use botocore without a config file, environment variables, or IAM roles, you can pass explicit credentials into this method to establish credentials for this session. :type access_key: str :param access_key: The access key part of the credentials. :type secret_key: str :param secret_key: The secret key part of the credentials. :type token: str :param token: An option session token used by STS session credentials. N)rPrU Credentialsr-)r; access_key secret_keytokenr=r=r>set_credentialsszSession.set_credentialscCs"|jdkr|jd|_|jS)a$ Return the :class:`botocore.credential.Credential` object associated with this session. If the credentials have not yet been loaded, this will attempt to load them. If they have already been loaded, this will return the cached credentials. NrR)r-r4r\Zload_credentials)r;r=r=r>get_credentialss  zSession.get_credentialscCs&|jdkr |jd}||_|jS)a Return the :class:`botocore.tokens.AuthToken` object associated with this session. If the authorization token has not yet been loaded, this will attempt to load it. If it has already been loaded, this will return the cached authorization token. NrM)r.r4r\Z load_token)r;providerr=r=r>get_auth_tokens   zSession.get_auth_tokenc Cs|jd|jdtdtdt }trD|d|7}tj ddk rh|dtj d7}|j r||d|j 7}|S) ak Return a string suitable for use as a User-Agent header. The string will be of the form: / Python/ / Where: - agent_name is the value of the `user_agent_name` attribute of the session object (`Botocore` by default). - agent_version is the value of the `user_agent_version` attribute of the session object (the botocore version by default). by default. - py_ver is the version of the Python interpreter beng used. - plat_name is the name of the platform (e.g. Darwin) - plat_ver is the version of the platform - exec_env is exec-env/$AWS_EXECUTION_ENV If ``user_agent_extra`` is not empty, then this value will be appended to the end of the user agent string. /z Python/ z awscrt/%sZAWS_EXECUTION_ENVNz exec-env/%sz %s) r(r)platformpython_versionsystemreleaser rosenvironrr*)r;baser=r=r> user_agent s0zSession.user_agentcCs|d|S)z Retrieve the data associated with `data_path`. :type data_path: str :param data_path: The path to the data you wish to retrieve. rV)r\ra)r;rWr=r=r>get_data2szSession.get_datacCs|||}t||dS)aGet the service model object. :type service_name: string :param service_name: The service name :type api_version: string :param api_version: The API version of the service. If none is provided, then the latest API version will be used. :rtype: L{botocore.model.ServiceModel} :return: The botocore service model for the service. ) service_name)get_service_datar)r;r api_versionZservice_descriptionr=r=r>get_service_model;s zSession.get_service_modelcCs"|d}||d|}t|S)NrVz waiters-2)r\load_service_modelr Z WaiterModel)r;rrr]Z waiter_configr=r=r>get_waiter_modelLs  zSession.get_waiter_modelcCs"|d}||d|}t|S)NrVz paginators-1)r\rrZPaginatorModel)r;rrr]Zpaginator_configr=r=r>get_paginator_modelSs  zSession.get_paginator_modelcCsB|}|dj|d|d}t||}|jjd||||d|S)zK Retrieve the fully merged data associated with a service. rVz service-2) type_namerzservice-data-loaded.%s) service_datarre)r\rr rr&emit)r;rrrWrZ service_idr=r=r>rZs   zSession.get_service_datacCs|djddS)z? Return a list of names of available services. rVz service-2)r)r\Zlist_available_services)r;r=r=r>get_available_servicesks zSession.get_available_servicesrPcCs||tjdS)zk Convenience function to quickly configure full debug output to go to the console. N)set_stream_loggerloggingDEBUG)r; logger_namer=r=r>set_debug_loggersszSession.set_debug_loggercCsZt|}|tjt|}|||dkr8|j}t|}||||dS)a Convenience method to configure a stream logger. :type logger_name: str :param logger_name: The name of the logger to configure :type log_level: str :param log_level: The log level to set for the logger. This is any param supported by the ``.setLevel()`` method of a ``Log`` object. :type stream: file :param stream: A file like object to log to. If none is provided then sys.stderr will be used. :type format_string: str :param format_string: The format string to use for the log formatter. If none is provided this will default to ``self.LOG_FORMAT``. N) r getLoggersetLevelr StreamHandler LOG_FORMAT Formatter setFormatter addHandler)r;r log_levelstream format_stringlogch formatterr=r=r>rzs      zSession.set_stream_loggercCsNt|}|tjt|}||t|j}||||dS)aV Convenience function to quickly configure any level of logging to a file. :type log_level: int :param log_level: A log level as specified in the `logging` module :type path: string :param path: Path to the log file. The file will be created if it doesn't already exist. N) rrrr FileHandlerrrrr)r;rr^rrrrr=r=r>set_file_loggers      zSession.set_file_loggerFcCs|jj||||ddS)a)Register a handler with an event. :type event_name: str :param event_name: The name of the event. :type handler: callable :param handler: The callback to invoke when the event is emitted. This object must be callable, and must accept ``**kwargs``. If either of these preconditions are not met, a ``ValueError`` will be raised. :type unique_id: str :param unique_id: An optional identifier to associate with the registration. A unique_id can only be used once for the entire session registration (unless it is unregistered). This can be used to prevent an event handler from being registered twice. :param unique_id_uses_count: boolean :param unique_id_uses_count: Specifies if the event should maintain a count when a ``unique_id`` is registered and unregisted. The event can only be completely unregistered once every register call using the unique id has been matched by an ``unregister`` call. If ``unique_id`` is specified, subsequent ``register`` calls must use the same value for ``unique_id_uses_count`` as the ``register`` call that first registered the event. :raises ValueError: If the call to ``register`` uses ``unique_id`` but the value for ``unique_id_uses_count`` differs from the ``unique_id_uses_count`` value declared by the very first ``register`` call for that ``unique_id``. )unique_id_uses_countN)r&rm)r;rprq unique_idrr=r=r>rms #zSession.registercCs|jj||||ddS)aUnregister a handler with an event. :type event_name: str :param event_name: The name of the event. :type handler: callable :param handler: The callback to unregister. :type unique_id: str :param unique_id: A unique identifier identifying the callback to unregister. You can provide either the handler or the unique_id, you do not have to provide both. :param unique_id_uses_count: boolean :param unique_id_uses_count: Specifies if the event should maintain a count when a ``unique_id`` is registered and unregisted. The event can only be completely unregistered once every ``register`` call using the ``unique_id`` has been matched by an ``unregister`` call. If the ``unique_id`` is specified, subsequent ``unregister`` calls must use the same value for ``unique_id_uses_count`` as the ``register`` call that first registered the event. :raises ValueError: If the call to ``unregister`` uses ``unique_id`` but the value for ``unique_id_uses_count`` differs from the ``unique_id_uses_count`` value declared by the very first ``register`` call for that ``unique_id``. )rqrrN)r& unregister)r;rprqrrr=r=r>rs #zSession.unregistercKs|jj|f|S)N)r&r)r;rpkwargsr=r=r>rsz Session.emitcKs|jj|f|}t|S)N)r&rr)r;rpr responsesr=r=r>emit_first_non_none_responsesz$Session.emit_first_non_none_responsecCsLy |j|Stk rF|dkr@td|t|j|SYnXdS)N)r`rjzFetching the %s component with the get_component() method is deprecated as the component has always been considered an internal interface of botocore)r4r\ ValueErrorwarningswarnDeprecationWarningr5)r;rr=r=r>r\s  zSession.get_componentcCs |j|S)N)r5r\)r;rr=r=r>rf(szSession._get_internal_componentcCs|j||S)N)r5rL)r;r componentr=r=r>_register_internal_component.sz$Session._register_internal_componentcCs|j||dS)N)r4rL)r;rrr=r=r>rL4szSession.register_componentcCs|j||dS)N)r4rN)r;rrr=r=r>rN7szSession.lazy_register_componentc  Cs|} | dk r$| dk r$| | } n | dk r0| } ||| }|dkrN|d}|dkrh|d|d}|d} |d} |d}| dk r| jtkrd}nN|dk r|dk rtj j ||| d}n*| ||rt d| ||d n| }|}|d }|d }|d }|| |}|d krJ|d}t|}||||tj| ||| tt||| }|j|||||||| ||d }|d}|dk r||jj|S)aP Create a botocore client. :type service_name: string :param service_name: The name of the service for which a client will be created. You can use the ``Session.get_available_services()`` method to get a list of all available service names. :type region_name: string :param region_name: The name of the region associated with the client. A client is associated with a single region. :type api_version: string :param api_version: The API version to use. By default, botocore will use the latest API version when creating a client. You only need to specify this parameter if you want to use a previous API version of the client. :type use_ssl: boolean :param use_ssl: Whether or not to use SSL. By default, SSL is used. Note that not all services support non-ssl connections. :type verify: boolean/string :param verify: Whether or not to verify SSL certificates. By default SSL certificates are verified. You can provide the following values: * False - do not validate SSL certificates. SSL will still be used (unless use_ssl is False), but SSL certificates will not be verified. * path/to/cert/bundle.pem - A filename of the CA cert bundle to uses. You can specify this argument if you want to use a different CA cert bundle than the one used by botocore. :type endpoint_url: string :param endpoint_url: The complete URL to use for the constructed client. Normally, botocore will automatically construct the appropriate URL to use when communicating with a service. You can specify a complete URL (including the "http/https" scheme) to override this behavior. If this value is provided, then ``use_ssl`` is ignored. :type aws_access_key_id: string :param aws_access_key_id: The access key to use when creating the client. This is entirely optional, and if not provided, the credentials configured for the session will automatically be used. You only need to provide this argument if you want to override the credentials used for this specific client. :type aws_secret_access_key: string :param aws_secret_access_key: The secret key to use when creating the client. Same semantics as aws_access_key_id above. :type aws_session_token: string :param aws_session_token: The session token to use when creating the client. Same semantics as aws_access_key_id above. :type config: botocore.client.Config :param config: Advanced client configuration options. If a value is specified in the client config, its value will take precedence over environment variables and configuration values, but not over a value passed explicitly to the method. If a default config object is set on the session, the config object used when creating the client will be the result of calling ``merge()`` on the default config with the config provided to this call. :rtype: botocore.client.BaseClient :return: A botocore client instance NZ ca_bundleZ api_versionsrVrKri)rrrexplicit)rZcred_varr`rjrslegacyrh) rrTZ is_secure endpoint_urlverifyrUZ scoped_configrr auth_tokenru)rmerge_resolve_region_namerXrr\Zsignature_versionrrPrUr_missing_cred_varsrrrrf_resolve_defaults_moderdeepcopyZmerge_smart_defaultsclientZ ClientCreatorrrr create_clientrrmmetarn)r;rrTrZuse_sslrraws_access_key_idaws_secret_access_keyZaws_session_tokenrZdefault_client_configr]rKrirUrr`rjrs defaults_moderhZclient_creatorrrur=r=r>r:s~R                  zSession.create_clientcCs:|dkr(|r|jdk r|j}n |d}t|||_|S)Nregion)rTrXr"r2)r;rTrr=r=r>rs  zSession._resolve_region_namecCsR|d}|r|jr|j}|d}|}|}||krNt|d|d|S)Nrrdz, )modeZ valid_modes)rXrrfZget_default_modeslowerrjoin)r;rrsrrdZ default_modesZlmoder=r=r>rs  zSession._resolve_defaults_modecCs,|dk r|dkrdS|dk r(|dkr(dSdS)Nrrr=)r;rrr=r=r>r s zSession._missing_cred_varscCs|d}|S)zLists the available partitions found on disk :rtype: list :return: Returns a list of partition names (e.g., ["aws", "aws-cn"]) r`)rfget_available_partitions)r;resolverr=r=r>rs z Session.get_available_partitionscCs|d}||S)aLists the partition name of a particular region. :type region_name: string :param region_name: Name of the region to list partition for (e.g., us-east-1). :rtype: string :return: Returns the respective partition name (e.g., aws). r`)rfget_partition_for_region)r;rTrr=r=r>rs z Session.get_partition_for_regionawscCsT|d}g}y,||}|dd|}||||}Wntk rNYnX|S)a]Lists the region and endpoint names of a particular partition. :type service_name: string :param service_name: Name of a service to list endpoint for (e.g., s3). This parameter accepts a service name (e.g., "elb") or endpoint prefix (e.g., "elasticloadbalancing"). :type partition_name: string :param partition_name: Name of the partition to limit endpoints to. (e.g., aws for the public AWS endpoints, aws-cn for AWS China endpoints, aws-us-gov for AWS GovCloud (US) Endpoints, etc. :type allow_non_regional: bool :param allow_non_regional: Set to True to include endpoints that are not regional endpoints (e.g., s3-external-1, fips-us-gov-west-1, etc). :return: Returns a list of endpoint names (e.g., ["us-east-1"]). r`metadataZendpointPrefix)rfrrZget_available_endpointsr)r;rZpartition_nameZallow_non_regionalrresultsrZendpoint_prefixr=r=r>get_available_regions&s  zSession.get_available_regions)NNTN)N)N)N)N)N)N)rP)NN)rP)NF)NNF) NNTNNNNNN)rF)C__name__ __module__ __qualname____doc__rr r8rr?r6rDrArOr@rSrBrCrIrJrErFr'rGrHrvrpropertyrrr%rXrrrrrrrrrrrrrrrrrrrrrmrrrr\rfrrLrNrrrrrrrr=r=r=r>r#Ls   ;       % $   %      (  , %  r#c@s0eZdZdZddZddZddZdd Zd S) r3z'Service locator for session components.cCsi|_i|_dS)N)r4 _deferred)r;r=r=r>r?MszComponentLocator.__init__cCsX||jkr(|j|}||j|<|j|=y |j|Stk rRtd|YnXdS)NzUnknown component: %s)rr4KeyErrorr)r;rfactoryr=r=r>r\Qs    zComponentLocator.get_componentcCs0||j|<y |j|=Wntk r*YnXdS)N)r4rr)r;rrr=r=r>rL^s   z#ComponentLocator.register_componentcCs0||j|<y |j|=Wntk r*YnXdS)N)rr4r)r;rZno_arg_factoryr=r=r>rNes   z(ComponentLocator.lazy_register_componentN)rrrrr?r\rLrNr=r=r=r>r3Js  r3c@sDeZdZddZddZddZddZd d Zd d Zd dZ dS)r7cCs||_t||_dS)N)_sessionr_store)r;rer<r=r=r>r?nszSessionVarDict.__init__cCs |j|S)N)r )r;keyr=r=r> __getitem__rszSessionVarDict.__getitem__cCs||j|<|||dS)N)r &_update_config_store_from_session_vars)r;r rr=r=r> __setitem__us zSessionVarDict.__setitem__cCs |j|=dS)N)r )r;r r=r=r> __delitem__yszSessionVarDict.__delitem__cCs t|jS)N)iterr )r;r=r=r>__iter__|szSessionVarDict.__iter__cCs t|jS)N)rlr )r;r=r=r>__len__szSessionVarDict.__len__c CsDt|jd}|\}}}}|jd}|||j|||||ddS)N)rers)rrconfig_property_namesrr)rr r\Zset_config_providerr) r;rrZconfig_chain_builderrrrrrsr=r=r>rs   z5SessionVarDict._update_config_store_from_session_varsN) rrrr?r rrrrrr=r=r=r>r7msr7c@s$eZdZdZdddZdddZdS) ra`A class for creating backwards compatible configuration chains. This class can be used instead of :class:`botocore.configprovider.ConfigChainFactory` to make it honor the methods argument to get_config_variable. This class can be used to filter out providers that are not in the methods tuple when creating a new config chain. NcCst|||_||_dS)N)r_factory_supported_methods)r;rerrr=r=r>r?s z!SubsetChainConfigFactory.__init__cCs@d|jkrd}d|jkrd}d|jkr*d}|jj|||||dS)aBuild a config chain following the standard botocore pattern. This config chain factory will omit any providers not in the methods tuple provided at initialization. For example if given the tuple ('instance', 'config',) it will not inject the environment provider into the standard config chain. This lets the botocore session support the custom ``methods`` argument for all the default botocore config variables when calling ``get_config_variable``. rNrr)rrrrr)rrr)r;rrrrrr=r=r>rs   z,SubsetChainConfigFactory.create_config_chain)N)NNNNN)rrrrr?rr=r=r=r>rs rcCst|S)z& Return a new session object. )r#)rr=r=r> get_sessionsr)N)?rrrrrrxrZbotocore.clientrPZbotocore.configloaderZbotocore.credentialsZbotocore.tokensrrrrrrrr r Zbotocore.compatr r Zbotocore.configproviderr rrrrrZbotocore.errorfactoryrZbotocore.exceptionsrrrrrZbotocore.hooksrrrZbotocore.loadersrZbotocore.modelrZbotocore.parsersrZbotocore.regionsrZbotocore.utilsr r!r"rrrr#r3r7rrr=r=r=r>sF,        #..