Skip to content

Commit 0e17412

Browse files
committed
fix(model): Parse start_lines properly to return string value instead of list
Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
1 parent 28a90b0 commit 0e17412

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "uv_build"
44

55
[project]
66
name = "python-ort"
7-
version = "0.8.9"
7+
version = "0.8.10"
88
description = "A Python Ort model serialization library"
99
readme = "README.md"
1010
license = "MIT"

src/ort/models/config/license_finding_curation.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class LicenseFindingCuration(BaseModel):
3434
path: str = Field(
3535
description="A glob to match the file path of a license finding.",
3636
)
37-
start_lines: list[int] | None = Field(
37+
start_lines: str | None = Field(
3838
default=None,
3939
description="A matcher for the start line of a license finding, matches if the start line matches any of"
4040
"[startLines] or if [startLines] is empty.",
@@ -64,14 +64,18 @@ class LicenseFindingCuration(BaseModel):
6464

6565
@field_validator("start_lines", mode="before")
6666
@classmethod
67-
def parse_start_lines(cls, value: Any) -> list[int] | None:
67+
def parse_start_lines(cls, value: Any) -> str | None:
6868
if value is None or value == "":
6969
return None
7070
if isinstance(value, str):
7171
# CSV style split
72-
return [int(x.strip()) for x in value.split(",") if x.strip()]
73-
if isinstance(value, list):
74-
return [int(x) for x in value]
72+
parts = value.split(",")
73+
for part in parts:
74+
if not part.strip().isdigit():
75+
raise ValueError(
76+
f"start_lines contains non-numeric value: '{part.strip()}'",
77+
)
78+
return value
7579
if isinstance(value, int):
76-
return [value]
80+
return str(value)
7781
raise ValueError("start_lines must be a comma-separated string or a list of integers")

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)