Skip to content

Commit

Permalink
Merge pull request #848 from geigi/ich-hab-scheiße-gebaut
Browse files Browse the repository at this point in the history
Fix accidentaly messed up return type default_location getter
  • Loading branch information
geigi authored Feb 16, 2024
2 parents 90cd028 + 26fb5bb commit 9a4f95d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cozy/model/settings.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import logging
from typing import NoReturn

import peewee

import cozy.ext.inject as inject
from peewee import SqliteDatabase

import cozy.ext.inject as inject
from cozy.db.book import Book
from cozy.db.settings import Settings as SettingsModel
from cozy.db.storage import Storage as StorageModel
from cozy.model.storage import Storage, InvalidPath
from cozy.model.storage import InvalidPath, Storage
from cozy.report import reporter

log = logging.getLogger("model.storage_location")
Expand Down Expand Up @@ -51,8 +51,11 @@ def last_played_book(self, new_value) -> None:
self._db_object.save(only=self._db_object.dirty_fields)

@property
def default_location(self) -> Storage:
return next(location for location in self.storage_locations if location.default)
def default_location(self) -> Storage | NoReturn:
for location in self.storage_locations:
if location.default:
return location
raise AssertionError("This should never happen")

@property
def storage_locations(self) -> list[Storage]:
Expand Down

0 comments on commit 9a4f95d

Please sign in to comment.