datalad_core.config.ImplementationDefaults

class datalad_core.config.ImplementationDefaults None[source]

Bases: Defaults

Source 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 a KeyError exception.

When the default value is not given as an instance of Setting, it will be automatically wrapped into the one given by Source.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 self for convenient chaining of a load() call.

Return type:

Source

setall(key: Hashable, values: tuple[Setting, ...]) None

Implement to set all given values in the underlying source

Return type:

None