omnibot.utils package

Submodules

omnibot.utils.settings module

omnibot.utils.settings.bool_env(var_name, default=False)

Get an environment variable coerced to a boolean value.

Example:

Bash:

$ export SOME_VAL=True

settings.py:

SOME_VAL = bool_env(‘SOME_VAL’, False)

Arguments:

var_name: The name of the environment variable. default: The default to use if var_name is not specified in the environment.

Returns: var_name or default coerced to a boolean using the following

rules:

“False”, “false” or “” => False Any other non-empty string => True

omnibot.utils.settings.float_env(var_name, default=0.0)

Get an environment variable coerced to a float value. This has the same arguments as bool_env. If a value cannot be coerced to a float, a ValueError will be raised.

omnibot.utils.settings.int_env(var_name, default=0)

Get an environment variable coerced to an integer value. This has the same arguments as bool_env. If a value cannot be coerced to an integer, a ValueError will be raised.

omnibot.utils.settings.str_env(var_name, default='')

Get an environment variable as a string. This has the same arguments as bool_env.

Module contents

omnibot.utils.get_callback_id(component)

Retrieves the callback ID of the given interactive component. In the case the component corresponds to Slack’s newer block components, return its block ID instead, but treat it as though it were the callback ID to minimize code change as the two function similarly.

omnibot.utils.merge_logging_context(*args)

Merge return a merged dict of the logging context dicts passed in.