[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2026-04-10 13:33:49 +00:00
commit ae4ff49924
2 changed files with 5 additions and 5 deletions

View file

@ -393,7 +393,7 @@ def create_api_key(
"""
raw_key = API_KEY_PREFIX + secrets.token_hex(16)
key_hash = _hash_token(raw_key)
key_prefix = raw_key[len(API_KEY_PREFIX): len(API_KEY_PREFIX) + 8]
key_prefix = raw_key[len(API_KEY_PREFIX) : len(API_KEY_PREFIX) + 8]
now = datetime.now(timezone.utc).isoformat()
conn = get_connection()
@ -406,9 +406,7 @@ def create_api_key(
(username, key_prefix, key_hash, name, now, expires_at),
)
conn.commit()
cur = conn.execute(
"SELECT * FROM api_keys WHERE key_hash = ?", (key_hash,)
)
cur = conn.execute("SELECT * FROM api_keys WHERE key_hash = ?", (key_hash,))
row = cur.fetchone()
return raw_key, dict(row)
finally:

View file

@ -68,7 +68,9 @@ class ApiKeyResponse(BaseModel):
id: int
name: str
key_prefix: str = Field(..., description = "First 8 characters after sk-unsloth- for display")
key_prefix: str = Field(
..., description = "First 8 characters after sk-unsloth- for display"
)
created_at: str
last_used_at: Optional[str] = None
expires_at: Optional[str] = None