A map from configuration files to data
ConfigurationMap constructor
Param: |
|
---|
ConfigurationMap constructor
Param: |
|
---|
Methods
__init__(filename) | ConfigurationMap constructor | ||
get(section, option[, optional, default]) | Gets the option from the section as a string | ||
get_boolean(section, option[, optional, default]) | Gets a value and casts it to a boolean | ||
get_datetime(section, option[, optional, ...]) | Gets a datetime object based on the option (value is timestamp) (see timemap.AbsoluteTime) | ||
get_dictionary(section, option[, optional, ...]) | converts a delimiter-separated line to a key:value based dictionary (values are strings) | ||
get_float(section, option[, optional, default]) | gets the value as a float | ||
get_int(section, option[, optional, default]) | gets the value as an integer | ||
get_list(section, option[, optional, ...]) | Gets the value and converts it to a list | ||
get_named_tuple(section, option[, optional, ...]) | Converts a line to a named tuple (Like the get_dictionary but keys are properties) | ||
get_ordered_dictionary(section, option[, ...]) | converts a delimiter-separated line to a key:value based dictionary (values are strings) | ||
get_relativetime(section, option[, ...]) | Gets a relativetime object based on the option (assumes value is timestamp) (see timemap.RelativeTime) | ||
get_tuple(section, option[, optional, ...]) | Gets the value and converts it to a list | ||
get_type(cast, section, option[, optional, ...]) | Gets a value and casts it | ||
getboolean(section, option[, optional, default]) | Gets a value and casts it to a boolean | ||
getfloat(section, option[, optional, default]) | gets the value as a float | ||
getint(section, option[, optional, default]) | gets the value as an integer | ||
has_option(section, option) |
|
||
items(section[, optional, default]) | Gets tuples of (option, value) pairs for section | ||
log_error(error[, message]) | Logs the error in bold red | ||
options(section[, optional, default]) | gets a list of option-names | ||
write(path) | Writes the current configuration to the path (filename) |
Attributes
defaults | the [DEFAULT] section | ||
logger |
|
||
parser | A SafeConfigParser instance with allow_no_value set to True | ||
sections |
|
Gets the option from the section as a string
Param: |
|
---|
Gets a value and casts it to a boolean
Param: |
|
---|---|
Returns: | value from section:option |
Raise: | ConfigurationError if it can’t be cast |
Gets a datetime object based on the option (value is timestamp) (see timemap.AbsoluteTime)
Returns: | datetime object or default |
---|
converts a delimiter-separated line to a key:value based dictionary (values are strings)
gets the value as a float
gets the value as an integer
Returns: | value from section:option |
---|---|
Raise: | ConfigurationError if it can’t be cast |
Gets the value and converts it to a list
Returns: | value list with whitespace trimmed |
---|
Converts a line to a named tuple (Like the get_dictionary but keys are properties)
namedtuple(section, fields)
Param: |
|
---|
converts a delimiter-separated line to a key:value based dictionary (values are strings)
Gets a relativetime object based on the option (assumes value is timestamp) (see timemap.RelativeTime)
Returns: | RelativeTime object |
---|
Gets the value and converts it to a list
Returns: | value list with whitespace trimmed |
---|
Gets a value and casts it
Param: |
|
---|---|
Returns: | value from section:option |
Raise: | ConfigurationError if it can’t be cast |
Gets a value and casts it to a boolean
Param: |
|
---|---|
Returns: | value from section:option |
Raise: | ConfigurationError if it can’t be cast |
gets the value as a float
gets the value as an integer
Returns: | value from section:option |
---|---|
Raise: | ConfigurationError if it can’t be cast |
Returns: | True if section has this option |
---|
Gets tuples of (option, value) pairs for section
Returns: | tuples |
---|
Logs the error in bold red
Param: |
|
---|
gets a list of option-names
Param: |
|
---|---|
Returns: | options in section |
Writes the current configuration to the path (filename)
the [DEFAULT] section
Returns: | dict of default values |
---|
Returns: | A logging object. |
---|
A SafeConfigParser instance with allow_no_value set to True
Returns: | section names other than DEFAULT |
---|