b.c.Stack(object) : class documentation

Part of bzrlib.config View In Hierarchy

Known subclasses: bzrlib.config._CompatibleStack

A stack of configurations where an option can be defined
Method __init__ Creates a stack of sections with an optional store for changes.
Method get Return the first option value found in the sections.
Method expand_options Expand option references in the string in the configuration context.
Method set Set a new value for the option.
Method remove Remove an existing option.
Method __repr__ Undocumented
Method _expand_options_in_string Expand options in the string in the configuration context.
Method _expand_option Undocumented
Method _get_mutable_section Get the MutableSection for the Stack.
Method _get_overrides Undocumented
def __init__(self, sections_def, store=None, mutable_section_name=None):
Creates a stack of sections with an optional store for changes.
Parameterssections_defA list of Section or callables that returns an iterable of Section. This defines the Sections for the Stack and can be called repeatedly if needed.
storeThe optional Store where modifications will be recorded. If none is specified, no modifications can be done.
mutable_section_nameThe name of the MutableSection where changes are recorded. This requires the store parameter to be specified.
def get(self, name, expand=None):
Return the first option value found in the sections.

This is where we guarantee that sections coming from Store are loaded lazily: the loading is delayed until we need to either check that an option exists or get its value, which in turn may require to discover in which sections it can be defined. Both of these (section and option existence) require loading the store (even partially).

ParametersnameThe queried option.
expandWhether options references should be expanded.
ReturnsThe value of the option.
def expand_options(self, string, env=None):
Expand option references in the string in the configuration context.
ParametersstringThe string containing option(s) to expand.
envAn option dict defining additional configuration options or overriding existing ones.
ReturnsThe expanded string.
def _expand_options_in_string(self, string, env=None, _refs=None):
Expand options in the string in the configuration context.
ParametersstringThe string to be expanded.
envAn option dict defining additional configuration options or overriding existing ones.
_refsPrivate list (FIFO) containing the options being expanded to detect loops.
ReturnsThe expanded string.
def _expand_option(self, name, env, _refs):
Undocumented
def _get_mutable_section(self):
Get the MutableSection for the Stack.

This is where we guarantee that the mutable section is lazily loaded: this means we won't load the corresponding store before setting a value or deleting an option. In practice the store will often be loaded but this allows helps catching some programming errors.

def set(self, name, value):
Set a new value for the option.
def remove(self, name):
Remove an existing option.
def __repr__(self):
Undocumented
def _get_overrides(self):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2019-07-21 00:34:56.