mirror of
https://github.com/KohakuBlueleaf/KohakuHub.git
synced 2026-03-11 17:34:08 -05:00
fix db impl to match current approach
This commit is contained in:
@@ -7,6 +7,7 @@ import hashlib
|
||||
import struct
|
||||
import zlib
|
||||
|
||||
|
||||
def compute_git_object_sha1(obj_type: str, content: bytes) -> str:
|
||||
"""Compute Git object SHA-1.
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ from typing import Optional
|
||||
|
||||
from fastapi.responses import Response
|
||||
|
||||
|
||||
class HFErrorCode:
|
||||
"""HuggingFace error codes for X-Error-Code header.
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ from fastapi import HTTPException
|
||||
|
||||
from kohakuhub.db import Organization, Repository, User, UserOrganization
|
||||
|
||||
|
||||
def check_namespace_permission(
|
||||
namespace: str, user: User, require_admin: bool = False
|
||||
) -> bool:
|
||||
|
||||
@@ -6,6 +6,7 @@ import secrets
|
||||
|
||||
import bcrypt
|
||||
|
||||
|
||||
def hash_password(password: str) -> str:
|
||||
"""Hash password with bcrypt."""
|
||||
return bcrypt.hashpw(password.encode(), bcrypt.gensalt()).decode()
|
||||
|
||||
@@ -21,6 +21,7 @@ from kohakuhub.db import (
|
||||
db,
|
||||
)
|
||||
|
||||
|
||||
# User operations
|
||||
def get_user_by_id(user_id: int) -> User | None:
|
||||
"""Get user by ID."""
|
||||
|
||||
@@ -7,6 +7,7 @@ from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Color:
|
||||
"""ANSI color codes for terminal output."""
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from kohakuhub.config import cfg
|
||||
from kohakuhub.lakefs_rest_client import LakeFSRestClient, get_lakefs_rest_client
|
||||
|
||||
|
||||
def get_lakefs_client() -> LakeFSRestClient:
|
||||
"""Get configured LakeFS REST client.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user