github-repo-stats / src /models.py
sukiboo's picture
add ugly histogram
b3df080
Raw
History Blame Contribute Delete
682 Bytes
import threading
from pydantic import BaseModel, Field
class RepoStats(BaseModel):
languages: dict[str, int]
files: int
commits: int | None = None
branches: int | None = None
histogram: list[tuple[int, int]] = Field(default_factory=list)
class CacheEntry(BaseModel):
stats: RepoStats
time: float
class ProgressState:
def __init__(self) -> None:
self.languages: dict[str, int] = {}
self.completed: int = 0
self.total: int = 0
self.lock: threading.Lock = threading.Lock()
self.commits: int | None = None
self.branches: int | None = None
self.histogram: list[tuple[int, int]] | None = None