Skip to content

Commit a8ec926

Browse files
committed
fix(typechecker): Type fixes
Signed-off-by: Helio Chissini de Castro <dev@heliocastro.info>
1 parent 446a4c9 commit a8ec926

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

examples/repo_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from pydantic import ValidationError
1111
from rich.pretty import pprint
1212

13-
from ort import OrtRepositoryConfiguration
13+
from ort import RepositoryConfiguration
1414

1515
logger = logging.getLogger()
1616

@@ -21,7 +21,7 @@ def main(datafile: str) -> None:
2121
try:
2222
with Path(datafile).open() as fd:
2323
data = yaml.safe_load(fd)
24-
parsed = OrtRepositoryConfiguration(**data)
24+
parsed = RepositoryConfiguration(**data)
2525
pprint(parsed)
2626
except ValidationError as e:
2727
logger.error(e)

src/ort/models/advisor_summary.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from datetime import datetime
55

6-
from pydantic import BaseModel, ConfigDict, Field
6+
from pydantic import BaseModel, ConfigDict, Field, field_validator
77

88
from .issue import Issue
99

@@ -29,3 +29,10 @@ class AdvisorSummary(BaseModel):
2929
description="The list of issues that occurred during the advisor run."
3030
"This property is not serialized if the list is empty to reduce the size of the result file.",
3131
)
32+
33+
@field_validator("start_time", "end_time", mode="before")
34+
@classmethod
35+
def transform_date(cls, v):
36+
if isinstance(v, str):
37+
return datetime.fromisoformat(v.replace("Z", "+00:00"))
38+
return v

0 commit comments

Comments
 (0)