Self hosted FLOSS fitness/workout, nutrition and weight tracker
Use old python 3.9 syntax for types
Roland Geiderbb2726fdccb1
diff --git a/wger/nutrition/helpers.py b/wger/nutrition/helpers.pyindex c6b2e779b..9927542bd 100644--- a/wger/nutrition/helpers.py+++ b/wger/nutrition/helpers.py@@ -20,6 +20,7 @@ from dataclasses import (dataclass,)from decimal import Decimal+from typing import Union# wgerfrom wger.nutrition.consts import (@@ -102,14 +103,16 @@ class BaseMealItem:@dataclassclass NutritionalValues:- energy: Decimal | int | float = 0- protein: Decimal | int | float = 0- carbohydrates: Decimal | int | float = 0- carbohydrates_sugar: Decimal | int | float | None = None- fat: Decimal | int | float = 0- fat_saturated: Decimal | int | float | None = None- fibres: Decimal | int | float | None = None- sodium: Decimal | int | float | None = None+ # TODO: replace the Union with | when we drop support for python 3.9++ energy: Union[Decimal, int, float] = 0+ protein: Union[Decimal, int, float] = 0+ carbohydrates: Union[Decimal, int, float] = 0+ carbohydrates_sugar: Union[Decimal, int, float, None] = None+ fat: Union[Decimal, int, float] = 0+ fat_saturated: Union[Decimal, int, float, None] = None+ fibres: Union[Decimal, int, float, None] = None+ sodium: Union[Decimal, int, float, None] = None@propertydef energy_kilojoule(self):