Skip to content

Commit

Permalink
🩹
Browse files Browse the repository at this point in the history
  • Loading branch information
lord-haffi committed Oct 6, 2023
1 parent 07a53c5 commit cdb5aaa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
12 changes: 2 additions & 10 deletions src/bo4e/bo/geschaeftsobjekt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pylint: disable=missing-module-docstring
from decimal import Decimal
from typing import Optional
from typing import Annotated, Optional

from humps.main import camelize

Expand Down Expand Up @@ -37,15 +37,7 @@ class Geschaeftsobjekt(BaseModel):

# Python internal: The field is not named '_id' because leading underscores are not allowed in pydantic field names.
# NameError: Fields must not use names with leading underscores; e.g., use 'id' instead of '_id'.
id: Optional[str] = Field(alias="_id", default=None)
"""
Eine generische ID, die für eigene Zwecke genutzt werden kann.
Z.B. könnten hier UUIDs aus einer Datenbank stehen oder URLs zu einem Backend-System.
"""

# Python internal: The field is not named '_id' because leading underscores are not allowed in pydantic field names.
# NameError: Fields must not use names with leading underscores; e.g., use 'id' instead of '_id'.
id: Optional[str] = Field(alias="_id", default=None)
id: Annotated[Optional[str], Field(alias="_id")] = None
"""
Eine generische ID, die für eigene Zwecke genutzt werden kann.
Z.B. könnten hier UUIDs aus einer Datenbank stehen oder URLs zu einem Backend-System.
Expand Down
4 changes: 2 additions & 2 deletions src/bo4e/com/energiemix.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class Energiemix(COM):
#: Höhe des erzeugten Atommülls in g/kWh
atommuell: Optional[Decimal] = None
#: Zertifikate für den Energiemix
oekozertifikate: list[Oekozertifikat] = None
oekozertifikate: Optional[list[Oekozertifikat]] = None
#: Ökolabel für den Energiemix
oekolabel: list[Oekolabel] = None
oekolabel: Optional[list[Oekolabel]] = None
#: Kennzeichen, ob der Versorger zu den Öko Top Ten gehört
oeko_top_ten: Optional[bool] = None
#: Internetseite, auf der die Strommixdaten veröffentlicht sind
Expand Down
2 changes: 2 additions & 0 deletions src/bo4e/com/sigmoidparameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ def calculate(self, leistung: Decimal) -> Decimal:
:param leistung: Leistung in Kilowatt
:return: den Sigmoidparameter LP in EUR/kWh
"""
if self.A is None or self.B is None or self.C is None or self.D is None:
raise ValueError("Sigmoidparameter is not fully defined")
return self.A / (1 + (leistung / self.B) ** self.C) + self.D
1 change: 1 addition & 0 deletions tests/test_zaehler.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_de_serialisation(self) -> None:
)
assert zaehler.versionstruktur == "2", "versionstruktur was not automatically set"
assert zaehler.bo_typ is BoTyp.ZAEHLER, "boTyp was not automatically set"
assert zaehler.zaehlwerke is not None
assert zaehler.zaehlwerke[0].richtung == Energierichtung.EINSP
assert zaehler.zaehlwerke[0].einheit == Mengeneinheit.KW
json_string = zaehler.model_dump_json(by_alias=True)
Expand Down

0 comments on commit cdb5aaa

Please sign in to comment.