restructured project to have /src folder

This commit is contained in:
Cian Hughes
2023-10-31 09:44:34 +00:00
parent 1b22fd7861
commit 289922bea7
16 changed files with 2 additions and 1 deletions

24
src/debug.py Normal file
View File

@@ -0,0 +1,24 @@
from functools import wraps
import inspect
from typing import Callable
import typer # type: ignore
import config
def debug_guard(f: Callable) -> Callable:
if not config.DEBUG:
return f
try:
import snoop # type: ignore
except ImportError:
typer.echo("Debug mode requires the snoop package")
raise typer.Exit(1)
else:
snoop.install(
snoop="ss",
)
typer.echo(f"Debug mode enabled: {inspect.stack()[1].filename}")
wraps(f)(ss)(f) # noqa: F821 #* ss is installed in debug_mode