Skip to content

Commit b323a96

Browse files
committed
Update tests to support python>=3.11
1 parent 333f816 commit b323a96

5 files changed

Lines changed: 8 additions & 19 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repos:
1515

1616
# Ruff version.
1717
- repo: https://github.com/astral-sh/ruff-pre-commit
18-
rev: "v0.15.2"
18+
rev: "v0.6.2"
1919
hooks:
2020
# Run the linter.
2121
- id: ruff

pyproject.toml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,6 @@ lint.ignore = [
188188

189189
# flake8-fixme (`FIX`)
190190
"FIX002", # Line contains TODO, consider resolving the issue
191-
192-
# upgraded to most recent ruff, remove the following rules for now
193-
"LOG015",
194-
"RUF005",
195-
"RUF052",
196-
"RUF067",
197-
"RUF069",
198-
"TC001",
199-
"TC002",
200-
"TC003",
201-
202191
]
203192

204193
# Allow autofix for all enabled rules (when `--fix`) is provided.
@@ -235,8 +224,8 @@ line-length = 120
235224
# Allow unused variables when underscore-prefixed.
236225
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
237226

238-
# Assume Python 3.14.
239-
target-version = "py314"
227+
# Assume Python 3.11.
228+
target-version = "py311"
240229

241230
# Allow imports relative to the "src" and "tests" directories.
242231
src = ["src", "tests"]

src/model_api/models/classification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def get_multiclass_predictions(self, outputs: dict) -> list[Label]:
258258
if not is_softmaxed(logits, axis=axis):
259259
logits = softmax(logits, axis=axis)
260260
top_k_result = top_k(logits, self.params.topk, axis=axis)
261-
scores = top_k_result.values[0]
261+
scores = top_k_result.values[0] # noqa: PD011 # silencing false positive - it's not pandas code
262262
indices = top_k_result.indices[0]
263263

264264
labels_list = self.params.labels

src/model_api/models/parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __dir__(self) -> list[str]:
4545
try:
4646
parameters = self._model.get_cached_parameters()
4747
return list(parameters.keys())
48-
except AttributeError, TypeError, ValueError:
48+
except (AttributeError, TypeError, ValueError):
4949
return []
5050

5151

tests/accuracy/test_accuracy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ def compare_detection_result(outputs: DetectionResult, reference: dict) -> None:
223223
if expected_bboxes.size == 0 and outputs.bboxes.size == 0:
224224
expected_bboxes = expected_bboxes.reshape(0, 4)
225225

226-
assert outputs.bboxes.shape == expected_bboxes.shape, (
227-
f"bboxes shape mismatch: {outputs.bboxes.shape} vs {expected_bboxes.shape}"
228-
)
226+
assert (
227+
outputs.bboxes.shape == expected_bboxes.shape
228+
), f"bboxes shape mismatch: {outputs.bboxes.shape} vs {expected_bboxes.shape}"
229229

230230
# Sort both outputs and expected by bbox coordinates (x1, y1, x2, y2) for deterministic comparison
231231
output_sort_indices = np.lexsort((

0 commit comments

Comments
 (0)