Utilities

ehforwarderbot.utils.extra(name: str, desc: str) → Callable[source]

Decorator for slave channel’s “additional features” interface.

Parameters
  • name (str) – A human readable name for the function.

  • desc (str) – A short description and usage of it. Use {function_name} in place of the function name in the description.

Returns

The decorated method.

ehforwarderbot.utils.get_base_path() → pathlib.Path[source]

Get the base data path for EFB. This can be defined by the environment variable EFB_DATA_PATH.

If EFB_DATA_PATH is not defined, this gives ~/.ehforwarderbot.

This method creates the queried path if not existing.

Returns

The base path.

ehforwarderbot.utils.get_config_path(module_id: str = None, ext: str = 'yaml') → pathlib.Path[source]

Get path for configuration file. Defaulted to ~/.ehforwarderbot/profiles/profile_name/channel_id/config.yaml.

This method creates the queried path if not existing. The config file will not be created, however.

Parameters
  • module_id (str) – Module ID.

  • ext (Optional[Str]) – Extension name of the config file. Defaulted to "yaml".

Returns

The path to the configuration file.

ehforwarderbot.utils.get_custom_modules_path() → pathlib.Path[source]

Get the path to custom channels

Returns

The path for custom channels.

ehforwarderbot.utils.get_data_path(module_id: str) → pathlib.Path[source]

Get the path for persistent storage of a module.

This method creates the queried path if not existing.

Parameters

module_id (str) – Module ID

Returns

The data path of indicated module.

ehforwarderbot.utils.locate_module(module_id: str, module_type: str = None)[source]

Locate module by module ID

Parameters
  • module_id – Module ID

  • module_type – Type of module, one of 'master', 'slave' and 'middleware'