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.

Files changed (38) hide show
  1. label_studio_sdk/__init__.py +4 -1
  2. label_studio_sdk/client.py +94 -78
  3. label_studio_sdk/data_manager.py +32 -23
  4. label_studio_sdk/exceptions.py +10 -0
  5. label_studio_sdk/label_interface/__init__.py +1 -0
  6. label_studio_sdk/label_interface/base.py +77 -0
  7. label_studio_sdk/label_interface/control_tags.py +756 -0
  8. label_studio_sdk/label_interface/interface.py +922 -0
  9. label_studio_sdk/label_interface/label_tags.py +72 -0
  10. label_studio_sdk/label_interface/object_tags.py +292 -0
  11. label_studio_sdk/label_interface/region.py +43 -0
  12. label_studio_sdk/objects.py +35 -0
  13. label_studio_sdk/project.py +711 -258
  14. label_studio_sdk/schema/label_config_schema.json +226 -0
  15. label_studio_sdk/users.py +15 -13
  16. label_studio_sdk/utils.py +31 -30
  17. label_studio_sdk/workspaces.py +13 -11
  18. {label_studio_sdk-0.0.32.dist-info → label_studio_sdk-0.0.34.dist-info}/METADATA +3 -1
  19. label_studio_sdk-0.0.34.dist-info/RECORD +37 -0
  20. {label_studio_sdk-0.0.32.dist-info → label_studio_sdk-0.0.34.dist-info}/WHEEL +1 -1
  21. {label_studio_sdk-0.0.32.dist-info → label_studio_sdk-0.0.34.dist-info}/top_level.txt +0 -1
  22. tests/test_client.py +21 -10
  23. tests/test_export.py +105 -0
  24. tests/test_interface/__init__.py +1 -0
  25. tests/test_interface/configs.py +137 -0
  26. tests/test_interface/mockups.py +22 -0
  27. tests/test_interface/test_compat.py +64 -0
  28. tests/test_interface/test_control_tags.py +55 -0
  29. tests/test_interface/test_data_generation.py +45 -0
  30. tests/test_interface/test_lpi.py +15 -0
  31. tests/test_interface/test_main.py +196 -0
  32. tests/test_interface/test_object_tags.py +36 -0
  33. tests/test_interface/test_region.py +36 -0
  34. tests/test_interface/test_validate_summary.py +35 -0
  35. tests/test_interface/test_validation.py +59 -0
  36. docs/__init__.py +0 -3
  37. label_studio_sdk-0.0.32.dist-info/RECORD +0 -15
  38. {label_studio_sdk-0.0.32.dist-info → label_studio_sdk-0.0.34.dist-info}/LICENSE +0 -0
