epochs package
Submodules
epochs.cli module
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, inherit: str = None, **kwargs)[source]
Bases:
ConfigParserConfigParser 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
- is_valid(allow_extra_options: bool = False) bool[source]
Verify that the
ConfigParsermatches the specification. AConfigParserwithout a spec is automatically valid.
- read(filenames, encoding=None)[source]
Read and parse a filename or an iterable of filenames.
Files that cannot be opened are silently ignored; this is designed so that you can specify an iterable of potential configuration file locations (e.g. current directory, user’s home directory, systemwide directory), and all existing configuration files in the iterable will be read. A single filename may also be given.
Return list of successfully read files.
- class epochs.configparser.EpochConfigParser(spec_filename: str = None, **kwargs)[source]
Bases:
objectEpochConfigParser 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.datetimeraw (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.
epochs.timeline module
Module contents
Top-level package for epochs.