M byceps/blueprints/admin/orga_presence/views.py => byceps/blueprints/admin/orga_presence/views.py +1 -1
@@ 71,7 71,7 @@ def view(party_id):
def _group_presences_by_orga(
presences: Iterable[PresenceTimeSlot],
-) -> dict[User, PresenceTimeSlot]:
+) -> dict[User, set[PresenceTimeSlot]]:
d = defaultdict(set)
for presence in presences:
M byceps/blueprints/site/board/service.py => byceps/blueprints/site/board/service.py +1 -1
@@ 134,7 134,7 @@ def enrich_creators(
for posting in postings:
user_id = posting.creator_id
- badges = badges_by_user_id.get(user_id, frozenset())
+ badges = badges_by_user_id.get(user_id, set())
if user_id in ticket_users:
ticket = Ticket(party.title)
M byceps/services/consent/subject_service.py => byceps/services/consent/subject_service.py +1 -1
@@ 31,7 31,7 @@ def create_subject(
title: str,
checkbox_label: str,
checkbox_link_target: Optional[str],
-) -> SubjectID:
+) -> Subject:
"""Create a new subject."""
subject = DbSubject(name, title, checkbox_label, checkbox_link_target)
M byceps/services/orga/birthday_service.py => byceps/services/orga/birthday_service.py +1 -1
@@ 65,7 65,7 @@ def _collect_orgas_with_known_birthdays() -> Iterator[tuple[User, Birthday]]:
def _to_user_dto(
- user: DbUser, avatar_urls_by_user_id: dict[UserID, str]
+ user: DbUser, avatar_urls_by_user_id: dict[UserID, Optional[str]]
) -> User:
"""Create user DTO from database entity."""
avatar_url = avatar_urls_by_user_id.get(user.id)
M byceps/services/shop/article/service.py => byceps/services/shop/article/service.py +1 -1
@@ 213,7 213,7 @@ def get_articles_by_numbers(
) -> set[Article]:
"""Return the articles with those numbers."""
if not article_numbers:
- return []
+ return set()
rows = DbArticle.query \
.filter(DbArticle.item_number.in_(article_numbers)) \
M byceps/services/shop/cart/models.py => byceps/services/shop/cart/models.py +3 -3
@@ 12,13 12,13 @@ from typing import Sequence
from ....util.instances import ReprBuilder
-from ..article.dbmodels.article import Article as DbArticle
+from ..article.transfer.models import Article
class CartItem:
"""An article with a quantity."""
- def __init__(self, article: DbArticle, quantity: int) -> None:
+ def __init__(self, article: Article, quantity: int) -> None:
if quantity < 1:
raise ValueError('Quantity must be a positive number.')
@@ 40,7 40,7 @@ class Cart:
def __init__(self) -> None:
self._items: list[CartItem] = []
- def add_item(self, article: DbArticle, quantity: int) -> None:
+ def add_item(self, article: Article, quantity: int) -> None:
item = CartItem(article, quantity)
self._items.append(item)
M byceps/services/shop/order/transfer/models.py => byceps/services/shop/order/transfer/models.py +1 -1
@@ 92,4 92,4 @@ class Order:
is_invoiced: bool
is_shipping_required: bool
is_shipped: bool
- cancelation_reason: str
+ cancelation_reason: Optional[str]
M byceps/services/shop/shipping/service.py => byceps/services/shop/shipping/service.py +1 -1
@@ 116,7 116,7 @@ def _get_article_descriptions(
) -> dict[ArticleNumber, str]:
"""Look up description texts of the specified articles."""
if not article_numbers:
- return []
+ return {}
articles = DbArticle.query \
.options(db.load_only('item_number', 'description')) \
M byceps/services/tourney/category_service.py => byceps/services/tourney/category_service.py +1 -3
@@ 91,9 91,7 @@ def delete_category(category_id: TourneyCategoryID) -> None:
db.session.commit()
-def find_category(
- category_id: TourneyCategoryID,
-) -> Optional[DbTourneyCategory]:
+def find_category(category_id: TourneyCategoryID) -> Optional[TourneyCategory]:
"""Return the category with that id, or `None` if not found."""
category = _find_db_category(category_id)
M byceps/services/tourney/tourney_service.py => byceps/services/tourney/tourney_service.py +4 -4
@@ 95,7 95,7 @@ def delete_tourney(tourney_id: TourneyID) -> None:
db.session.commit()
-def find_tourney(tourney_id: int) -> Optional[Tourney]:
+def find_tourney(tourney_id: TourneyID) -> Optional[Tourney]:
"""Return the tourney with that id, or `None` if not found."""
tourney = _find_db_tourney(tourney_id)
@@ 109,7 109,7 @@ def _find_db_tourney(tourney_id: TourneyID) -> Optional[DbTourney]:
return DbTourney.query.get(tourney_id)
-def get_tourney(tourney_id: int) -> Tourney:
+def get_tourney(tourney_id: TourneyID) -> Tourney:
"""Return the tourney with that ID.
Raise an exception if not found.
@@ 122,7 122,7 @@ def get_tourney(tourney_id: int) -> Tourney:
return tourney
-def _get_db_tourney(tourney_id: int) -> DbTourney:
+def _get_db_tourney(tourney_id: TourneyID) -> DbTourney:
tourney = _find_db_tourney(tourney_id)
if tourney is None:
@@ 165,7 165,7 @@ def _to_tourney_with_category(
db_tourney: DbTourney,
db_category: DbTourneyCategory,
current_participant_count: int = -1,
-) -> Tourney:
+) -> TourneyWithCategory:
tourney = _db_entity_to_tourney(db_tourney, current_participant_count)
category = category_service._db_entity_to_category(db_category)
M byceps/services/user/service.py => byceps/services/user/service.py +1 -1
@@ 227,7 227,7 @@ def find_user_with_details(user_id: UserID) -> Optional[DbUser]:
.get(user_id)
-def get_db_user(user_id: UserID) -> Optional[DbUser]:
+def get_db_user(user_id: UserID) -> DbUser:
"""Return the user with that ID, or raise an exception."""
user = DbUser.query.get(user_id)
M byceps/services/user_avatar/service.py => byceps/services/user_avatar/service.py +3 -1
@@ 95,7 95,9 @@ def get_avatar_url_for_user(user_id: UserID) -> Optional[str]:
return avatar_urls_by_user_id.get(user_id)
-def get_avatar_urls_for_users(user_ids: set[UserID]) -> dict[UserID, str]:
+def get_avatar_urls_for_users(
+ user_ids: set[UserID],
+) -> dict[UserID, Optional[str]]:
"""Return the URLs of those users' current avatars."""
if not user_ids:
return {}
M byceps/services/webhooks/transfer/models.py => byceps/services/webhooks/transfer/models.py +1 -1
@@ 24,7 24,7 @@ class OutgoingWebhook:
event_selectors: EventSelectors
format: str
text_prefix: Optional[str]
- extra_fields: Optional[dict[str, Any]]
+ extra_fields: dict[str, Any]
url: str
description: str
enabled: bool