@@ -0,0 +1,226 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-06/schema#",
3
+ "title": "LabelConfig",
4
+ "definitions": {
5
+ "$": {
6
+ "type": "string"
7
+ },
8
+ "@name": {
9
+ "type": "string"
10
+ },
11
+ "@toName": {
12
+ "type": "string"
13
+ },
14
+ "@value": {
15
+ "anyOf": [
16
+ {"type": "string"},
17
+ {"type": "boolean"},
18
+ {"type": "number"}
19
+ ]},
20
+ "@valueList": {
21
+ "anyOf": [
22
+ {"type": "string"}
23
+ ]},
24
+ "tag_with_value": {
25
+ "type": "object",
26
+ "required": [
27
+ "@value"
28
+ ],
29
+ "properties": {
30
+ "@value": {
31
+ "$ref": "#/definitions/@value"
32
+ },
33
+ "$": {
34
+ "$ref": "#/definitions/$"
35
+ }
36
+ }
37
+ },
38
+ "tag_with_value_required_name": {
39
+ "type": "object",
40
+ "oneOf": [
41
+ {
42
+ "required": [
43
+ "@name",
44
+ "@value"
45
+ ]
46
+ },
47
+ {
48
+ "required": [
49
+ "@name",
50
+ "@valueList"
51
+ ]
52
+ }
53
+ ],
54
+ "properties": {
55
+ "@value": {
56
+ "$ref": "#/definitions/@value"
57
+ },
58
+ "$": {
59
+ "$ref": "#/definitions/$"
60
+ }
61
+ }
62
+ },
63
+ "tags_with_value": {
64
+ "anyOf": [{
65
+ "type": "array",
66
+ "items": {"$ref": "#/definitions/tag_with_value"}
67
+ }, {"$ref": "#/definitions/tag_with_value"}]
68
+ },
69
+ "tags_with_value_or_object": {
70
+ "anyOf": [{
71
+ "type": "array",
72
+ "items": {"$ref": "#/definitions/tag_with_value"}
73
+ }, {
74
+ "type": "object"
75
+ }, {"$ref": "#/definitions/tag_with_value"}]
76
+ },
77
+ "tags_with_value_required_name": {
78
+ "anyOf": [{
79
+ "type": "array",
80
+ "items": {"$ref": "#/definitions/tag_with_value_required_name"}
81
+ }, {"$ref": "#/definitions/tag_with_value_required_name"}]
82
+ },
83
+ "View": {
84
+ "type": "object",
85
+ "additionalProperties": true,
86
+ "properties": {
87
+ "Labels": {"$ref": "#/definitions/MaybeMultipleLabels"},
88
+ "Choices": {"$ref": "#/definitions/MaybeMultipleChoices"},
89
+ "Label": {"$ref": "#/definitions/MaybeMultipleLabel"},
90
+ "Choice": {"$ref": "#/definitions/MaybeMultipleChoice"},
91
+ "Image": {"$ref": "#/definitions/tags_with_value_required_name"},
92
+ "Text": {"$ref": "#/definitions/tags_with_value_required_name"},
93
+ "HyperText": {"$ref": "#/definitions/tags_with_value_required_name"},
94
+ "View": {"$ref": "#/definitions/MaybeMultipleView"},
95
+ "TextArea": {"$ref": "#/definitions/MaybeMultipleTextAreas"}
96
+ }
97
+ },
98
+ "MaybeMultipleView": {
99
+ "anyOf": [{
100
+ "type": "array",
101
+ "items": {"$ref": "#/definitions/View"}
102
+ }, {"$ref": "#/definitions/View"}]
103
+ },
104
+ "Choice": {
105
+ "$ref": "#/definitions/tag_with_value"
106
+ },
107
+ "MaybeMultipleChoice": {
108
+ "anyOf": [{
109
+ "type": "array",
110
+ "items": {"$ref": "#/definitions/Choice"}
111
+ }, {"$ref": "#/definitions/Choice"}]
112
+ },
113
+ "Label": {
114
+ "$ref": "#/definitions/tag_with_value"
115
+ },
116
+ "MaybeMultipleLabel": {
117
+ "anyOf": [{
118
+ "type": "array",
119
+ "items": {"$ref": "#/definitions/Label"}
120
+ }, {"$ref": "#/definitions/Label"}]
121
+ },
122
+ "Choices": {
123
+ "type": "object",
124
+ "anyOf": [
125
+ {"required": ["@name", "@toName", "Choice"]},
126
+ {"required": ["@name", "@toName", "@value"]},
127
+ {"required": ["@name", "@toName", "View"]}
128
+ ],
129
+ "properties": {
130
+ "@name": {
131
+ "$ref": "#/definitions/@name"
132
+ },
133
+ "@toName": {
134
+ "$ref": "#/definitions/@toName"
135
+ },
136
+ "@value": {
137
+ "$ref": "#/definitions/@value"
138
+ },
139
+ "$": {
140
+ "$ref": "#/definitions/$"
141
+ },
142
+ "Choice": {
143
+ "type": "array",
144
+ "items": {"$ref": "#/definitions/Choice"}
145
+ },
146
+ "View": {"$ref": "#/definitions/MaybeMultipleView"}
147
+ }
148
+ },
149
+ "MaybeMultipleChoices": {
150
+ "anyOf": [{
151
+ "type": "array",
152
+ "items": {"$ref": "#/definitions/Choices"}
153
+ }, {"$ref": "#/definitions/Choices"}]
154
+ },
155
+ "Labels": {
156
+ "type": "object",
157
+ "anyOf": [
158
+ {"required": ["@name", "@toName", "Label"]},
159
+ {"required": ["@name", "@toName", "@value"]},
160
+ {"required": ["@name", "@toName", "View"]}
161
+ ],
162
+ "properties": {
163
+ "@name": {
164
+ "$ref": "#/definitions/@name"
165
+ },
166
+ "@toName": {
167
+ "$ref": "#/definitions/@toName"
168
+ },
169
+ "@value": {
170
+ "$ref": "#/definitions/@value"
171
+ },
172
+ "$": {
173
+ "$ref": "#/definitions/$"
174
+ },
175
+ "Label": {"$ref": "#/definitions/MaybeMultipleLabel"},
176
+ "View": {"$ref": "#/definitions/MaybeMultipleView"}
177
+ }
178
+ },
179
+ "MaybeMultipleLabels": {
180
+ "anyOf": [{
181
+ "type": "array",
182
+ "items": {"$ref": "#/definitions/Labels"}
183
+ }, {"$ref": "#/definitions/Labels"}]
184
+ },
185
+ "TextArea": {
186
+ "type": "object",
187
+ "anyOf": [
188
+ {"required": ["@name", "@toName"]}
189
+ ],
190
+ "properties": {
191
+ "@name": {
192
+ "$ref": "#/definitions/@name"
193
+ },
194
+ "@toName": {
195
+ "$ref": "#/definitions/@toName"
196
+ },
197
+ "$": {
198
+ "$ref": "#/definitions/$"
199
+ }
200
+ }
201
+ },
202
+ "MaybeMultipleTextAreas": {
203
+ "anyOf": [{
204
+ "type": "array",
205
+ "items": {"$ref": "#/definitions/TextArea"}
206
+ }, {"$ref": "#/definitions/TextArea"}]
207
+ }
208
+
209
+ },
210
+ "type": "object",
211
+ "properties": {
212
+ "View": {
213
+ "type": "object",
214
+ "additionalProperties": true,
215
+ "properties": {
216
+ "Choices": {"$ref": "#/definitions/MaybeMultipleChoices"},
217
+ "Labels": {"$ref": "#/definitions/MaybeMultipleLabels"},
218
+ "View": {"$ref": "#/definitions/MaybeMultipleView"},
219
+ "Image": {"$ref": "#/definitions/tags_with_value_required_name"},
220
+ "Text": {"$ref": "#/definitions/tags_with_value_required_name"},
221
+ "HyperText": {"$ref": "#/definitions/tags_with_value_required_name"},
222
+ "TextArea": {"$ref": "#/definitions/MaybeMultipleTextAreas"}
223
+ }
224
+ }
225
+ }
226
+ }
label_studio_sdk/users.py CHANGED
@@ -1,18 +1,20 @@
1
1
  from datetime import datetime
2
- from pydantic import BaseModel
3
2
  from enum import Enum
4
3
  from typing import List, Optional
4
+
5
+ from pydantic import BaseModel, Field
6
+
5
7
  from .client import Client
6
8
 
7
9
 
8
10
  class UserRole(Enum):
9
- ANNOTATOR = 'AN'
10
- REVIEWER = 'RE'
11
- MANAGER = 'MA'
12
- ADMINISTRATOR = 'AD'
13
- OWNER = 'OW'
14
- NOT_ACTIVATED = 'NO'
15
- DISABLED = 'DI'
11
+ ANNOTATOR = "AN"
12
+ REVIEWER = "RE"
13
+ MANAGER = "MA"
14
+ ADMINISTRATOR = "AD"
15
+ OWNER = "OW"
16
+ NOT_ACTIVATED = "NO"
17
+ DISABLED = "DI"
16
18
 
17
19
 
18
20
  class OrgMembership(BaseModel):
@@ -30,8 +32,8 @@ class User(BaseModel):
30
32
  last_activity: datetime
31
33
  initials: str
32
34
  phone: str
33
- active_organization: Optional[int]
34
- org_membership: Optional[List[OrgMembership]]
35
+ active_organization: Optional[int] = None
36
+ org_membership: Optional[List[OrgMembership]] = Field(default_factory=list)
35
37
  client: Client
36
38
 
37
39
  class Config:
@@ -46,9 +48,9 @@ class User(BaseModel):
46
48
  User role
47
49
  """
48
50
  response = self.client.make_request(
49
- 'PATCH',
50
- f'/api/organizations/{self.active_organization}/memberships',
51
- json={'user_id': self.id, 'role': role.value},
51
+ "PATCH",
52
+ f"/api/organizations/{self.active_organization}/memberships",
53
+ json={"user_id": self.id, "role": role.value},
52
54
  )
53
55
  for membership in self.org_membership:
54
56
  if membership.organization_id == self.active_organization:
label_studio_sdk/utils.py CHANGED
@@ -1,5 +1,6 @@
1
1
  """ .. include::../docs/utils.md
