1
0

Kompletter Rewrite

This commit is contained in:
Akamaru
2025-09-08 17:19:22 +02:00
parent edf0012917
commit 7e377363c6
18 changed files with 1688 additions and 1052 deletions

31
models/category.py Normal file
View File

@@ -0,0 +1,31 @@
from typing import List, Set
class CategoryManager:
def __init__(self):
self._categories: Set[str] = set()
@property
def categories(self) -> List[str]:
return sorted(list(self._categories))
def add_category(self, category: str) -> bool:
if not category or category in self._categories:
return False
self._categories.add(category)
return True
def remove_category(self, category: str) -> bool:
if category not in self._categories:
return False
self._categories.remove(category)
return True
def has_category(self, category: str) -> bool:
return category in self._categories
def load_from_data(self, categories: List[str]):
self._categories = set(categories)
def to_list(self) -> List[str]:
return self.categories