supervisely 6.73.437__py3-none-any.whl → 6.73.439__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.
- supervisely/__init__.py +112 -0
- supervisely/api/pointcloud/pointcloud_api.py +38 -0
- supervisely/api/video/video_api.py +38 -0
- supervisely/api/volume/volume_api.py +38 -0
- {supervisely-6.73.437.dist-info → supervisely-6.73.439.dist-info}/METADATA +1 -1
- {supervisely-6.73.437.dist-info → supervisely-6.73.439.dist-info}/RECORD +11 -11
- supervisely_lib/__init__.py +6 -1
- {supervisely-6.73.437.dist-info → supervisely-6.73.439.dist-info}/LICENSE +0 -0
- {supervisely-6.73.437.dist-info → supervisely-6.73.439.dist-info}/WHEEL +0 -0
- {supervisely-6.73.437.dist-info → supervisely-6.73.439.dist-info}/entry_points.txt +0 -0
- {supervisely-6.73.437.dist-info → supervisely-6.73.439.dist-info}/top_level.txt +0 -0
supervisely/__init__.py
CHANGED
|
@@ -318,3 +318,115 @@ except Exception as e:
|
|
|
318
318
|
from supervisely.io.env import configure_minimum_instance_version
|
|
319
319
|
|
|
320
320
|
configure_minimum_instance_version()
|
|
321
|
+
|
|
322
|
+
LARGE_ENV_PLACEHOLDER = "@.@SLY_LARGE_ENV@.@"
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def restore_env_vars():
|
|
326
|
+
try:
|
|
327
|
+
large_env_keys = []
|
|
328
|
+
for key, value in os.environ.items():
|
|
329
|
+
if value == LARGE_ENV_PLACEHOLDER:
|
|
330
|
+
large_env_keys.append(key)
|
|
331
|
+
if len(large_env_keys) == 0:
|
|
332
|
+
return
|
|
333
|
+
|
|
334
|
+
if utils.is_development():
|
|
335
|
+
logger.info(
|
|
336
|
+
"Large environment variables detected. Skipping restoration in development mode.",
|
|
337
|
+
extra={"keys": large_env_keys},
|
|
338
|
+
)
|
|
339
|
+
return
|
|
340
|
+
|
|
341
|
+
unknown_keys = []
|
|
342
|
+
state_keys = []
|
|
343
|
+
context_keys = []
|
|
344
|
+
for key in large_env_keys:
|
|
345
|
+
if key == "CONTEXT" or key.startswith("context."):
|
|
346
|
+
context_keys.append(key)
|
|
347
|
+
elif key.startswith("MODAL_STATE") or key.startswith("modal.state."):
|
|
348
|
+
state_keys.append(key)
|
|
349
|
+
else:
|
|
350
|
+
unknown_keys.append(key)
|
|
351
|
+
|
|
352
|
+
if state_keys or context_keys:
|
|
353
|
+
api = Api()
|
|
354
|
+
if state_keys:
|
|
355
|
+
task_info = api.task.get_info_by_id(env.task_id())
|
|
356
|
+
state = task_info.get("meta", {}).get("params", {}).get("state", {})
|
|
357
|
+
modal_state_envs = json.flatten_json(state)
|
|
358
|
+
modal_state_envs = json.modify_keys(modal_state_envs, prefix="modal.state.")
|
|
359
|
+
|
|
360
|
+
restored_keys = []
|
|
361
|
+
not_found_keys = []
|
|
362
|
+
for key in state_keys:
|
|
363
|
+
if key == "MODAL_STATE":
|
|
364
|
+
os.environ[key] = json.json.dumps(state)
|
|
365
|
+
elif key in modal_state_envs:
|
|
366
|
+
os.environ[key] = str(modal_state_envs[key])
|
|
367
|
+
elif key.replace("_", ".") in [k.upper() for k in modal_state_envs]:
|
|
368
|
+
# some env vars do not support dots in their names
|
|
369
|
+
k = next(k for k in modal_state_envs if k.upper() == key.replace("_", "."))
|
|
370
|
+
os.environ[key] = str(modal_state_envs[k])
|
|
371
|
+
else:
|
|
372
|
+
not_found_keys.append(key)
|
|
373
|
+
continue
|
|
374
|
+
restored_keys.append(key)
|
|
375
|
+
|
|
376
|
+
if restored_keys:
|
|
377
|
+
logger.info(
|
|
378
|
+
"Restored large environment variables from task state",
|
|
379
|
+
extra={"keys": restored_keys},
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
if not_found_keys:
|
|
383
|
+
logger.warning(
|
|
384
|
+
"Failed to restore some large environment variables from task state. "
|
|
385
|
+
"No such keys in the state.",
|
|
386
|
+
extra={"keys": not_found_keys},
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
if context_keys:
|
|
390
|
+
context = api.task.get_context(env.task_id())
|
|
391
|
+
context_envs = json.flatten_json(context)
|
|
392
|
+
context_envs = json.modify_keys(context_envs, prefix="context.")
|
|
393
|
+
|
|
394
|
+
restored_keys = []
|
|
395
|
+
not_found_keys = []
|
|
396
|
+
for key in context_keys:
|
|
397
|
+
if key == "CONTEXT":
|
|
398
|
+
os.environ[key] = json.json.dumps(context)
|
|
399
|
+
elif key in context_envs:
|
|
400
|
+
os.environ[key] = context_envs[key]
|
|
401
|
+
else:
|
|
402
|
+
not_found_keys.append(key)
|
|
403
|
+
continue
|
|
404
|
+
restored_keys.append(key)
|
|
405
|
+
|
|
406
|
+
if restored_keys:
|
|
407
|
+
logger.info(
|
|
408
|
+
"Restored large environment variables from task context",
|
|
409
|
+
extra={"keys": restored_keys},
|
|
410
|
+
)
|
|
411
|
+
|
|
412
|
+
if not_found_keys:
|
|
413
|
+
logger.warning(
|
|
414
|
+
"Failed to restore some large environment variables from task context. "
|
|
415
|
+
"No such keys in the context.",
|
|
416
|
+
extra={"keys": not_found_keys},
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
if unknown_keys:
|
|
420
|
+
logger.warning(
|
|
421
|
+
"Found unknown large environment variables. Can't restore them.",
|
|
422
|
+
extra={"keys": unknown_keys},
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
except Exception as e:
|
|
426
|
+
logger.warning(
|
|
427
|
+
"Failed to restore large environment variables.",
|
|
428
|
+
exc_info=True,
|
|
429
|
+
)
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
restore_env_vars()
|
|
@@ -1431,3 +1431,41 @@ class PointcloudApi(RemoveableBulkModuleApi):
|
|
|
1431
1431
|
)
|
|
1432
1432
|
tasks.append(task)
|
|
1433
1433
|
await asyncio.gather(*tasks)
|
|
1434
|
+
|
|
1435
|
+
def rename(
|
|
1436
|
+
self,
|
|
1437
|
+
id: int,
|
|
1438
|
+
name: str,
|
|
1439
|
+
) -> PointcloudInfo:
|
|
1440
|
+
"""Renames Pointcloud with given ID to a new name.
|
|
1441
|
+
|
|
1442
|
+
:param id: Pointcloud ID in Supervisely.
|
|
1443
|
+
:type id: int
|
|
1444
|
+
:param name: New Pointcloud name.
|
|
1445
|
+
:type name: str
|
|
1446
|
+
:return: Information about updated Pointcloud.
|
|
1447
|
+
:rtype: :class:`PointcloudInfo`
|
|
1448
|
+
|
|
1449
|
+
:Usage example:
|
|
1450
|
+
|
|
1451
|
+
.. code-block:: python
|
|
1452
|
+
|
|
1453
|
+
import supervisely as sly
|
|
1454
|
+
|
|
1455
|
+
api = sly.Api.from_env()
|
|
1456
|
+
os.environ['SERVER_ADDRESS'] = 'https://app.supervisely.com'
|
|
1457
|
+
os.environ['API_TOKEN'] = 'Your Supervisely API Token'
|
|
1458
|
+
|
|
1459
|
+
pointcloud_id = 123456
|
|
1460
|
+
new_pointcloud_name = "3333_new.pcd"
|
|
1461
|
+
|
|
1462
|
+
api.pointcloud.rename(id=pointcloud_id, name=new_pointcloud_name)
|
|
1463
|
+
"""
|
|
1464
|
+
|
|
1465
|
+
data = {
|
|
1466
|
+
ApiField.ID: id,
|
|
1467
|
+
ApiField.NAME: name,
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
response = self._api.post("images.editInfo", data)
|
|
1471
|
+
return self._convert_json_info(response.json())
|
|
@@ -2610,3 +2610,41 @@ class VideoApi(RemoveableBulkModuleApi):
|
|
|
2610
2610
|
|
|
2611
2611
|
tasks.append(task)
|
|
2612
2612
|
await asyncio.gather(*tasks)
|
|
2613
|
+
|
|
2614
|
+
def rename(
|
|
2615
|
+
self,
|
|
2616
|
+
id: int,
|
|
2617
|
+
name: str,
|
|
2618
|
+
) -> VideoInfo:
|
|
2619
|
+
"""Renames Video with given ID to a new name.
|
|
2620
|
+
|
|
2621
|
+
:param id: Video ID in Supervisely.
|
|
2622
|
+
:type id: int
|
|
2623
|
+
:param name: New Video name.
|
|
2624
|
+
:type name: str
|
|
2625
|
+
:return: Information about updated Video.
|
|
2626
|
+
:rtype: :class:`VideoInfo`
|
|
2627
|
+
|
|
2628
|
+
:Usage example:
|
|
2629
|
+
|
|
2630
|
+
.. code-block:: python
|
|
2631
|
+
|
|
2632
|
+
import supervisely as sly
|
|
2633
|
+
|
|
2634
|
+
api = sly.Api.from_env()
|
|
2635
|
+
os.environ['SERVER_ADDRESS'] = 'https://app.supervisely.com'
|
|
2636
|
+
os.environ['API_TOKEN'] = 'Your Supervisely API Token'
|
|
2637
|
+
|
|
2638
|
+
video_id = 123456
|
|
2639
|
+
new_video_name = "VID_3333_new.mp4"
|
|
2640
|
+
|
|
2641
|
+
api.video.rename(id=video_id, name=new_video_name)
|
|
2642
|
+
"""
|
|
2643
|
+
|
|
2644
|
+
data = {
|
|
2645
|
+
ApiField.ID: id,
|
|
2646
|
+
ApiField.NAME: name,
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
response = self._api.post("images.editInfo", data)
|
|
2650
|
+
return self._convert_json_info(response.json())
|
|
@@ -1455,3 +1455,41 @@ class VolumeApi(RemoveableBulkModuleApi):
|
|
|
1455
1455
|
)
|
|
1456
1456
|
tasks.append(task)
|
|
1457
1457
|
await asyncio.gather(*tasks)
|
|
1458
|
+
|
|
1459
|
+
def rename(
|
|
1460
|
+
self,
|
|
1461
|
+
id: int,
|
|
1462
|
+
name: str,
|
|
1463
|
+
) -> VolumeInfo:
|
|
1464
|
+
"""Renames Volume with given ID to a new name.
|
|
1465
|
+
|
|
1466
|
+
:param id: Volume ID in Supervisely.
|
|
1467
|
+
:type id: int
|
|
1468
|
+
:param name: New Volume name.
|
|
1469
|
+
:type name: str
|
|
1470
|
+
:return: Information about updated Volume.
|
|
1471
|
+
:rtype: :class:`VolumeInfo`
|
|
1472
|
+
|
|
1473
|
+
:Usage example:
|
|
1474
|
+
|
|
1475
|
+
.. code-block:: python
|
|
1476
|
+
|
|
1477
|
+
import supervisely as sly
|
|
1478
|
+
|
|
1479
|
+
api = sly.Api.from_env()
|
|
1480
|
+
os.environ['SERVER_ADDRESS'] = 'https://app.supervisely.com'
|
|
1481
|
+
os.environ['API_TOKEN'] = 'Your Supervisely API Token'
|
|
1482
|
+
|
|
1483
|
+
volume_id = 123456
|
|
1484
|
+
new_volume_name = "3333_new.nrrd"
|
|
1485
|
+
|
|
1486
|
+
api.volume.rename(id=volume_id, name=new_volume_name)
|
|
1487
|
+
"""
|
|
1488
|
+
|
|
1489
|
+
data = {
|
|
1490
|
+
ApiField.ID: id,
|
|
1491
|
+
ApiField.NAME: name,
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
response = self._api.post("images.editInfo", data)
|
|
1495
|
+
return self._convert_json_info(response.json())
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
supervisely/README.md,sha256=XM-DiMC6To3I9RjQZ0c61905EFRR_jnCUx2q3uNR-X8,3331
|
|
2
|
-
supervisely/__init__.py,sha256=
|
|
2
|
+
supervisely/__init__.py,sha256=_zh2UIxLUyf2krDKY-yurV9enqg1drEubCRX5nDlqR4,15333
|
|
3
3
|
supervisely/_utils.py,sha256=59vOeNOnmVHODnlAvULT8jdwvHHVTs2FOtAFw8mvaqE,20643
|
|
4
4
|
supervisely/function_wrapper.py,sha256=R5YajTQ0GnRp2vtjwfC9hINkzQc0JiyGsu8TER373xY,1912
|
|
5
5
|
supervisely/sly_logger.py,sha256=z92Vu5hmC0GgTIJO1n6kPDayRW9__8ix8hL6poDZj-Y,6274
|
|
@@ -61,7 +61,7 @@ supervisely/api/nn/ecosystem_models_api.py,sha256=giV54hrFwSxOr58f7OLfzSs3yo30BB
|
|
|
61
61
|
supervisely/api/nn/neural_network_api.py,sha256=U1drXTtJsojBA2hJ1fOvbpNES8r3eyDd6b7kA9UxKP0,11019
|
|
62
62
|
supervisely/api/pointcloud/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
63
|
supervisely/api/pointcloud/pointcloud_annotation_api.py,sha256=xIXqCu0rKYsGt5ezh2EFT2utwsVrr2Xo-MOWUCnbvXc,11259
|
|
64
|
-
supervisely/api/pointcloud/pointcloud_api.py,sha256=
|
|
64
|
+
supervisely/api/pointcloud/pointcloud_api.py,sha256=zkFUcvOYFBmiq9YEsCpDeP07hw42oeqqxMQnvEKq5QM,54915
|
|
65
65
|
supervisely/api/pointcloud/pointcloud_episode_annotation_api.py,sha256=DNmIpjzD8rkdBqfZS7dwk54OPISmrHl9Kju1l57M9SY,7133
|
|
66
66
|
supervisely/api/pointcloud/pointcloud_episode_api.py,sha256=xg1zRKONV9ly0-B72V1dR6OMPFIw35bujazuEdrPGTQ,7922
|
|
67
67
|
supervisely/api/pointcloud/pointcloud_episode_object_api.py,sha256=k2_wV0EVPo9vxSTVe1qOvqVOMSVE6zGDSkfR6TRNsKs,691
|
|
@@ -71,14 +71,14 @@ supervisely/api/pointcloud/pointcloud_object_api.py,sha256=bO1USWb9HAywG_CW4CDu1
|
|
|
71
71
|
supervisely/api/pointcloud/pointcloud_tag_api.py,sha256=iShtr052nOElxsyMyZEUT2vypEm6kP00gnP13ABX24A,4691
|
|
72
72
|
supervisely/api/video/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
73
73
|
supervisely/api/video/video_annotation_api.py,sha256=LAdZUC5qB6Q3ufDEUfWERYiglM3I_MYg9Yv1Nn6aKZ4,14137
|
|
74
|
-
supervisely/api/video/video_api.py,sha256=
|
|
74
|
+
supervisely/api/video/video_api.py,sha256=jeW-UjQt5xt7qQHOyTgFc5qe7SergCadxfeNgpLDx-I,95727
|
|
75
75
|
supervisely/api/video/video_figure_api.py,sha256=quksohjhgrK2l2-PtbbNE99fOW6uWXX59-_4xfc-I-k,6244
|
|
76
76
|
supervisely/api/video/video_frame_api.py,sha256=4GwSI4xdCNYEUvTqzKc-Ewd44fw5zqkFoD24jrrN_aY,10214
|
|
77
77
|
supervisely/api/video/video_object_api.py,sha256=IC0NP8EoIT_d3xxDRgz2cA3ixSiuJ5ymy64eS-RfmDM,2227
|
|
78
78
|
supervisely/api/video/video_tag_api.py,sha256=wPe1HeJyg9kV1z2UJq6BEte5sKBoPJ2UGAHpGivis9c,14911
|
|
79
79
|
supervisely/api/volume/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
80
80
|
supervisely/api/volume/volume_annotation_api.py,sha256=_v9IcWYYIajlCIUjVXNc30iWqgfh8i5RRL1kL1hliVE,22376
|
|
81
|
-
supervisely/api/volume/volume_api.py,sha256=
|
|
81
|
+
supervisely/api/volume/volume_api.py,sha256=7mMfKY4HdzrbBvGZFE1SJiRi4OsgDyk3azz4pn-ZR6U,56387
|
|
82
82
|
supervisely/api/volume/volume_figure_api.py,sha256=Fs7j3h76kw7EI-o3vJHjpvL4Vxn3Fu-DzhArgK_qrPk,26523
|
|
83
83
|
supervisely/api/volume/volume_object_api.py,sha256=F7pLV2MTlBlyN6fEKdxBSUatIMGWSuu8bWj3Hvcageo,2139
|
|
84
84
|
supervisely/api/volume/volume_tag_api.py,sha256=yNGgXz44QBSW2VGlNDOVLqLXnH8Q2fFrxDFb_girYXA,3639
|
|
@@ -1126,10 +1126,10 @@ supervisely/worker_api/rpc_servicer.py,sha256=HHhwaH40dM67UIp0ujK4P-ayvl0mPHTiZ5
|
|
|
1126
1126
|
supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1127
1127
|
supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
|
|
1128
1128
|
supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
|
|
1129
|
-
supervisely_lib/__init__.py,sha256=
|
|
1130
|
-
supervisely-6.73.
|
|
1131
|
-
supervisely-6.73.
|
|
1132
|
-
supervisely-6.73.
|
|
1133
|
-
supervisely-6.73.
|
|
1134
|
-
supervisely-6.73.
|
|
1135
|
-
supervisely-6.73.
|
|
1129
|
+
supervisely_lib/__init__.py,sha256=yRwzEQmVwSd6lUQoAUdBngKEOlnoQ6hA9ZcoZGJRNC4,331
|
|
1130
|
+
supervisely-6.73.439.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
1131
|
+
supervisely-6.73.439.dist-info/METADATA,sha256=ka6gwfc4dPZXyj_5xc2OSjv9UWP9jlwqMx_TS7qxaqU,35433
|
|
1132
|
+
supervisely-6.73.439.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
1133
|
+
supervisely-6.73.439.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
|
|
1134
|
+
supervisely-6.73.439.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
|
|
1135
|
+
supervisely-6.73.439.dist-info/RECORD,,
|
supervisely_lib/__init__.py
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import sys
|
|
2
|
+
|
|
2
3
|
import supervisely
|
|
3
4
|
from supervisely import *
|
|
4
5
|
|
|
5
6
|
sys.modules['supervisely_lib'] = supervisely
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
for module_name in list(sys.modules.keys()):
|
|
9
|
+
if module_name.startswith("supervisely."):
|
|
10
|
+
new_name = module_name.replace("supervisely.", "supervisely_lib.", 1)
|
|
11
|
+
sys.modules[new_name] = sys.modules[module_name]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|