💄 Introduce black & isort

This commit is contained in:
Brian Wiborg 2025-09-28 15:41:01 +02:00
parent 9becfc857d
commit 6a90e4a44a
No known key found for this signature in database
14 changed files with 311 additions and 89 deletions

View file

@ -2,14 +2,17 @@ import asyncio
import atexit
import importlib
import sys
from getpass import getpass
from pathlib import Path
import typer
import uvicorn
from getpass import getpass
from ohmyapi.core import scaffolding, runtime
from pathlib import Path
from ohmyapi.core import runtime, scaffolding
app = typer.Typer(help="OhMyAPI — Django-flavored FastAPI scaffolding with tightly integrated TortoiseORM.")
app = typer.Typer(
help="OhMyAPI — Django-flavored FastAPI scaffolding with tightly integrated TortoiseORM."
)
@app.command()
@ -78,6 +81,7 @@ def shell(root: str = "."):
start_ipython(argv=[], user_ns=shell_vars, config=c)
except ImportError:
import code
code.interact(local=shell_vars, banner=banner)
finally:
loop.run_until_complete(cleanup())
@ -120,11 +124,15 @@ def createsuperuser(root: str = "."):
project_path = Path(root).resolve()
project = runtime.Project(project_path)
if not project.is_app_installed("ohmyapi_auth"):
print("Auth app not installed! Please add 'ohmyapi_auth' to your INSTALLED_APPS.")
print(
"Auth app not installed! Please add 'ohmyapi_auth' to your INSTALLED_APPS."
)
return
import asyncio
import ohmyapi_auth
email = input("E-Mail: ")
username = input("Username: ")
password1, password2 = "foo", "bar"
@ -133,9 +141,10 @@ def createsuperuser(root: str = "."):
password2 = getpass("Repeat Password: ")
if password1 != password2:
print("Passwords didn't match!")
user = ohmyapi_auth.models.User(email=email, username=username, is_staff=True, is_admin=True)
user = ohmyapi_auth.models.User(
email=email, username=username, is_staff=True, is_admin=True
)
user.set_password(password1)
asyncio.run(project.init_orm())
asyncio.run(user.save())
asyncio.run(project.close_orm())