aries_cloudagent.config package¶
Submodules¶
aries_cloudagent.config.argparse module¶
aries_cloudagent.config.banner module¶
Module to contain logic to generate the banner for ACA-py.
Bases:
object
Management class to generate a banner for ACA-py.
Pad string content with defined border character.
Parameters: content – String content to pad
Print a full line using the border character.
Print a list of items, prepending a dash to each item.
Print an empty line with the border character only.
Print a subtitle for a section.
Print the main title element.
Print the current
version
.
aries_cloudagent.config.base module¶
Configuration base classes.
-
class
aries_cloudagent.config.base.
BaseInjector
[source]¶ Bases:
abc.ABC
Base injector class.
-
copy
() → aries_cloudagent.config.base.BaseInjector[source]¶ Produce a copy of the injector instance.
-
inject
(base_cls: Type[InjectType], settings: Optional[Mapping[str, Any]] = None) → InjectType[source]¶ Get the provided instance of a given class identifier.
Parameters: - cls – The base class to retrieve an instance of
- settings – An optional mapping providing configuration to the provider
Returns: An instance of the base class, or None
-
inject_or
(base_cls: Type[InjectType], settings: Optional[Mapping[str, Any]] = None, default: Optional[InjectType] = None) → Optional[InjectType][source]¶ Get the provided instance of a given class identifier or default if not found.
Parameters: - base_cls – The base class to retrieve an instance of
- settings – An optional dict providing configuration to the provider
- default – default return value if no instance is found
Returns: An instance of the base class, or None
-
-
class
aries_cloudagent.config.base.
BaseSettings
[source]¶ Bases:
collections.abc.Mapping
,typing.Generic
Base settings class.
-
copy
() → aries_cloudagent.config.base.BaseSettings[source]¶ Produce a copy of the settings instance.
-
extend
(other: Mapping[str, Any]) → aries_cloudagent.config.base.BaseSettings[source]¶ Merge another mapping to produce a new settings instance.
-
get_bool
(*var_names, default: Optional[bool] = None) → Optional[bool][source]¶ Fetch a setting as a boolean value.
Parameters: - var_names – A list of variable name alternatives
- default – The default value to return if none are defined
-
get_int
(*var_names, default: Optional[int] = None) → Optional[int][source]¶ Fetch a setting as an integer value.
Parameters: - var_names – A list of variable name alternatives
- default – The default value to return if none are defined
-
get_str
(*var_names, default: Optional[str] = None) → Optional[str][source]¶ Fetch a setting as a string value.
Parameters: - var_names – A list of variable name alternatives
- default – The default value to return if none are defined
-
-
exception
aries_cloudagent.config.base.
ConfigError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.core.error.BaseError
A base exception for all configuration errors.
-
exception
aries_cloudagent.config.base.
InjectionError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.config.base.ConfigError
The base exception raised by Injector and Provider implementations.
-
exception
aries_cloudagent.config.base.
SettingsError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.config.base.ConfigError
The base exception raised by BaseSettings implementations.
aries_cloudagent.config.base_context module¶
Base injection context builder classes.
aries_cloudagent.config.default_context module¶
aries_cloudagent.config.error module¶
Errors for config modules.
-
exception
aries_cloudagent.config.error.
ArgsParseError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.config.base.ConfigError
Error raised when there is a problem parsing the command-line arguments.
aries_cloudagent.config.injection_context module¶
Injection context implementation.
-
class
aries_cloudagent.config.injection_context.
InjectionContext
(*, settings: Mapping[str, object] = None, enforce_typing: bool = True)[source]¶ Bases:
aries_cloudagent.config.base.BaseInjector
Manager for configuration settings and class providers.
-
ROOT_SCOPE
= 'application'¶
-
copy
() → aries_cloudagent.config.injection_context.InjectionContext[source]¶ Produce a copy of the injector instance.
-
inject
(base_cls: Type[InjectType], settings: Mapping[str, object] = None) → InjectType[source]¶ Get the provided instance of a given class identifier.
Parameters: - cls – The base class to retrieve an instance of
- settings – An optional mapping providing configuration to the provider
Returns: An instance of the base class, or None
-
inject_or
(base_cls: Type[InjectType], settings: Mapping[str, object] = None, default: Optional[InjectType] = None) → Optional[InjectType][source]¶ Get the provided instance of a given class identifier or default if not found.
Parameters: - base_cls – The base class to retrieve an instance of
- settings – An optional dict providing configuration to the provider
- default – default return value if no instance is found
Returns: An instance of the base class, or None
-
injector
¶ Accessor for scope-specific injector.
-
injector_for_scope
(scope_name: str) → aries_cloudagent.config.injector.Injector[source]¶ Fetch the injector for a specific scope.
Parameters: scope_name – The unique scope identifier
-
scope_name
¶ Accessor for the current scope name.
-
settings
¶ Accessor for scope-specific settings.
-
start_scope
(scope_name: str, settings: Mapping[str, object] = None) → aries_cloudagent.config.injection_context.InjectionContext[source]¶ Begin a new named scope.
Parameters: - scope_name – The unique name for the scope being entered
- settings – An optional mapping of additional settings to apply
Returns: A new injection context representing the scope
-
-
exception
aries_cloudagent.config.injection_context.
InjectionContextError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.config.base.InjectionError
Base class for issues in the injection context.
aries_cloudagent.config.injector module¶
Standard Injector implementation.
-
class
aries_cloudagent.config.injector.
Injector
(settings: Mapping[str, object] = None, *, enforce_typing: bool = True)[source]¶ Bases:
aries_cloudagent.config.base.BaseInjector
Injector implementation with static and dynamic bindings.
-
bind_instance
(base_cls: Type[InjectType], instance: InjectType)[source]¶ Add a static instance as a class binding.
-
bind_provider
(base_cls: Type[InjectType], provider: aries_cloudagent.config.base.BaseProvider, *, cache: bool = False)[source]¶ Add a dynamic instance resolver as a class binding.
-
copy
() → aries_cloudagent.config.base.BaseInjector[source]¶ Produce a copy of the injector instance.
-
get_provider
(base_cls: Type[InjectType])[source]¶ Find the provider associated with a class binding.
-
inject
(base_cls: Type[InjectType], settings: Mapping[str, object] = None) → InjectType[source]¶ Get the provided instance of a given class identifier.
Parameters: - cls – The base class to retrieve an instance of
- params – An optional dict providing configuration to the provider
Returns: An instance of the base class, or None
-
inject_or
(base_cls: Type[InjectType], settings: Mapping[str, object] = None, default: Optional[InjectType] = None) → Optional[InjectType][source]¶ Get the provided instance of a given class identifier or default if not found.
Parameters: - base_cls – The base class to retrieve an instance of
- settings – An optional dict providing configuration to the provider
- default – default return value if no instance is found
Returns: An instance of the base class, or None
-
settings
¶ Accessor for scope-specific settings.
-
aries_cloudagent.config.ledger module¶
Ledger configuration.
-
aries_cloudagent.config.ledger.
accept_taa
(ledger: aries_cloudagent.ledger.base.BaseLedger, profile: aries_cloudagent.core.profile.Profile, taa_info, provision: bool = False) → bool[source]¶ Perform TAA acceptance.
-
aries_cloudagent.config.ledger.
fetch_genesis_transactions
(genesis_url: str) → str[source]¶ Get genesis transactions.
-
aries_cloudagent.config.ledger.
get_genesis_transactions
(settings: aries_cloudagent.config.settings.Settings) → str[source]¶ Fetch genesis transactions if necessary.
-
aries_cloudagent.config.ledger.
ledger_config
(profile: aries_cloudagent.core.profile.Profile, public_did: str, provision: bool = False) → bool[source]¶ Perform Indy ledger configuration.
aries_cloudagent.config.logging module¶
Utilities related to logging.
-
class
aries_cloudagent.config.logging.
LoggingConfigurator
[source]¶ Bases:
object
Utility class used to configure logging and print an informative start banner.
-
classmethod
configure
(logging_config_path: str = None, log_level: str = None, log_file: str = None)[source]¶ Configure logger.
Parameters: - logging_config_path – str: (Default value = None) Optional path to custom logging config
- log_level – str: (Default value = None)
Print a startup banner describing the configuration.
Parameters: - agent_label – Agent Label
- inbound_transports – Configured inbound transports
- outbound_transports – Configured outbound transports
- admin_server – Admin server info
- public_did – Public DID
- banner_length – (Default value = 40) Length of the banner
- border_character – (Default value = “:”) Character to use in banner
- border –
-
classmethod
-
class
aries_cloudagent.config.logging.
TimedRotatingFileMultiProcessHandler
(filename, when='h', interval=1, backupCount=1, encoding=None, delay=False, utc=False, atTime=None)[source]¶ Bases:
logging.handlers.BaseRotatingHandler
Handler for logging to a file.
Rotating the log file at certain timed with file lock unlock mechanism to support multi-process writing to log file.
-
aries_cloudagent.config.logging.
clear_prev_handlers
(logger: logging.Logger) → logging.Logger[source]¶ Remove all handler classes associated with logger instance.
-
aries_cloudagent.config.logging.
get_did_ident
(profile: aries_cloudagent.core.profile.Profile) → Optional[str][source]¶ Get public did identifier for logging, if applicable.
-
aries_cloudagent.config.logging.
get_logger_inst
(profile: aries_cloudagent.core.profile.Profile, logger_name) → logging.Logger[source]¶ Return a logger instance with provided name and handlers.
-
aries_cloudagent.config.logging.
get_logger_with_handlers
(settings: aries_cloudagent.config.base.BaseSettings, logger: logging.Logger, at_when: str = None, interval: int = None, backup_count: int = None, did_ident: str = None) → logging.Logger[source]¶ Return logger instance with necessary handlers if required.
-
aries_cloudagent.config.logging.
load_resource
(path: str, encoding: str = None) → TextIO[source]¶ Open a resource file located in a python package or the local filesystem.
Parameters: path – The resource path in the form of dir/file or package:dir/file Returns: A file-like object representing the resource
aries_cloudagent.config.plugin_settings module¶
Settings implementation for plugins.
-
class
aries_cloudagent.config.plugin_settings.
PluginSettings
(values: Optional[Mapping[str, Any]] = None)[source]¶ Bases:
aries_cloudagent.config.base.BaseSettings
Retrieve immutable settings for plugins.
Plugin settings should be retrieved by calling:
PluginSettings.for_plugin(settings, “my_plugin”, {“default”: “values”})This will extract the PLUGIN_CONFIG_KEY in “settings” and return a new PluginSettings instance.
-
copy
() → aries_cloudagent.config.base.BaseSettings[source]¶ Produce a copy of the settings instance.
-
extend
(other: Mapping[str, Any]) → aries_cloudagent.config.base.BaseSettings[source]¶ Merge another settings instance to produce a new instance.
-
classmethod
for_plugin
(settings: aries_cloudagent.config.base.BaseSettings, plugin: str, default: Optional[Mapping[str, Any]] = None) → aries_cloudagent.config.plugin_settings.PluginSettings[source]¶ Construct a PluginSettings object from another settings object.
PLUGIN_CONFIG_KEY is read from settings.
-
aries_cloudagent.config.provider module¶
Service provider implementations.
-
class
aries_cloudagent.config.provider.
CachedProvider
(provider: aries_cloudagent.config.base.BaseProvider, unique_settings_keys: tuple = ())[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Cache the result of another provider.
-
class
aries_cloudagent.config.provider.
ClassProvider
(instance_cls: Union[str, type], *ctor_args, init_method: str = None, **ctor_kwargs)[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Provider for a particular class.
-
class
aries_cloudagent.config.provider.
InstanceProvider
(instance)[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Provider for a previously-created instance.
-
class
aries_cloudagent.config.provider.
StatsProvider
(provider: aries_cloudagent.config.base.BaseProvider, methods: Sequence[str], *, ignore_missing: bool = True)[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Add statistics to the results of another provider.
aries_cloudagent.config.settings module¶
Settings implementation.
-
class
aries_cloudagent.config.settings.
Settings
(values: Optional[Mapping[str, Any]] = None)[source]¶ Bases:
aries_cloudagent.config.base.BaseSettings
,collections.abc.MutableMapping
,typing.Generic
Mutable settings implementation.
-
copy
() → aries_cloudagent.config.base.BaseSettings[source]¶ Produce a copy of the settings instance.
-
extend
(other: Mapping[str, Any]) → aries_cloudagent.config.base.BaseSettings[source]¶ Merge another settings instance to produce a new instance.
-
for_plugin
(plugin: str, default: Optional[Mapping[str, Any]] = None)[source]¶ Retrieve settings for plugin.
-
get_value
(*var_names, default=None)[source]¶ Fetch a setting.
Parameters: - var_names – A list of variable name alternatives
- default – The default value to return if none are defined
-
set_default
(var_name: str, value)[source]¶ Add a setting if not currently defined.
Parameters: - var_name – The name of the setting
- value – The value to assign
-
aries_cloudagent.config.util module¶
Entrypoint.
-
class
aries_cloudagent.config.util.
BoundedInt
(min: int = None, max: int = None)[source]¶ Bases:
object
Argument value parser for a bounded integer.