_clockalarm.utils package

Submodules

_clockalarm.utils.importExportUtils module

_clockalarm.utils.importExportUtils.export_alerts_file(dest)[source]

Copy the file at ALERT_DB_PATH into the .json location specified the argument

If existing, the destination file is erased.

Parameters:dest (str) – full path of the destination location
Exceptions:
FileNotFoundException: If the given destination file doesn’t exist or haven’t a json extension shutil.SameFileError: If the src and destination files are the same
_clockalarm.utils.importExportUtils.get_default_config(key, cmd=’str’)[source]

Read the configuration file and return the value for the given key

The cmd attribute defines the type of the value. Default is str.

_clockalarm.utils.importExportUtils.key

The key of the key-value pair in the config file

_clockalarm.utils.importExportUtils.cmd

Type of the desired value. Default is str.

Exceptions:
KeyError: Is the key doesn’t match any key in the config file. configparser.NoSectionError: If the config file or the section doesn’t exist.
_clockalarm.utils.importExportUtils.import_alerts_file(src)[source]

Copy the .json file given as argument into the location specified by ALERT_DB_PATH

If existing, the destination file is erased. All the application is restarted after an import.

Parameters:src (str) – full path of the source json database
Exceptions:
FileNotFoundException: If the given source file doesn’t exist or isn’t a json file SameFileError: If the src and destination files are the same
_clockalarm.utils.importExportUtils.set_default_config(key, value)[source]

Set the given (key,value) pair in the config file.

Preserves the Caps

_clockalarm.utils.importExportUtils.key

the key

_clockalarm.utils.importExportUtils.value

the value

Exceptions:
configparser.NoSectionError: If the config file or the section doesn’t exist.

Module contents