Storing additional information about variables

The additional information associated with envprobe.vartypes.EnvVar instances are persisted through this configuration handler.

class VariableInformation(configuration=None)

Represents a persisted configuration file of the user which stores additional information about environment variables.

Initialise a variable configuration manager.

This instantiation is cheap. Accessing the underlying data is only done when a query or a setter function is called.

Parameters

configuration (context-capable dict, optional) –

__delitem__(variable_name)

Removes the configuration associated with the given variable.

Parameters

variable_name (str) – The name of the variable to remove.

__getitem__(variable_name)

Retrieve the configuration for the given variable.

Returns

config – The configuration mapping associated with the variable. This can be used to instantiate an envprobe.vartypes.envvar.EnvVarExtendedInformation.

Return type

dict

keys()

Returns the variable names that have a configuration.

set(variable_name, configuration, source)

Sets the stored configuration of the given variable to a new value.

Parameters
  • variable_name (str) – The name of the variable to set.

  • config (envprobe.vartypes.envvar.EnvVarExtendedInformation) – The configuration associated with the variable. This is automatically mapped to the persisted representation.

  • source (str) – The identifier of the configuration source repository to annotate the saved configuration with.