2
2
  """
3
+
3
4
  import logging
4
5
 
5
6
  from lxml import etree
@@ -7,9 +8,9 @@ from collections import defaultdict
7
8
 
8
9
  logger = logging.getLogger(__name__)
9
10
 
10
- _LABEL_TAGS = {'Label', 'Choice'}
11
+ _LABEL_TAGS = {"Label", "Choice"}
11
12
  _NOT_CONTROL_TAGS = {
12
- 'Filter',
13
+ "Filter",
13
14
  }
14
15
 
15
16
 
@@ -49,12 +50,12 @@ def parse_config(config_string):
49
50
  return {}
50
51
 
51
52
  def _is_input_tag(tag):
52
- return tag.attrib.get('name') and tag.attrib.get('value')
53
+ return tag.attrib.get("name") and tag.attrib.get("value")
53
54
 
54
55
  def _is_output_tag(tag):
55
56
  return (
56
- tag.attrib.get('name')
57
- and tag.attrib.get('toName')
57
+ tag.attrib.get("name")
58
+ and tag.attrib.get("toName")
58
59
  and tag.tag not in _NOT_CONTROL_TAGS
59
60
  )
60
61
 
@@ -65,7 +66,7 @@ def parse_config(config_string):
65
66
  parent = parent.getparent()
66
67
  if parent is None:
67
68
  return
68
- name = parent.attrib.get('name')
69
+ name = parent.attrib.get("name")
69
70
  if name in outputs:
70
71
  return name
71
72
 
@@ -74,55 +75,55 @@ def parse_config(config_string):
74
75
  inputs, outputs, labels = {}, {}, defaultdict(dict)
75
76
  for tag in xml_tree.iter():
76
77
  if _is_output_tag(tag):
77
- tag_info = {'type': tag.tag, 'to_name': tag.attrib['toName'].split(',')}
78
+ tag_info = {"type": tag.tag, "to_name": tag.attrib["toName"].split(",")}
78
79
  # Grab conditionals if any
79
80
  conditionals = {}
80
- if tag.attrib.get('perRegion') == 'true':
81
- if tag.attrib.get('whenTagName'):
82
- conditionals = {'type': 'tag', 'name': tag.attrib['whenTagName']}
83
- elif tag.attrib.get('whenLabelValue'):
81
+ if tag.attrib.get("perRegion") == "true":
82
+ if tag.attrib.get("whenTagName"):
83
+ conditionals = {"type": "tag", "name": tag.attrib["whenTagName"]}
84
+ elif tag.attrib.get("whenLabelValue"):
84
85
  conditionals = {
85
- 'type': 'label',
86
- 'name': tag.attrib['whenLabelValue'],
86
+ "type": "label",
87
+ "name": tag.attrib["whenLabelValue"],
87
88
  }
88
- elif tag.attrib.get('whenChoiceValue'):
89
+ elif tag.attrib.get("whenChoiceValue"):
89
90
  conditionals = {
90
- 'type': 'choice',
91
- 'name': tag.attrib['whenChoiceValue'],
91
+ "type": "choice",
92
+ "name": tag.attrib["whenChoiceValue"],
92
93
  }
93
94
  if conditionals:
94
- tag_info['conditionals'] = conditionals
95
- outputs[tag.attrib['name']] = tag_info
95
+ tag_info["conditionals"] = conditionals
96
+ outputs[tag.attrib["name"]] = tag_info
96
97
  elif _is_input_tag(tag):
97
- inputs[tag.attrib['name']] = {
98
- 'type': tag.tag,
99
- 'value': tag.attrib['value'].lstrip('$'),
98
+ inputs[tag.attrib["name"]] = {
99
+ "type": tag.tag,
100
+ "value": tag.attrib["value"].lstrip("$"),
100
101
  }
101
102
  if tag.tag not in _LABEL_TAGS:
102
103
  continue
103
104
  parent_name = _get_parent_output_tag_name(tag, outputs)
104
105
  if parent_name is not None:
105
- actual_value = tag.attrib.get('alias') or tag.attrib.get('value')
106
+ actual_value = tag.attrib.get("alias") or tag.attrib.get("value")
106
107
  if not actual_value:
107
108
  logger.debug(
108
109
  'Inspecting tag {tag_name}... found no "value" or "alias" attributes.'.format(
109
- tag_name=etree.tostring(tag, encoding='unicode').strip()[:50]
110
+ tag_name=etree.tostring(tag, encoding="unicode").strip()[:50]
110
111
  )
111
112
  )
112
113
  else:
113
114
  labels[parent_name][actual_value] = dict(tag.attrib)
114
115
  for output_tag, tag_info in outputs.items():
115
- tag_info['inputs'] = []
116
- for input_tag_name in tag_info['to_name']:
116
+ tag_info["inputs"] = []
117
+ for input_tag_name in tag_info["to_name"]:
117
118
  if input_tag_name not in inputs:
118
119
  logger.warning(
119
- f'to_name={input_tag_name} is specified for output tag name={output_tag}, '
120
- 'but we can\'t find it among input tags'
120
+ f"to_name={input_tag_name} is specified for output tag name={output_tag}, "
121
+ "but we can't find it among input tags"
121
122
  )
122
123
  continue
123
- tag_info['inputs'].append(inputs[input_tag_name])
124
- tag_info['labels'] = list(labels[output_tag])
125
- tag_info['labels_attrs'] = labels[output_tag]
124
+ tag_info["inputs"].append(inputs[input_tag_name])
125
+ tag_info["labels"] = list(labels[output_tag])
126
+ tag_info["labels_attrs"] = labels[output_tag]
126
127
  return outputs
127
128
 
128
129
 
@@ -1,13 +1,15 @@
1
+ from typing import Optional
2
+
1
3
  from pydantic import BaseModel
2
- from typing import List, Optional
3
- from .users import User
4
+
4
5
  from .client import Client
6
+ from .users import User
5
7
 
6
8
 
7
9
  class Workspace(BaseModel):
8
10
  id: int
9
11
  title: str
10
- description: Optional[str]
12
+ description: Optional[str] = ''
11
13
  color: str
12
14
  is_personal: bool
13
15
  created_by: int
@@ -25,9 +27,9 @@ class Workspace(BaseModel):
25
27
  User
26
28
  """
