Beemon Configuration Classes:
- class configuration.Config(path=None)[source]
Todo
Docstrings.
- class __ConfigInstance(path)
Todo
Docstrings.
- __init__(path)
Todo
Docstrings.
- Parameters:
path
- __weakref__
list of weak references to the object
- get(section: str, key: str, default: Any)
Todo
Docstrings, return type and type-hints.
Gets a configuration value, deferring to a custom configuration section, if specified.
- Parameters:
section – the section to get the value from
key – the key of the configuration value
default – what to return if it doesn’t exist
- Returns:
The configuration value if it is found, otherwise the default specified.
- get_raw(section, key, default)
Todo
Docstrings, return types, and type-hints.
Gets a configuration value, without checking for a custom configuration section.
- Parameters:
section – the section to get the value from
key – the key of the configuration value
default – what to return if it doesn’t exist
- Returns:
The configuration value if it is found, otherwise the default specified.
- write()
Writes the configuration file representation in memory to disk in a multiprocessing safe manner.
- __weakref__
list of weak references to the object
- parse_global_config() Tuple[timezone, str, str, datetime, datetime, int, int, bool] [source]
Convenience/utility method for parsing information from the
[global]
section of thebeemon-config.ini
configuration file.- Returns:
pytz_time_zone (
datetime.tzinfo
): The timezone to whichcapture_window_start_time
andcapture_window_end_time
should be converted to when populating the recording start time queues.root_upload_dir (str): The absolute path to the upload directory on the specified
'host'
machine in the['sftp']
setting of thebeemon-config.ini
. This parameter is not expected to be overridden on a per-sensor basis.local_output_dir (str): The absolute path to the temporary data storage location on the Raspberry Pi to which data will be written prior to being uploaded to the specified
'host'
. This parameter is not expected to be overridden on a per-sensor basis.capture_window_start_datetime (:class:datetime.datetime`): A
datetime
aware object which specifies what time to start recording data from all sensors. Note that this parameter may be overridden on a per-sensor basis.capture_window_end_datetime (
datetime.datetime
): Adatetime
aware object which specifies what time to start recording data from all sensors. Note that this parameter may be overridden on a per-sensor basis.capture_duration_seconds (int): How long each sensor should be instructed to record for (if applicable) in seconds. Note that this parameter may be overridden on a per-sensor basis.
capture_interval_seconds (int): How long to wait (in seconds) before instructing all sensors to record again for the duration specified by
capture_duration_seconds
. Note that this parameter may be overridden on a per-sensor basis.auto_start (bool): Whether or not all sensors should be instructed to automatically record at the specified
capture_window_start_time
. If this flag is disabled, then recording commands are expected to be issued manually. Note that this parameter may be overridden on a per-sensor basis.
- Return type:
Tuple[
datetime.tzinfo
, str, str,datetime.datetime
,datetime.datetime
, int, int, bool]- Raises:
NotImplementedError – This method will raise a
NotImplementedError
in the event that the specifiedpytz_time_zone
in thebeemon-config.ini
does not yet have a corresponding datetime conversion method indatetimeutils
.
- type_check(section: str, key: str)[source]
Runs sanity checks based on the expected types and values of the associated value in the config file.
- Parameters:
- Raises:
ValueError – This method raises an
ValueError
in the event that the section/key pair has a type that does not match what the parser expects.