decorators
dev_tool.decorators
F = TypeVar('F', bound=(Callable[..., Any]))
module-attribute
log = logging.getLogger(__name__)
module-attribute
is_developer_token
A decorator that checks if the developer token file exists and contains a token.
Parameters:
-
func(F) –The function to decorate.
Returns:
-
F–The decorated function.
Raises:
-
FileNotFoundError–If the token file does not exist or is empty.
Source code in dev_tool/decorators.py
is_django_environment_variables
A decorator that checks if required Django environment variables are set.
Parameters:
-
func(F) –The function to decorate.
Returns:
-
F–The decorated function.
Raises:
-
MissingDjangoEnvironmentVariableError–If any required variables are missing.
Source code in dev_tool/decorators.py
is_postgres_environment_variables
A decorator that checks if required PostgreSQL environment variables are set.
Parameters:
-
func(F) –The function to decorate.
Returns:
-
F–The decorated function.
Raises:
-
MissingPostgresEnvironmentVariableError–If any required variables are missing.
Source code in dev_tool/decorators.py
is_pyproject
A decorator that checks if the pyproject.toml file exists.
Parameters:
-
func(F) –The function to decorate.
Returns:
-
F–The decorated function.
Raises:
-
FileNotFoundError–If the pyproject.toml file does not exist.
Source code in dev_tool/decorators.py
is_settings
A decorator that checks if Django settings are correctly configured.
Parameters:
-
func(F) –The function to decorate.
Returns:
-
F–The decorated function.
Raises:
-
RuntimeError–If Django settings are not correctly configured.
Source code in dev_tool/decorators.py
is_virtual_environment
A decorator that checks if a virtual environment exists.
Parameters:
-
func(F) –The function to decorate.
Returns:
-
F–The decorated function, or None if the virtual environment does not exist.
Source code in dev_tool/decorators.py
retry_on_failure
A decorator that retries a function on failure.
Parameters:
-
maximum_retries(int, default:10) –The maximum number of retry attempts.
-
delay(int, default:2) –The delay in seconds between retry attempts.
-
exceptions(tuple[type[Exception], ...], default:(OperationalError,)) –The exceptions to catch and retry on.
Returns: