Files
cvat-ai--cvat/tests/python/cli/example_parameterized_function.py
T
Roman Donchenko a56e94b00d tests: remove imports that were deprecated in Python 3.9 (#8643)
And also `abstractstaticmethod`, which was deprecated in 3.3.

This is a continuation of #8626.
2024-11-06 15:51:53 +02:00

32 lines
751 B
Python

# Copyright (C) 2023 CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from types import SimpleNamespace as namespace
import cvat_sdk.auto_annotation as cvataa
import cvat_sdk.models as models
import PIL.Image
def create(s: str, i: int, f: float, b: bool) -> cvataa.DetectionFunction:
assert s == "string"
assert i == 123
assert f == 5.5
assert b is False
spec = cvataa.DetectionFunctionSpec(
labels=[
cvataa.label_spec("car", 0),
],
)
def detect(
context: cvataa.DetectionFunctionContext, image: PIL.Image.Image
) -> list[models.LabeledShapeRequest]:
return [
cvataa.rectangle(0, [1, 2, 3, 4]),
]
return namespace(spec=spec, detect=detect)