supervisely 6.73.308__py3-none-any.whl → 6.73.309__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.
@@ -176,7 +176,7 @@ class TagMeta(KeyObject, JsonSerializable):
176
176
  self._applicable_to, SUPPORTED_APPLICABLE_TO
177
177
  )
178
178
  )
179
-
179
+
180
180
  if self._target_type not in SUPPORTED_TARGET_TYPES:
181
181
  raise ValueError(
182
182
  "target_type = {!r} is unknown, should be one of {}".format(
@@ -362,7 +362,7 @@ class TagMeta(KeyObject, JsonSerializable):
362
362
  # Output: ['car', 'bicycle']
363
363
  """
364
364
  return self._applicable_classes
365
-
365
+
366
366
  @property
367
367
  def target_type(self) -> str:
368
368
  """
@@ -430,6 +430,12 @@ class TagMeta(KeyObject, JsonSerializable):
430
430
  TagMetaJsonFields.VALUE_TYPE: self.value_type,
431
431
  TagMetaJsonFields.COLOR: rgb2hex(self.color),
432
432
  }
433
+
434
+ #! fix for the issue with the default value of the target_type
435
+ #! while restoring Data Version with old class definitions
436
+ if not hasattr(self, "_target_type"):
437
+ self._target_type = TagTargetType.ALL
438
+
433
439
  if self.value_type == TagValueType.ONEOF_STRING:
434
440
  jdict[TagMetaJsonFields.VALUES] = self.possible_values
435
441
 
@@ -1799,7 +1799,12 @@ class ProjectApi(CloneableModuleApi, UpdateableModule, RemoveableModuleApi):
1799
1799
  self.update_meta(id, meta)
1800
1800
 
1801
1801
  def _set_custom_grouping_settings(
1802
- self, id: int, group_images: bool, tag_name: str, sync: bool, label_group_tag_name: str = None
1802
+ self,
1803
+ id: int,
1804
+ group_images: bool,
1805
+ tag_name: str,
1806
+ sync: bool,
1807
+ label_group_tag_name: str = None,
1803
1808
  ) -> None:
1804
1809
  """Sets the project settings for custom grouping.
1805
1810
 
@@ -71,6 +71,31 @@ from supervisely.sly_logger import logger
71
71
  from supervisely.task.progress import Progress, tqdm_sly
72
72
 
73
73
 
74
+ class CustomUnpickler(pickle.Unpickler):
75
+ """
76
+ Custom Unpickler to load pickled objects with fields that are not present in the class definition.
77
+ Used to load old pickled objects that have been pickled with a class that has been updated.
78
+ Supports loading namedtuple objects with missing fields.
79
+ """
80
+
81
+ def find_class(self, module, name):
82
+ cls = super().find_class(module, name)
83
+ if hasattr(cls, "_fields"):
84
+ orig_new = cls.__new__
85
+
86
+ def new(cls, *args, **kwargs):
87
+ if len(args) < len(cls._fields):
88
+ # Set missed attrs to None
89
+ args = list(args) + [None] * (len(cls._fields) - len(args))
90
+ return orig_new(cls, *args, **kwargs)
91
+
92
+ # Create a new class dynamically
93
+ NewCls = type(f"Pickled{cls.__name__}", (cls,), {"__new__": new})
94
+ return NewCls
95
+
96
+ return cls
97
+
98
+
74
99
  # @TODO: rename img_path to item_path (maybe convert namedtuple to class and create fields and props)
75
100
  class ItemPaths(NamedTuple):
76
101
  #: :class:`str`: Full image file path of item
@@ -3289,10 +3314,10 @@ class Project:
3289
3314
  figures: Dict[int, List[sly.FigureInfo]] # image_id: List of figure_infos
3290
3315
  alpha_geometries: Dict[int, List[dict]] # figure_id: List of geometries
3291
3316
  with file if isinstance(file, io.BytesIO) else open(file, "rb") as f:
3292
- project_info, meta, dataset_infos, image_infos, figures, alpha_geometries = pickle.load(
3293
- f
3317
+ unpickler = CustomUnpickler(f)
3318
+ project_info, meta, dataset_infos, image_infos, figures, alpha_geometries = (
3319
+ unpickler.load()
3294
3320
  )
3295
-
3296
3321
  if project_name is None:
3297
3322
  project_name = project_info.name
3298
3323
  new_project_info = api.project.create(
@@ -3354,7 +3379,8 @@ class Project:
3354
3379
  )
3355
3380
  workspace_info = api.workspace.get_info_by_id(workspace_id)
3356
3381
  existing_links = api.image.check_existing_links(
3357
- list(set([inf.link for inf in image_infos if inf.link])), team_id=workspace_info.team_id
3382
+ list(set([inf.link for inf in image_infos if inf.link])),
3383
+ team_id=workspace_info.team_id,
3358
3384
  )
3359
3385
  image_infos = sorted(image_infos, key=lambda info: info.link is not None)
3360
3386
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.308
3
+ Version: 6.73.309
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -15,7 +15,7 @@ supervisely/annotation/obj_class_mapper.py,sha256=aIJDoRULqcAOD2a1CQPk2OOF8k3VPP
15
15
  supervisely/annotation/renamer.py,sha256=rVvNLtpfd1kKUVPgm8VlLmYSDByWjriJ92FobC4buqY,1944
16
16
  supervisely/annotation/tag.py,sha256=m_sPgrr_ZW8HuiK7Fr2-WnHwKwez1WZtGrcdZN2DZuQ,17598
17
17
  supervisely/annotation/tag_collection.py,sha256=MVPTzer9rLpD4O0g2XhYFUheK7-ILgwAXDJd1em3kZ8,10015
18
- supervisely/annotation/tag_meta.py,sha256=2UkgRSMuQ7LXH48Ok2bJNdlK-miX54wXYAoB_as9_a0,27543
18
+ supervisely/annotation/tag_meta.py,sha256=nTRKVuW_h6mGdTxuwXvtR2ERhwOvjjdUf635ONLFFx8,27767
19
19
  supervisely/annotation/tag_meta_collection.py,sha256=JY2wAo4dF47UylYeglkJtRtpVOArGjf3dXeEYIHFWP0,14491
20
20
  supervisely/annotation/tag_meta_mapper.py,sha256=RWeTrxJ64syodyhXIRSH007bX6Hr3B45tG14YTcpwSU,1639
21
21
  supervisely/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -36,7 +36,7 @@ supervisely/api/module_api.py,sha256=06YJ-LsDDEAIZTnoexqcUilgT3VBDw-I0b4h_bQnCO0
36
36
  supervisely/api/neural_network_api.py,sha256=ktPVRO4Jeulougio8F0mioJJHwRJcX250Djp1wBoQ9c,7620
37
37
  supervisely/api/object_class_api.py,sha256=-rQcKwhBw3iL9KNH9c1ROgoimgWM1ls6Wi_tb1R-MzY,7683
38
38
  supervisely/api/plugin_api.py,sha256=TlfrosdRuYG4NUxk92QiQoVaOdztFspPpygyVa3M3zk,5283
39
- supervisely/api/project_api.py,sha256=pBhZlSL3IA0FeBoK8eyhFDh8pnW_X8mbmit4cAJQUoo,79951
39
+ supervisely/api/project_api.py,sha256=WwpwzsQjue2276Rn_wkcPxJAM4OaQr6haf81ZmCGpBI,79992
40
40
  supervisely/api/project_class_api.py,sha256=5cyjdGPPb2tpttu5WmYoOxUNiDxqiojschkhZumF0KM,1426
41
41
  supervisely/api/remote_storage_api.py,sha256=qTuPhPsstgEjRm1g-ZInddik8BNC_38YvBBPvgmim6U,17790
42
42
  supervisely/api/report_api.py,sha256=Om7CGulUbQ4BuJ16eDtz7luLe0JQNqab-LoLpUXu7YE,7123
@@ -1013,7 +1013,7 @@ supervisely/project/data_version.py,sha256=nknaWJSUCwoDyNG9_d1KA-GjzidhV9zd9Cn8c
1013
1013
  supervisely/project/download.py,sha256=zb8sb4XZ6Qi3CP7fmtLRUAYzaxs_W0WnOfe2x3ZVRMs,24639
1014
1014
  supervisely/project/pointcloud_episode_project.py,sha256=yiWdNBQiI6f1O9sr1pg8JHW6O-w3XUB1rikJNn3Oung,41866
1015
1015
  supervisely/project/pointcloud_project.py,sha256=Kx1Vaes-krwG3BiRRtHRLQxb9G5m5bTHPN9IzRqmNWo,49399
1016
- supervisely/project/project.py,sha256=pDKRPZZCwW79wlfDi4JK9rOZisO2vWRfiOD_j7AId5k,202403
1016
+ supervisely/project/project.py,sha256=LHsrMBbMxdMynhuS0RhjiRFxnzikj6esyKFfR8kEZ9Q,203388
1017
1017
  supervisely/project/project_meta.py,sha256=26s8IiHC5Pg8B1AQi6_CrsWteioJP2in00cRNe8QlW0,51423
1018
1018
  supervisely/project/project_settings.py,sha256=NLThzU_DCynOK6hkHhVdFyezwprn9UqlnrLDe_3qhkY,9347
1019
1019
  supervisely/project/project_type.py,sha256=EZDJFRi4MmC_5epYexBgML5WMZsWdEVk_CjqDQy5m3c,572
@@ -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.308.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1079
- supervisely-6.73.308.dist-info/METADATA,sha256=ahArJ7ylpv1q99AgrwIkcjoNL8-Dy-E6vWP5v4NCgow,33573
1080
- supervisely-6.73.308.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1081
- supervisely-6.73.308.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1082
- supervisely-6.73.308.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1083
- supervisely-6.73.308.dist-info/RECORD,,
1078
+ supervisely-6.73.309.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1079
+ supervisely-6.73.309.dist-info/METADATA,sha256=Ek8RYYRA_kKO3OyWLaXtIBmF7b61iOmD3h56s3gDFaI,33573
1080
+ supervisely-6.73.309.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1081
+ supervisely-6.73.309.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1082
+ supervisely-6.73.309.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1083
+ supervisely-6.73.309.dist-info/RECORD,,