1
0
Fork 0

refactor: some minor cleanup

This commit is contained in:
Arthur K. 2026-03-02 19:33:43 +03:00
parent 307ca38ecc
commit 858d127246
Signed by: wzray
GPG key ID: B97F30FDC4636357
12 changed files with 84 additions and 59 deletions

13
src/utils/randoms.py Normal file
View file

@ -0,0 +1,13 @@
import random
import secrets
import string
def generate_password(
length: int = 20,
*,
secure: bool = True,
) -> str:
alphabet = string.ascii_letters + string.digits
chooser = secrets.choice if secure else random.choice
return "".join(chooser(alphabet) for _ in range(length))