alles neu mit black formatiert. handler_context.py impl. um weniger Übergabeparameter zu haben
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Bt_element(BaseModel):
|
||||
"""Das sind beide BTMT Elemente"""
|
||||
|
||||
teileid: str
|
||||
drehung: Optional [float] = Field(default=0.0,description="Rotation des Elements")
|
||||
hoehe: Optional [float] = Field(default=0.0,description="Hoehe des Elements")
|
||||
drehung: Optional[float] = Field(default=0.0, description="Rotation des Elements")
|
||||
hoehe: Optional[float] = Field(default=0.0, description="Hoehe des Elements")
|
||||
|
||||
@classmethod
|
||||
def from_merkmale(cls, teileid: str, x: float, y: float, merkmale: dict) -> 'Bt_element':
|
||||
def from_merkmale(
|
||||
cls, teileid: str, x: float, y: float, merkmale: dict
|
||||
) -> "Bt_element":
|
||||
try:
|
||||
hoehe = float(merkmale.get("Höhe in Meter"))
|
||||
except Exception as e:
|
||||
@@ -17,11 +21,5 @@ class Bt_element(BaseModel):
|
||||
drehung = float(merkmale.get("Drehung"))
|
||||
except Exception as e:
|
||||
drehung = 0.0
|
||||
|
||||
return cls(
|
||||
teileid = teileid,
|
||||
x = x,
|
||||
y = y,
|
||||
hoehe = hoehe,
|
||||
drehung = drehung
|
||||
)
|
||||
|
||||
return cls(teileid=teileid, x=x, y=y, hoehe=hoehe, drehung=drehung)
|
||||
|
||||
Reference in New Issue
Block a user