datalad_core.config.ImplementationDefaults
- class datalad_core.config.ImplementationDefaults None[source]
Bases:
DefaultsSource for registering implementation defaults of settings
This is a in-memory only source that is populated by any implementations that want to expose their configuration options.
- add(key: Hashable, value: Setting) None
Add a additional setting under a given key
If the key is not yet known, it will be added, and the given setting will become the first assigned value.
- Return type:
None
- get(key: Hashable, default: Any = None) Setting
Return a particular setting identified by its key, or a default
This method calls
__getitem__, and returns the default on aKeyErrorexception.When the
defaultvalue is not given as an instance ofSetting, it will be automatically wrapped into the one given bySource.item_type.- Return type:
Setting
- getall(key: Hashable, default: Any = None) tuple[Setting, ...]
Return all individual settings registered for a key
Derived classes for source that can represent multiple values for a single key should reimplement the internal accessor
Source._getall()appropriately.- Return type:
tuple[Setting,...]
- is_writable = True
- item_type
alias of
Setting
- keys() Collection
Returns all setting keys known to a source
- Return type:
Collection
- load() None
Load items from the underlying source.
This default implementation calls a source’s internal _load() method. It is expected that after calling this method, an instance of this source reports on items according to the latest state of the source.
No side-effects are implied. Particular implementations may even choose to have this method be a no-op.
Importantly, calling this method does not imply a call to
reinit(). If a from-scratch reload is desired,reinit()must be called explicitly.- Return type:
None
- reinit() Source
Re-initialize source instance
Re-initializing is resetting any state of the source interface instance such that a subsequent
load()fully synchronizes the reporting of settings with the state of the underlying source. Calling this method does not imply resetting the underlying settings source (e.g., removing all settings from the source).This method returns
selffor convenient chaining of aload()call.- Return type:
Source
- setall(key: Hashable, values: tuple[Setting, ...]) None
Implement to set all given values in the underlying source
- Return type:
None