code-loader 1.0.49.dev2__py3-none-any.whl → 1.0.49.dev4__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.
- code_loader/contract/datasetclasses.py +4 -0
- code_loader/leaploader.py +14 -4
- {code_loader-1.0.49.dev2.dist-info → code_loader-1.0.49.dev4.dist-info}/METADATA +1 -1
- {code_loader-1.0.49.dev2.dist-info → code_loader-1.0.49.dev4.dist-info}/RECORD +6 -6
- {code_loader-1.0.49.dev2.dist-info → code_loader-1.0.49.dev4.dist-info}/LICENSE +0 -0
- {code_loader-1.0.49.dev2.dist-info → code_loader-1.0.49.dev4.dist-info}/WHEEL +0 -0
@@ -36,12 +36,16 @@ class PreprocessResponse:
|
|
36
36
|
data: Any = None
|
37
37
|
sample_ids: Optional[Union[List[str], List[int]]] = None
|
38
38
|
state: Optional[DataStateType] = None
|
39
|
+
sample_id_type: Optional[Type] = None
|
39
40
|
|
40
41
|
def __post_init__(self):
|
41
42
|
if self.length is not None and self.sample_ids is None:
|
42
43
|
self.sample_ids = [i for i in range(self.length)]
|
44
|
+
self.id_type = int
|
43
45
|
elif self.length is None and self.sample_ids is not None:
|
44
46
|
self.length = len(self.sample_ids)
|
47
|
+
if self.id_type is None:
|
48
|
+
self.id_type = str
|
45
49
|
else:
|
46
50
|
raise Exception("length is deprecated. Please use sample_ids instead.")
|
47
51
|
|
code_loader/leaploader.py
CHANGED
@@ -6,7 +6,7 @@ import time
|
|
6
6
|
from contextlib import redirect_stdout
|
7
7
|
from functools import lru_cache
|
8
8
|
from pathlib import Path
|
9
|
-
from typing import Dict, List, Iterable, Union, Any
|
9
|
+
from typing import Dict, List, Iterable, Union, Any, Type
|
10
10
|
|
11
11
|
import numpy as np
|
12
12
|
import numpy.typing as npt
|
@@ -298,15 +298,14 @@ class LeapLoader:
|
|
298
298
|
|
299
299
|
return self._preprocess_result_cached
|
300
300
|
|
301
|
-
def get_preprocess_sample_ids(self) -> Dict[DataStateEnum, Union[List[int], List[str]]]:
|
302
|
-
preprocess_result = self._preprocess_result()
|
301
|
+
def get_preprocess_sample_ids(self, update_unlabeled_preprocess=False) -> Dict[DataStateEnum, Union[List[int], List[str]]]:
|
302
|
+
preprocess_result = self._preprocess_result(update_unlabeled_preprocess)
|
303
303
|
sample_ids = {}
|
304
304
|
for state, preprocess_response in preprocess_result.items():
|
305
305
|
sample_ids[state] = preprocess_response.sample_ids
|
306
306
|
|
307
307
|
return sample_ids
|
308
308
|
|
309
|
-
|
310
309
|
def _get_dataset_handlers(self, handlers: Iterable[DatasetBaseHandler],
|
311
310
|
state: DataStateEnum, idx: int) -> Dict[str, npt.NDArray[np.float32]]:
|
312
311
|
result_agg = {}
|
@@ -372,3 +371,14 @@ class LeapLoader:
|
|
372
371
|
result_agg[handler_name] = self._convert_metadata_to_correct_type(handler_name, handler_result)
|
373
372
|
|
374
373
|
return result_agg
|
374
|
+
|
375
|
+
@lru_cache()
|
376
|
+
def get_sample_id_type(self) -> Type:
|
377
|
+
preprocess_results = list(self._preprocess_result().values())
|
378
|
+
id_type = preprocess_results[0].sample_id_type
|
379
|
+
for preprocess_result in preprocess_results:
|
380
|
+
if preprocess_result.sample_id_type != id_type:
|
381
|
+
raise Exception("Different id types in preprocess results")
|
382
|
+
|
383
|
+
return id_type
|
384
|
+
|
@@ -2,7 +2,7 @@ LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
2
2
|
code_loader/__init__.py,sha256=6MMWr0ObOU7hkqQKgOqp4Zp3I28L7joGC9iCbQYtAJg,241
|
3
3
|
code_loader/code_inegration_processes_manager.py,sha256=XslWOPeNQk4RAFJ_f3tP5Oe3EgcIR7BE7Y8r9Ty73-o,3261
|
4
4
|
code_loader/contract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
code_loader/contract/datasetclasses.py,sha256=
|
5
|
+
code_loader/contract/datasetclasses.py,sha256=CeOvI1R1CI5OQN1KVUj45p_VVGq0h6I2T888Smztp0Y,6382
|
6
6
|
code_loader/contract/enums.py,sha256=6Lo7p5CUog68Fd31bCozIuOgIp_IhSiPqWWph2k3OGU,1602
|
7
7
|
code_loader/contract/exceptions.py,sha256=jWqu5i7t-0IG0jGRsKF4DjJdrsdpJjIYpUkN1F4RiyQ,51
|
8
8
|
code_loader/contract/responsedataclasses.py,sha256=w7xVOv2S8Hyb5lqyomMGiKAWXDTSOG-FX1YW39bXD3A,3969
|
@@ -19,11 +19,11 @@ code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZ
|
|
19
19
|
code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
|
20
20
|
code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
|
21
21
|
code_loader/inner_leap_binder/leapbinder.py,sha256=m-9eNKYqK71irfEd4T1bNyM9t8mh_utdUDPYvbK34UY,24902
|
22
|
-
code_loader/leaploader.py,sha256=
|
22
|
+
code_loader/leaploader.py,sha256=z_lfyuWIsHXvO8aEFrtNqLRXcuLoxWZsZaSnonMyx98,18927
|
23
23
|
code_loader/utils.py,sha256=TZAoUbA2pE8eK3Le3s5Xr4eRaYdeDMQtxotx6rh-5oE,2185
|
24
24
|
code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
25
|
code_loader/visualizers/default_visualizers.py,sha256=VoqO9FN84yXyMjRjHjUTOt2GdTkJRMbHbXJ1cJkREkk,2230
|
26
|
-
code_loader-1.0.49.
|
27
|
-
code_loader-1.0.49.
|
28
|
-
code_loader-1.0.49.
|
29
|
-
code_loader-1.0.49.
|
26
|
+
code_loader-1.0.49.dev4.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
27
|
+
code_loader-1.0.49.dev4.dist-info/METADATA,sha256=bW2ocZTxKynjDtRp1uXW0aiPYcjQu3wb3sptVes61eg,893
|
28
|
+
code_loader-1.0.49.dev4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
29
|
+
code_loader-1.0.49.dev4.dist-info/RECORD,,
|
File without changes
|
File without changes
|