Skip to content

Commit 6ee01a5

Browse files
SerRichardseanValentinaHutter
authored
update parsing to include 00:00:00+00:00 (#108)
Co-authored-by: sean <[email protected]> Co-authored-by: ValentinaHutter <[email protected]>
1 parent 1f1e15a commit 6ee01a5

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

openeo_pg_parser_networkx/pg_schema.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import logging
66
from enum import Enum
77
from re import match
8-
from typing import Annotated, Any, List, Optional, Union
8+
from typing import Annotated, Any, Optional, Union
99
from uuid import UUID, uuid4
1010

1111
import numpy as np
@@ -191,6 +191,11 @@ def validate_time(cls, value: Any) -> Any:
191191
r"[0-9]{4}-[0-9]{2}-[0-9]{2}T?[0-9]{2}:[0-9]{2}:?([0-9]{2})?Z?", value
192192
):
193193
return pendulum.parse(value)
194+
elif isinstance(value, str) and match(
195+
r"""[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\+[0-9]{2}:[0-9]{2}""",
196+
value,
197+
):
198+
return pendulum.parse(value.removesuffix("+00:00"), tzinfo='UTC')
194199
raise ValueError("Could not parse `DateTime` from input.")
195200

196201
def to_numpy(self):
@@ -294,6 +299,7 @@ def validate_temporal_interval(cls, value: Any) -> Any:
294299
start.root.minute,
295300
start.root.second,
296301
start.root.microsecond,
302+
tz='UTC',
297303
).to_rfc3339_string()
298304
)
299305
elif isinstance(end, Time):
@@ -313,6 +319,7 @@ def validate_temporal_interval(cls, value: Any) -> Any:
313319
end.root.minute,
314320
end.root.second,
315321
end.root.microsecond,
322+
tz='UTC',
316323
).to_rfc3339_string()
317324
)
318325

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "openeo-pg-parser-networkx"
3-
version = "2025.9.1"
3+
version = "2025.10.1"
44

55
description = "Parse OpenEO process graphs from JSON to traversible Python objects."
66
authors = ["Lukas Weidenholzer <[email protected]>", "Sean Hoyal <[email protected]>", "Valentina Hutter <[email protected]>", "Gerald Irsiegler <[email protected]>"]

tests/test_pg_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ def test_temporal_intervals(get_process_graph_with_args):
301301
['1995-01-30', '2000'],
302302
['1995-01-30', None],
303303
['15:00:00', '1990-01-01T20:00:00'],
304+
['2022-09-01 00:00:00+00:00', '2023-01-01 00:00:00+00:00'],
304305
]
305306
}
306307
pg = get_process_graph_with_args(argument1)

0 commit comments

Comments
 (0)