label-studio-sdk 0.0.32__py3-none-any.whl → 0.0.34__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of label-studio-sdk might be problematic. Click here for more details.
- label_studio_sdk/__init__.py +4 -1
- label_studio_sdk/client.py +94 -78
- label_studio_sdk/data_manager.py +32 -23
- label_studio_sdk/exceptions.py +10 -0
- label_studio_sdk/label_interface/__init__.py +1 -0
- label_studio_sdk/label_interface/base.py +77 -0
- label_studio_sdk/label_interface/control_tags.py +756 -0
- label_studio_sdk/label_interface/interface.py +922 -0
- label_studio_sdk/label_interface/label_tags.py +72 -0
- label_studio_sdk/label_interface/object_tags.py +292 -0
- label_studio_sdk/label_interface/region.py +43 -0
- label_studio_sdk/objects.py +35 -0
- label_studio_sdk/project.py +711 -258
- label_studio_sdk/schema/label_config_schema.json +226 -0
- label_studio_sdk/users.py +15 -13
- label_studio_sdk/utils.py +31 -30
- label_studio_sdk/workspaces.py +13 -11
- {label_studio_sdk-0.0.32.dist-info → label_studio_sdk-0.0.34.dist-info}/METADATA +3 -1
- label_studio_sdk-0.0.34.dist-info/RECORD +37 -0
- {label_studio_sdk-0.0.32.dist-info → label_studio_sdk-0.0.34.dist-info}/WHEEL +1 -1
- {label_studio_sdk-0.0.32.dist-info → label_studio_sdk-0.0.34.dist-info}/top_level.txt +0 -1
- tests/test_client.py +21 -10
- tests/test_export.py +105 -0
- tests/test_interface/__init__.py +1 -0
- tests/test_interface/configs.py +137 -0
- tests/test_interface/mockups.py +22 -0
- tests/test_interface/test_compat.py +64 -0
- tests/test_interface/test_control_tags.py +55 -0
- tests/test_interface/test_data_generation.py +45 -0
- tests/test_interface/test_lpi.py +15 -0
- tests/test_interface/test_main.py +196 -0
- tests/test_interface/test_object_tags.py +36 -0
- tests/test_interface/test_region.py +36 -0
- tests/test_interface/test_validate_summary.py +35 -0
- tests/test_interface/test_validation.py +59 -0
- docs/__init__.py +0 -3
- label_studio_sdk-0.0.32.dist-info/RECORD +0 -15
- {label_studio_sdk-0.0.32.dist-info → label_studio_sdk-0.0.34.dist-info}/LICENSE +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from lxml.etree import Element
|
|
2
|
+
|
|
3
|
+
from label_studio_sdk.label_interface import LabelInterface
|
|
4
|
+
from . import configs as c
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_region():
|
|
8
|
+
# h.get_rect_interface()
|
|
9
|
+
XVAL = 10
|
|
10
|
+
YVAL = 10
|
|
11
|
+
WVAL = 20
|
|
12
|
+
HVAL = 20
|
|
13
|
+
RVAL = 0
|
|
14
|
+
|
|
15
|
+
lpi = LabelInterface(c.RECT_CONFIG)
|
|
16
|
+
|
|
17
|
+
rect = lpi.get_control(c.FROM_NAME)
|
|
18
|
+
img = rect.get_object()
|
|
19
|
+
r = rect.label(x=XVAL, y=YVAL, width=WVAL, height=HVAL, rotation=RVAL)
|
|
20
|
+
d = r._dict()
|
|
21
|
+
|
|
22
|
+
assert d["from_name"] == c.FROM_NAME
|
|
23
|
+
assert d["to_name"] == c.TO_NAME
|
|
24
|
+
assert d["type"] == "rectangle"
|
|
25
|
+
assert isinstance(d["value"], dict)
|
|
26
|
+
|
|
27
|
+
assert d["value"]["x"] == XVAL
|
|
28
|
+
assert d["value"]["y"] == YVAL
|
|
29
|
+
assert d["value"]["width"] == WVAL
|
|
30
|
+
assert d["value"]["height"] == HVAL
|
|
31
|
+
assert d["value"]["rotation"] == RVAL
|
|
32
|
+
|
|
33
|
+
# out = r.dict()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
print(test_region())
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from label_studio_sdk.label_interface import LabelInterface
|
|
4
|
+
from label_studio_sdk.exceptions import LabelStudioValidationErrorSentryIgnored
|
|
5
|
+
|
|
6
|
+
from . import configs as c
|
|
7
|
+
from .mockups import SummaryMockup
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_validate_summary():
|
|
11
|
+
li = LabelInterface(c.CONF_COMPLEX)
|
|
12
|
+
summary = SummaryMockup()
|
|
13
|
+
|
|
14
|
+
li.validate_config_using_summary(summary)
|
|
15
|
+
|
|
16
|
+
# lets replace a label
|
|
17
|
+
c2 = c.CONF_COMPLEX.replace("PER", "DOESNOTEXIST")
|
|
18
|
+
li = LabelInterface(c2)
|
|
19
|
+
|
|
20
|
+
with pytest.raises(LabelStudioValidationErrorSentryIgnored):
|
|
21
|
+
li.validate_config_using_summary(summary)
|
|
22
|
+
|
|
23
|
+
# lets replace control name
|
|
24
|
+
c3 = c.CONF_COMPLEX.replace("label", "DOESNOTEXIST")
|
|
25
|
+
li = LabelInterface(c3)
|
|
26
|
+
|
|
27
|
+
with pytest.raises(LabelStudioValidationErrorSentryIgnored):
|
|
28
|
+
li.validate_config_using_summary(summary)
|
|
29
|
+
|
|
30
|
+
# lets replace object name
|
|
31
|
+
c4 = c.CONF_COMPLEX.replace("text", "DOESNOTEXIST")
|
|
32
|
+
li = LabelInterface(c4)
|
|
33
|
+
|
|
34
|
+
with pytest.raises(LabelStudioValidationErrorSentryIgnored):
|
|
35
|
+
li.validate_config_using_summary(summary)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import pytest
|
|
3
|
+
import xmljson
|
|
4
|
+
import copy
|
|
5
|
+
|
|
6
|
+
from label_studio_sdk.objects import PredictionValue
|
|
7
|
+
from label_studio_sdk.label_interface import LabelInterface
|
|
8
|
+
from label_studio_sdk.label_interface.control_tags import (
|
|
9
|
+
ControlTag,
|
|
10
|
+
ChoicesTag,
|
|
11
|
+
LabelsTag,
|
|
12
|
+
)
|
|
13
|
+
from label_studio_sdk.exceptions import LabelStudioValidationErrorSentryIgnored
|
|
14
|
+
|
|
15
|
+
# from label_studio_sdk.label_config.regions import Region
|
|
16
|
+
import tests.test_interface.configs as c
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_validate_region():
|
|
20
|
+
r1 = c.CORRECT_REGION
|
|
21
|
+
conf = LabelInterface(c.SIMPLE_CONF)
|
|
22
|
+
assert conf.validate_region(r1) is True
|
|
23
|
+
|
|
24
|
+
r2 = copy.deepcopy(r1)
|
|
25
|
+
r2["from_name"] = "wrong_name"
|
|
26
|
+
with pytest.raises(Exception):
|
|
27
|
+
conf.validate_region(r2)
|
|
28
|
+
|
|
29
|
+
r3 = copy.deepcopy(r1)
|
|
30
|
+
r3["value"]["choices"] = "WRONG_CLASS"
|
|
31
|
+
assert conf.validate_region(r3) is False
|
|
32
|
+
|
|
33
|
+
r4 = copy.deepcopy(r1)
|
|
34
|
+
del r4["value"]["choices"]
|
|
35
|
+
assert conf.validate_region(r4) is False
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_validate_prediction():
|
|
39
|
+
r1 = c.CORRECT_REGION
|
|
40
|
+
conf = LabelInterface(c.SIMPLE_CONF)
|
|
41
|
+
|
|
42
|
+
pred = {"model_version": "0.10", "score": "0.10", "result": [r1]}
|
|
43
|
+
|
|
44
|
+
assert conf.validate_prediction(pred) is True
|
|
45
|
+
|
|
46
|
+
r2 = copy.deepcopy(r1)
|
|
47
|
+
r2["from_name"] = "wrong_name"
|
|
48
|
+
|
|
49
|
+
pred["result"] = [r2]
|
|
50
|
+
|
|
51
|
+
with pytest.raises(Exception):
|
|
52
|
+
conf.validate_prediction(pred)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_validate_task():
|
|
56
|
+
conf = LabelInterface(c.SIMPLE_CONF)
|
|
57
|
+
|
|
58
|
+
assert conf.validate_task({"data": c.CORRECT_TASK}) is True
|
|
59
|
+
assert conf.validate_task({"data": {"wrong_var": "value"}}) is False
|
docs/__init__.py
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
docs/__init__.py,sha256=G0jbqZzwWT6wuivkBVPcV_JuXcfcrdPT6TBx4XDwUao,32
|
|
2
|
-
label_studio_sdk/__init__.py,sha256=xv7xRbNKbTGyCXmuU1w3LK4BFfnS018efo6quuk05H0,150
|
|
3
|
-
label_studio_sdk/client.py,sha256=uoV7-CiEqoPBo3oQJwkKwuBVENz1_ALERDi8HpE8CDE,13423
|
|
4
|
-
label_studio_sdk/data_manager.py,sha256=n00_1jAlSJKp3_l2NRGQqiBkKH5pdYeQnlAlopGJ9Xg,7904
|
|
5
|
-
label_studio_sdk/project.py,sha256=V10KVtoW-MbokjbUP64UzjI0QnxUY1ztwhHPDMFmefQ,76603
|
|
6
|
-
label_studio_sdk/users.py,sha256=h-hA2IsKHQz_pafxWC8moCXvaSmWT5WGtKi-qbCKJXM,1356
|
|
7
|
-
label_studio_sdk/utils.py,sha256=Cr0W4KCtkWHr9uHQOUOnClL5O_LCUK53wVSzEE9qUjg,4518
|
|
8
|
-
label_studio_sdk/workspaces.py,sha256=tVNhEqBaxarTYMtSxX2p9e2QyRkIwZE1uQKIZPv1EmA,1912
|
|
9
|
-
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
tests/test_client.py,sha256=2FETX3X7TBnDhrVtH-BR3qXd0wMwOgRMsxKFG6euhIw,1065
|
|
11
|
-
label_studio_sdk-0.0.32.dist-info/LICENSE,sha256=lyszEV775P2PLmRYrU2TOQZ79PS2IPIiTyQEXU18IvA,11342
|
|
12
|
-
label_studio_sdk-0.0.32.dist-info/METADATA,sha256=pdCLUgj8-i3BIcGJUw3_FcFoNaxClgkMQwhuXFKwAIU,647
|
|
13
|
-
label_studio_sdk-0.0.32.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
14
|
-
label_studio_sdk-0.0.32.dist-info/top_level.txt,sha256=mVmxb3x6QpfhhaZnTzqSRDcuCrFZSqH42wJ1Sd_0prQ,28
|
|
15
|
-
label_studio_sdk-0.0.32.dist-info/RECORD,,
|
|
File without changes
|