epochs package
Submodules
epochs.configparser module
Module defining parsers. The ConfigParser
is an extended
configparser
that can use a specification file to define types/default
values for the config files options, as well as to validate the file against.
The EpochParser
is a parser which organizes options by date. An option
value is found by matching the option in the section with the latest datetime
before the given datetime.
- class epochs.configparser.ConfigParser(spec_filename: str = None, **kwargs)[source]
Bases:
ConfigParser
ConfigParser subclass which can verify a config file against a specification and uses types/defaults from the specification.
- get(section: str, option: str, raw: bool = False, use_spec: bool = True, **kwargs) OptionValue [source]
Get an option using the type and default from the specification file
- Parameters:
section (str) – section name
option (str) – option name
raw (bool) – set to True to not interpolate
use_spec (bool) – set to False to not use the specification
- class epochs.configparser.EpochConfigParser(spec_filename: str = None, **kwargs)[source]
Bases:
object
EpochConfigParser parses config files with dates as section name. Retrieving an option for a given date returns the option value on the date closest, but before, the given date.
- property date
- property formats
- get(option: str, date: DateValue = None, raw: bool = False, **kwargs) OptionValue [source]
Get an option using the type and default from the specification file
- Parameters:
option (str) – option name
date (FileValue) – date as a string or
datetime.datetime
raw (bool) – set to True is disable interpolation
- is_valid(allow_extra_options: bool = False) bool [source]
Verify that the EpochParser matches the specification. A configparser without a spec is automatically valid.
Module contents
Top-level package for epochs.