twtb.utils#

Module for some of our utils.

Module Contents#

Classes#

Singleton

Metaclass to do Singleton pattern.

Functions#

setup_logging(→ None)

Setup logging for the addon.

start_sentry(→ None)

Start Sentry listening.

_get_commit(→ Optional[str])

Get current commit from commit.txt file.

remove_prefix(→ str)

Remove prefix from the string.

remove_suffix(→ str)

Remove suffix from the string.

class Singleton[source]#

Bases: type

Metaclass to do Singleton pattern.

_instances: dict[type, Any][source]#
__call__(*args, **kwargs)[source]#

Actual logic in this class.

See https://stackoverflow.com/a/6798042.

setup_logging() None[source]#

Setup logging for the addon.

start_sentry() None[source]#

Start Sentry listening.

_get_commit(commit_txt_path: pathlib.Path) str | None[source]#

Get current commit from commit.txt file.

remove_prefix(string: str, prefix: str) str[source]#

Remove prefix from the string.

remove_suffix(string: str, suffix: str) str[source]#

Remove suffix from the string.