Es geht um diese Codezeilen:
|
def time_range_possibilities(cls, endzeitpunkt: Optional[datetime], values: Dict[str, Any]) -> Optional[datetime]: |
|
""" |
|
An address is valid if it contains a postfach XOR (a strasse AND hausnummer). |
|
This functions checks for these conditions of a valid address. |
|
""" |
|
|
|
if ( |
|
values["einheit"] |
|
and values["dauer"] |
|
and not (values["startdatum"] or values["enddatum"] or values["startzeitpunkt"] or endzeitpunkt) |
|
): |
|
return endzeitpunkt |
|
if ( |
|
values["startdatum"] |
|
and values["enddatum"] |
|
and not (values["einheit"] or values["dauer"] or values["startzeitpunkt"] or endzeitpunkt) |
|
): |
|
return endzeitpunkt |
|
if ( |
|
values["startzeitpunkt"] |
|
and endzeitpunkt |
|
and not (values["einheit"] or values["dauer"] or values["startdatum"] or values["enddatum"]) |
|
): |
|
return endzeitpunkt |
|
|
|
raise ValueError( |
|
""" |
|
Please choose from one of the three possibilities to specify the timerange: |
|
- einheit and dauer |
|
- startdatum and enddatum |
|
- startzeitpunkt and endzeitpunkt |
|
""" |
|
) |
todo: rewrite this to be more readable; just migrated to pydantic v2 without thinking too much about it
Es geht um die time_range_possibilities in dem Modul src/bo4e/com/zeitraum.py
PS: Der Docstring ist auch falsch
Originally posted by @hf-krechan in #476 (comment)
Es geht um diese Codezeilen:
BO4E-python/src/bo4e/com/zeitraum.py
Lines 45 to 77 in 9a672b9
PS: Der Docstring ist auch falsch
Originally posted by @hf-krechan in #476 (comment)