class documentation

class EnvironmentExpander: (source)

Constructor: EnvironmentExpander()

View In Hierarchy

This class expands environment variables referenced in ini files.

An environment_variable is declared as &{<environment-variable-name>}.

All environment errors found in the INI file are collected and can be retrieved by calling the I{get_expand_errors()} method.

Method __init__ Initialize class attributes.
Method expand_environment_variables Return the text with environment_variables expanded.
Method get_expand_errors Return all expanding errors (undefined environment_variables).
Instance Variable error Validation errors.
Method _environment_variable_of Return specified environment variable for a matching object.
def __init__(self): (source)

Initialize class attributes.

def expand_environment_variables(self, text: str) -> str: (source)

Return the text with environment_variables expanded.

Parameters
text:strExpanded text.
Returns
strExpanded text.
def get_expand_errors(self) -> list: (source)

Return all expanding errors (undefined environment_variables).

Returns
listList of expanding errors.

Validation errors.

def _environment_variable_of(self, match_obj: re.Match) -> str: (source)

Return specified environment variable for a matching object.

Keep track of all expand errors, so they can be retrieved later. When an error occurs, the unexpanded value is returned.

Parameters
match_obj:re.MatchMatched pattern object.
Returns
strValue of environment variable.