supervisely 6.73.314__py3-none-any.whl → 6.73.315__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/project/data_version.py +2 -0
 - supervisely/project/project.py +47 -7
 - {supervisely-6.73.314.dist-info → supervisely-6.73.315.dist-info}/METADATA +1 -1
 - {supervisely-6.73.314.dist-info → supervisely-6.73.315.dist-info}/RECORD +8 -8
 - {supervisely-6.73.314.dist-info → supervisely-6.73.315.dist-info}/LICENSE +0 -0
 - {supervisely-6.73.314.dist-info → supervisely-6.73.315.dist-info}/WHEEL +0 -0
 - {supervisely-6.73.314.dist-info → supervisely-6.73.315.dist-info}/entry_points.txt +0 -0
 - {supervisely-6.73.314.dist-info → supervisely-6.73.315.dist-info}/top_level.txt +0 -0
 
| 
         @@ -30,6 +30,7 @@ class VersionInfo(NamedTuple): 
     | 
|
| 
       30 
30 
     | 
    
         
             
                updated_at: str
         
     | 
| 
       31 
31 
     | 
    
         
             
                project_updated_at: str
         
     | 
| 
       32 
32 
     | 
    
         
             
                team_id: int
         
     | 
| 
      
 33 
     | 
    
         
            +
                name: str
         
     | 
| 
       33 
34 
     | 
    
         | 
| 
       34 
35 
     | 
    
         | 
| 
       35 
36 
     | 
    
         
             
            class DataVersion(ModuleApiBase):
         
     | 
| 
         @@ -67,6 +68,7 @@ class DataVersion(ModuleApiBase): 
     | 
|
| 
       67 
68 
     | 
    
         
             
                        ApiField.UPDATED_AT,
         
     | 
| 
       68 
69 
     | 
    
         
             
                        ApiField.PROJECT_UPDATED_AT,
         
     | 
| 
       69 
70 
     | 
    
         
             
                        ApiField.TEAM_ID,
         
     | 
| 
      
 71 
     | 
    
         
            +
                        ApiField.NAME,
         
     | 
| 
       70 
72 
     | 
    
         
             
                    ]
         
     | 
| 
       71 
73 
     | 
    
         | 
| 
       72 
74 
     | 
    
         
             
                @staticmethod
         
     | 
    
        supervisely/project/project.py
    CHANGED
    
    | 
         @@ -73,24 +73,64 @@ from supervisely.task.progress import Progress, tqdm_sly 
     | 
|
| 
       73 
73 
     | 
    
         | 
| 
       74 
74 
     | 
    
         
             
            class CustomUnpickler(pickle.Unpickler):
         
     | 
| 
       75 
75 
     | 
    
         
             
                """
         
     | 
| 
       76 
     | 
    
         
            -
                Custom Unpickler  
     | 
| 
       77 
     | 
    
         
            -
                 
     | 
| 
       78 
     | 
    
         
            -
                 
     | 
| 
      
 76 
     | 
    
         
            +
                Custom Unpickler for loading pickled objects of the same class with differing definitions.
         
     | 
| 
      
 77 
     | 
    
         
            +
                Handles cases where a class object is reconstructed using a newer definition with additional fields
         
     | 
| 
      
 78 
     | 
    
         
            +
                or an outdated definition missing some fields.
         
     | 
| 
      
 79 
     | 
    
         
            +
                Supports loading namedtuple objects with missing or extra fields.
         
     | 
| 
       79 
80 
     | 
    
         
             
                """
         
     | 
| 
       80 
81 
     | 
    
         | 
| 
      
 82 
     | 
    
         
            +
                def __init__(self, file, **kwargs):
         
     | 
| 
      
 83 
     | 
    
         
            +
                    super().__init__(file, **kwargs)
         
     | 
| 
      
 84 
     | 
    
         
            +
                    self.warned_classes = set()  # To prevent multiple warnings for the same class
         
     | 
| 
      
 85 
     | 
    
         
            +
                    self.sdk_update_notified = False
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
       81 
87 
     | 
    
         
             
                def find_class(self, module, name):
         
     | 
| 
      
 88 
     | 
    
         
            +
                    prefix = "Pickled"
         
     | 
| 
       82 
89 
     | 
    
         
             
                    cls = super().find_class(module, name)
         
     | 
| 
       83 
     | 
    
         
            -
                    if hasattr(cls, "_fields"):
         
     | 
| 
      
 90 
     | 
    
         
            +
                    if hasattr(cls, "_fields") and "Info" in cls.__name__:
         
     | 
| 
       84 
91 
     | 
    
         
             
                        orig_new = cls.__new__
         
     | 
| 
       85 
92 
     | 
    
         | 
| 
       86 
93 
     | 
    
         
             
                        def new(cls, *args, **kwargs):
         
     | 
| 
      
 94 
     | 
    
         
            +
                            orig_class_name = cls.__name__[len(prefix) :]
         
     | 
| 
      
 95 
     | 
    
         
            +
                            # Case when new definition of class has more fields than the old one
         
     | 
| 
       87 
96 
     | 
    
         
             
                            if len(args) < len(cls._fields):
         
     | 
| 
      
 97 
     | 
    
         
            +
                                default_values = cls._field_defaults
         
     | 
| 
       88 
98 
     | 
    
         
             
                                # Set missed attrs to None
         
     | 
| 
       89 
     | 
    
         
            -
                                 
     | 
| 
      
 99 
     | 
    
         
            +
                                num_missing = len(cls._fields) - len(args)
         
     | 
| 
      
 100 
     | 
    
         
            +
                                args = list(args) + [None] * num_missing
         
     | 
| 
      
 101 
     | 
    
         
            +
                                # Replace only the added None values with default values where applicable
         
     | 
