supervisely 6.73.315__py3-none-any.whl → 6.73.316__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.
@@ -625,7 +625,8 @@ class ApiField:
625
625
  """"""
626
626
  NON_FINAL_VALUE = "nonFinalValue"
627
627
  """"""
628
-
628
+ HOTKEY = "hotkey"
629
+ """"""
629
630
 
630
631
  def _get_single_item(items):
631
632
  """_get_single_item"""
@@ -201,3 +201,78 @@ class ObjectClassApi(ModuleApi):
201
201
  # response = self._api.post('videos.tags.bulk.add', {ApiField.VIDEO_ID: video_id, ApiField.TAGS: tags_json})
202
202
  # ids = [obj[ApiField.ID] for obj in response.json()]
203
203
  # return ids
204
+
205
+ def update(
206
+ self,
207
+ id: int,
208
+ name: Optional[str] = None,
209
+ description: Optional[str] = None,
210
+ hotkey: Optional[str] = None,
211
+ shape: Optional[str] = None,
212
+ color: Optional[str] = None,
213
+ settings: Optional[dict] = None,
214
+ ) -> NamedTuple:
215
+ """
216
+ Update the class with the given ID on the server.
217
+ Returned object contains updated information about the class except settings.
218
+
219
+ :param id: ID of the class to update.
220
+ :type id: int
221
+ :param name: New name of the class.
222
+ :type name: str, optional
223
+ :param description: New description of the class.
224
+ :type description: str, optional
225
+ :param hotkey: New hotkey of the class (e.g., "K").
226
+ :type hotkey: str, optional
227
+ :param shape: New shape of the class.
228
+ :type shape: str, optional
229
+ :param color: New color of the class in HEX format (e.g., #FFFFFF).
230
+ :type color: str, optional
231
+ :param settings: New settings of the class.
232
+ Do not pass "availableShapes" for shape other than "any".
233
+ Do not pass "availableShapes" that does not contain the current shape.
234
+ :type settings: dict, optional
235
+
236
+ :return: Updated class information
237
+ :rtype: :class:`ObjectClassInfo<ObjectClassInfo>`
238
+
239
+ :Usage example:
240
+
241
+ .. code-block:: python
242
+
243
+ import supervisely as sly
244
+
245
+ api = sly.Api.from_env()
246
+
247
+ obj_class_info = api.object_class.update(
248
+ id=22309,
249
+ shape='any',
250
+ settings={
251
+ "availableShapes": [
252
+ "bitmap",
253
+ "polygon",
254
+ ],
255
+ },
256
+ )
257
+ """
258
+ if all(arg is None for arg in [name, description, hotkey, shape, color, settings]):
259
+ raise ValueError(
260
+ f"To update the class with ID: {id}, you must specify at least one parameter to update; all are currently None"
261
+ )
262
+
263
+ data = {ApiField.ID: id}
264
+ if name is not None:
265
+ data[ApiField.NAME] = name
266
+ if description is not None:
267
+ data[ApiField.DESCRIPTION] = description
268
+ if hotkey is not None:
269
+ data[ApiField.HOTKEY] = hotkey
270
+ if shape is not None:
271
+ data[ApiField.SHAPE] = shape
272
+ if color is not None:
273
+ data[ApiField.COLOR] = color
274
+ if settings is not None:
275
+ data[ApiField.SETTINGS] = settings
276
+
277
+ response = self._api.post("advanced.object_classes.editInfo", data)
278
+ return self._convert_json_info(response.json(), skip_missing=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.315
3
+ Version: 6.73.316
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -32,9 +32,9 @@ supervisely/api/image_api.py,sha256=WIML_6N1qgOWBm3acexmGSWz4hAaSxlYmUtbytROaP8,
32
32
  supervisely/api/import_storage_api.py,sha256=BDCgmR0Hv6OoiRHLCVPKt3iDxSVlQp1WrnKhAK_Zl84,460
33
33
  supervisely/api/issues_api.py,sha256=BqDJXmNoTzwc3xe6_-mA7FDFC5QQ-ahGbXk_HmpkSeQ,17925
34
34
  supervisely/api/labeling_job_api.py,sha256=EWJh3TGauAOUWuAlK-Ey8s_S4FDMwa6I0snHX6dnhH8,55036
35
- supervisely/api/module_api.py,sha256=NkDU9gZ0hAHFVnbF26fOOx56QGizyQO23E2kMjKrBWM,44513
35
+ supervisely/api/module_api.py,sha256=GSkB9p4Xz9_HeIC9pFm060fOFeGkUK4M7pgryClrAbE,44545
36
36
  supervisely/api/neural_network_api.py,sha256=ktPVRO4Jeulougio8F0mioJJHwRJcX250Djp1wBoQ9c,7620
37
- supervisely/api/object_class_api.py,sha256=-rQcKwhBw3iL9KNH9c1ROgoimgWM1ls6Wi_tb1R-MzY,7683
37
+ supervisely/api/object_class_api.py,sha256=hBcQuKi9ouoiR7f99eot6vXHvqbzmal3IrHjJxuoFXg,10396
38
38
  supervisely/api/plugin_api.py,sha256=TlfrosdRuYG4NUxk92QiQoVaOdztFspPpygyVa3M3zk,5283
39
39
  supervisely/api/project_api.py,sha256=WwpwzsQjue2276Rn_wkcPxJAM4OaQr6haf81ZmCGpBI,79992
40
40
  supervisely/api/project_class_api.py,sha256=5cyjdGPPb2tpttu5WmYoOxUNiDxqiojschkhZumF0KM,1426
@@ -1075,9 +1075,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1075
1075
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1076
1076
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1077
1077
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1078
- supervisely-6.73.315.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1079
- supervisely-6.73.315.dist-info/METADATA,sha256=FgW6GD5UxnnvJGHRPPUQTLUj4Oc-gXyh7tZbGw2E4uE,33596
1080
- supervisely-6.73.315.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1081
- supervisely-6.73.315.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1082
- supervisely-6.73.315.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1083
- supervisely-6.73.315.dist-info/RECORD,,
1078
+ supervisely-6.73.316.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1079
+ supervisely-6.73.316.dist-info/METADATA,sha256=1Bzkm7rcu6QQawRicf_xyPpgsgcqefhLyRDC4Kd6zXw,33596
1080
+ supervisely-6.73.316.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1081
+ supervisely-6.73.316.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1082
+ supervisely-6.73.316.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1083
+ supervisely-6.73.316.dist-info/RECORD,,