27
29
  response = self.client.make_request(
28
- 'POST',
29
- f'/api/workspaces/{self.id}/memberships',
30
- json={'workspace': self.id, 'user': user.id},
30
+ "POST",
31
+ f"/api/workspaces/{self.id}/memberships",
32
+ json={"workspace": self.id, "user": user.id},
31
33
  )
32
34
  return response.json()
33
35
 
@@ -40,9 +42,9 @@ class Workspace(BaseModel):
40
42
  User
41
43
  """
42
44
  response = self.client.make_request(
43
- 'DELETE',
44
- f'/api/workspaces/{self.id}/memberships',
45
- json={'workspace': self.id, 'user': user.id},
45
+ "DELETE",
46
+ f"/api/workspaces/{self.id}/memberships",
47
+ json={"workspace": self.id, "user": user.id},
46
48
  )
47
49
  if response.status_code != 204:
48
50
  raise ValueError(str(response.content))
@@ -59,11 +61,11 @@ class Workspace(BaseModel):
59
61
 
60
62
  final_results = []
61
63
  response = self.client.make_request(
62
- 'GET', f'/api/workspaces/{self.id}/projects'
64
+ "GET", f"/api/workspaces/{self.id}/projects"
63
65
  )
64
66
  projects = response.json()
65
67
  for project_data in projects:
66
- project_id = project_data['id']
68
+ project_id = project_data["id"]
67
69
  final_results.append(
68
70
  Project.get_from_id(
69
71
  client=self.client,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: label-studio-sdk
3
- Version: 0.0.32
3
+ Version: 0.0.34
4
4
  Summary: Label Studio annotation tool
5
5
  Home-page: https://github.com/heartexlabs/label-studio-sdk
6
6
  Author: Heartex
@@ -16,6 +16,8 @@ License-File: LICENSE
16
16
  Requires-Dist: lxml >=4.2.5
17
17
  Requires-Dist: requests <3,>=2.22.0
18
18
  Requires-Dist: pydantic <3,>1.7
19
+ Requires-Dist: jsonschema >=3.2.0
20
+ Requires-Dist: xmljson >=0.2.0
19
21
  Requires-Dist: label-studio-tools >=0.0.1
20
22
 
21
23
  Label Studio Python SDK
@@ -0,0 +1,37 @@
1
+ label_studio_sdk/__init__.py,sha256=N8tl9SDuUXJTqwCfMX6ytuanIMMO7hPAAWOv_8LDPcc,190
2
+ label_studio_sdk/client.py,sha256=7lZeuQNw39C_Iqb6O-LSY8dOYbrE7hhA8qrc0SH3Qw0,14052
3
+ label_studio_sdk/data_manager.py,sha256=IzmX9qokkVE51hrtX9IuXkLr80pVWSXq8Hp51-xDuHI,8309
4
+ label_studio_sdk/exceptions.py,sha256=Xpx6phdRD_dTWlA-nq0v0Feta0RVDltPUjRXSiXJ0Yk,196
5
+ label_studio_sdk/objects.py,sha256=fn0w3i7V-Y4SEP6v5bpz4vztCgzEW0kCInZBVP5-rCY,879
6
+ label_studio_sdk/project.py,sha256=dlVnwciSkXZ_0JAW3PK3gDmbcqLKemy6qDx6fufGA6w,93509
7
+ label_studio_sdk/users.py,sha256=G5wxBf7sGpZlN_0sR2NDovESIw1v2RfXWveCLHTgvN4,1402
8
+ label_studio_sdk/utils.py,sha256=ZeBEwUmHyK_GdUjAEOdIqkbKRT7SviO4Db0Uj6tMNfI,4518
9
+ label_studio_sdk/workspaces.py,sha256=9SrmZyWqj_0etCyTWzeC6v30jAIDnjerx4cNBlP3MGg,1913
10
+ label_studio_sdk/label_interface/__init__.py,sha256=Eg6y3mAaYdKzJ5ZPhU_BTX2qoNPafthdxLD2I_rmXoU,38
11
+ label_studio_sdk/label_interface/base.py,sha256=bI8pifudG4vI9MfvP-HIdHNJYDqg1pQimLQJGPUwnZk,2501
12
+ label_studio_sdk/label_interface/control_tags.py,sha256=Cq9MTgtd23AZBx9zT_iXeV6905tzGL5_jOGZaBw7lE0,20247
13
+ label_studio_sdk/label_interface/interface.py,sha256=dHpmHJrODkQ1q6g3Z8EAr_12cQcmdQtF5SsB7X1uglY,33133
14
+ label_studio_sdk/label_interface/label_tags.py,sha256=nWEo21Gd8IPzIO72UqraLrChIbvrSMCA_eEhzYGnGCc,2282
15
+ label_studio_sdk/label_interface/object_tags.py,sha256=CKNLYemwlvQ98NWUp4Nes0jklO28kE853KF-SML2f8Q,8181
16
+ label_studio_sdk/label_interface/region.py,sha256=rlJDOVAoFtk4gcg1y2L_Pd8Rjl2cwNGuUUGsqf2YDbg,823
17
+ label_studio_sdk/schema/label_config_schema.json,sha256=TIUgx4ft9lv4Yhj0ANjLy2YoChhPI7NyT3rH8rYFLA8,6101
18
+ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ tests/test_client.py,sha256=5s_g5AO6rLk9mPynfO2awjA_rtOxUDEUBGlPW_q4VCQ,1107
20
+ tests/test_export.py,sha256=I98dOIov7TOByiQFE6EEE9O2MVxsbbcct3BMlYfnE9s,3196
21
+ tests/test_interface/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
22
+ tests/test_interface/configs.py,sha256=xDreW0adFRg_qAxto1VEwhVrH-k6ptfmpQVHM90GV8s,3275
23
+ tests/test_interface/mockups.py,sha256=3IWXc9t5c9scDlqgeGmGqykfigm8w5b0Fa61wI8y2pU,1395
24
+ tests/test_interface/test_compat.py,sha256=-lw-I2sJhSFT5OwuB2jkp-xxkyQ1GDOijgx6qQHCglo,1924
25
+ tests/test_interface/test_control_tags.py,sha256=V4rVD6TDMeylo6NCmB7EywFS82zNJhqiXp59rJ5Sac0,1518
26
+ tests/test_interface/test_data_generation.py,sha256=PdnQgP5Q0iYB7CiGQXlWxCjclEYud2Uiyre0fZdqkfM,1213
27
+ tests/test_interface/test_lpi.py,sha256=8U95E6MBbPTOPqI7BJ0pWbWWIFMoFrDkE_6dcnXky30,552
28
+ tests/test_interface/test_main.py,sha256=Hswmu7qI01PBvFVAiweq4DmmE1wJcQJ32-lQZoykArg,4650
29
+ tests/test_interface/test_object_tags.py,sha256=K4fAZ1rNF_O1oeFOLEkNMn0MmTSG1GExT7yS3DKlx9Q,1008
30
+ tests/test_interface/test_region.py,sha256=6FP2SFhXBUC1DbjSGwfUfoH2NVpfytibaC3qAw7nYAU,833
31
+ tests/test_interface/test_validate_summary.py,sha256=mp0sPuJ389qV1TyKrWXbpTY9wxuo9Ye9mbrawxN5sVk,1059
32
+ tests/test_interface/test_validation.py,sha256=dK3TqAIhrSCzLIeThs5aN9aXkrxN74BMLv8VE1SAi8M,1544
33
+ label_studio_sdk-0.0.34.dist-info/LICENSE,sha256=lyszEV775P2PLmRYrU2TOQZ79PS2IPIiTyQEXU18IvA,11342
34
+ label_studio_sdk-0.0.34.dist-info/METADATA,sha256=RkSqDolATfhDW-8EgYq-RncwgwFeReNvRD7eZ0UFJ8I,712
35
+ label_studio_sdk-0.0.34.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
36
+ label_studio_sdk-0.0.34.dist-info/top_level.txt,sha256=0q87AjeX7fjpCV6nwmyUVFTNqO0mRqC5BqfwxzdPeUs,23
37
+ label_studio_sdk-0.0.34.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
tests/test_client.py CHANGED
@@ -1,26 +1,37 @@
1
- from unittest.mock import patch, Mock
1
+ from unittest.mock import Mock
2
2
 
3
3
  from label_studio_sdk.client import Client
4
4
 
5
5
 
6
6
  def test_client_headers():
7
- mock_session = Mock(spec=['request'])
7
+ mock_session = Mock(spec=["request"])
8
8
  mock_session.request.return_value = Mock(status_code=200)
9
- client = Client(url='http://fake.url', api_key='fake_key',
10
- session=mock_session, versions={'label-studio': '1.0.0'},
11
- extra_headers={'Proxy-Authorization': 'Bearer fake_bearer'})
9
+ client = Client(
10
+ url="http://fake.url",
11
+ api_key="fake_key",
12
+ session=mock_session,
13
+ versions={"label-studio": "1.0.0"},
14
+ extra_headers={"Proxy-Authorization": "Bearer fake_bearer"},
15
+ )
12
16
 
13
17
  client.check_connection()
14
18
  args, kwargs = mock_session.request.call_args
15
- assert kwargs['headers'] == {'Authorization': f'Token fake_key', 'Proxy-Authorization': 'Bearer fake_bearer'}
19
+ assert kwargs["headers"] == {
20
+ "Authorization": f"Token fake_key",
21
+ "Proxy-Authorization": "Bearer fake_bearer",
22
+ }
16
23
 
17
24
 
18
25
  def test_client_no_extra_headers():
19
- mock_session = Mock(spec=['request'])
26
+ mock_session = Mock(spec=["request"])
20
27
  mock_session.request.return_value = Mock(status_code=200)
21
- client = Client(url='http://fake.url', api_key='fake_key',
22
- session=mock_session, versions={'label-studio': '1.0.0'})
28
+ client = Client(
29
+ url="http://fake.url",
30
+ api_key="fake_key",
31
+ session=mock_session,
32
+ versions={"label-studio": "1.0.0"},
33
+ )
23
34
 
24
35
  client.check_connection()
25
36
  args, kwargs = mock_session.request.call_args
26
- assert kwargs['headers'] == {'Authorization': f'Token fake_key'}
37
+ assert kwargs["headers"] == {"Authorization": f"Token fake_key"}