Fixed invalid type in spool model

This commit is contained in:
Donkie
2023-07-04 14:28:52 +02:00
parent 243d634f75
commit 51783afe92

View File

@@ -139,7 +139,7 @@ class Spool(BaseModel):
def from_db(item: models.Spool) -> "Spool": def from_db(item: models.Spool) -> "Spool":
"""Create a new Pydantic spool object from a database spool object.""" """Create a new Pydantic spool object from a database spool object."""
filament = Filament.from_db(item.filament) filament = Filament.from_db(item.filament)
remaining_weight: float | None = None remaining_weight: Optional[float] = None # noqa: FA100
if filament.weight is not None: if filament.weight is not None:
remaining_weight = max(filament.weight - item.used_weight, 0) remaining_weight = max(filament.weight - item.used_weight, 0)