| 
      
 102 
     | 
    
         
            +
                                args[-num_missing:] = [
         
     | 
| 
      
 103 
     | 
    
         
            +
                                    (
         
     | 
| 
      
 104 
     | 
    
         
            +
                                        default_values.get(field, arg)
         
     | 
| 
      
 105 
     | 
    
         
            +
                                        if arg is None and field in default_values
         
     | 
| 
      
 106 
     | 
    
         
            +
                                        else arg
         
     | 
| 
      
 107 
     | 
    
         
            +
                                    )
         
     | 
| 
      
 108 
     | 
    
         
            +
                                    for field, arg in zip(cls._fields[-num_missing:], args[-num_missing:])
         
     | 
| 
      
 109 
     | 
    
         
            +
                                ]
         
     | 
| 
      
 110 
     | 
    
         
            +
                                if orig_class_name not in self.warned_classes:
         
     | 
| 
      
 111 
     | 
    
         
            +
                                    new_fields = cls._fields[len(cls._fields) - num_missing :]
         
     | 
| 
      
 112 
     | 
    
         
            +
                                    logger.warning(
         
     | 
| 
      
 113 
     | 
    
         
            +
                                        f"New fields {new_fields} for the '{orig_class_name}' class objects are set to their default values or None due to an updated definition of this class."
         
     | 
| 
      
 114 
     | 
    
         
            +
                                    )
         
     | 
| 
      
 115 
     | 
    
         
            +
                                    self.warned_classes.add(orig_class_name)
         
     | 
| 
      
 116 
     | 
    
         
            +
                            # Case when the object of new class definition creating within old class definition
         
     | 
| 
      
 117 
     | 
    
         
            +
                            elif len(args) > len(cls._fields):
         
     | 
| 
      
 118 
     | 
    
         
            +
                                end_index = len(args)
         
     | 
| 
      
 119 
     | 
    
         
            +
                                args = args[: len(cls._fields)]
         
     | 
| 
      
 120 
     | 
    
         
            +
                                if orig_class_name not in self.warned_classes:
         
     | 
| 
      
 121 
     | 
    
         
            +
                                    logger.warning(
         
     | 
| 
      
 122 
     | 
    
         
            +
                                        f"Extra fields idx {list(range(len(cls._fields), end_index))} are ignored for '{orig_class_name}' class objects due to an outdated class definition"
         
     | 
| 
      
 123 
     | 
    
         
            +
                                    )
         
     | 
| 
      
 124 
     | 
    
         
            +
                                    self.warned_classes.add(orig_class_name)
         
     | 
| 
      
 125 
     | 
    
         
            +
                                    if not self.sdk_update_notified:
         
     | 
| 
      
 126 
     | 
    
         
            +
                                        logger.warning(
         
     | 
| 
      
 127 
     | 
    
         
            +
                                            "It is recommended to update the SDK version to restore the project version correctly."
         
     | 
| 
      
 128 
     | 
    
         
            +
                                        )
         
     | 
| 
      
 129 
     | 
    
         
            +
                                        self.sdk_update_notified = True
         
     | 
| 
       90 
130 
     | 
    
         
             
                            return orig_new(cls, *args, **kwargs)
         
     | 
| 
       91 
131 
     | 
    
         | 
| 
       92 
     | 
    
         
            -
                        # Create a new  
     | 
| 
       93 
     | 
    
         
            -
                        NewCls = type(f" 
     | 
| 
      
 132 
     | 
    
         
            +
                        # Create a new subclass dynamically to prevent redefining the current class
         
     | 
| 
      
 133 
     | 
    
         
            +
                        NewCls = type(f"{prefix}{cls.__name__}", (cls,), {"__new__": new})
         
     | 
| 
       94 
134 
     | 
    
         
             
                        return NewCls
         
     | 
| 
       95 
135 
     | 
    
         | 
| 
       96 
136 
     | 
    
         
             
                    return cls
         
     | 
| 
         @@ -1009,11 +1009,11 @@ supervisely/pointcloud_annotation/pointcloud_tag_collection.py,sha256=j_TAN23GkT 
     | 
|
| 
       1009 
1009 
     | 
    
         
             
            supervisely/pointcloud_episodes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         
     | 
| 
       1010 
1010 
     | 
    
         
             
            supervisely/pointcloud_episodes/pointcloud_episodes.py,sha256=cRXdtw7bMsbsdVQjxfWxFSESrO-LGiqqsZyyExl2Mbg,3430
         
     | 
| 
       1011 
1011 
     | 
    
         
             
            supervisely/project/__init__.py,sha256=hlzdj9Pgy53Q3qdP8LMtGTChvZHQuuShdtui2eRUQeE,2601
         
     | 
| 
       1012 
     | 
    
         
            -
            supervisely/project/data_version.py,sha256= 
     | 
| 
      
 1012 
     | 
    
         
            +
            supervisely/project/data_version.py,sha256=6vOz5ovBeCIiMAKUG7lGQ5IXvQnU1GbcnrWxdOvaVlo,19311
         
     | 
| 
       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= 
     | 
| 
      
 1016 
     | 
    
         
            +
            supervisely/project/project.py,sha256=nKnnYVrSx_MWh5G_fObaAegkRxLFJg_J074SaduEYGo,205871
         
     | 
| 
       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. 
     | 
| 
       1079 
     | 
    
         
            -
            supervisely-6.73. 
     | 
| 
       1080 
     | 
    
         
            -
            supervisely-6.73. 
     | 
| 
       1081 
     | 
    
         
            -
            supervisely-6.73. 
     | 
| 
       1082 
     | 
    
         
            -
            supervisely-6.73. 
     | 
| 
       1083 
     | 
    
         
            -
            supervisely-6.73. 
     | 
| 
      
 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,,
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     |