@@ -43,8 +43,8 @@ def __init__(
43
43
ignore_split_file_extensions : bool = True ,
44
44
allow_substring_split_file : bool = True ,
45
45
rgb_indices : list [int ] | None = None ,
46
- dataset_bands : list [HLSBands | int | list [ int ] | str ] | None = None ,
47
- output_bands : list [HLSBands | int | list [ int ] | str ] | None = None ,
46
+ dataset_bands : list [HLSBands | int | tuple [ int , int ] | str ] | None = None ,
47
+ output_bands : list [HLSBands | int | tuple [ int , int ] | str ] | None = None ,
48
48
constant_scale : float = 1 ,
49
49
transform : A .Compose | None = None ,
50
50
no_data_replace : float | None = None ,
@@ -212,18 +212,20 @@ def _bands_as_int_or_str(self, dataset_bands, output_bands) -> type:
212
212
else :
213
213
raise Exception ("The bands must be or all str or all int." )
214
214
215
- def _bands_defined_by_interval (self , bands_list : list [int ] | list [list [int ]] = None ) -> bool :
215
+ def _bands_defined_by_interval (self , bands_list : list [int ] | list [tuple [int ]] = None ) -> bool :
216
216
if not bands_list :
217
217
return False
218
218
elif all ([type (band )== int or type (band )== str or isinstance (band , HLSBands ) for band in bands_list ]):
219
219
return False
220
- elif all ([isinstance (subinterval , list ) for subinterval in bands_list ]):
221
- if all ([type (band )== int for band in sum (bands_list , [])]):
220
+ elif all ([isinstance (subinterval , tuple ) for subinterval in bands_list ]):
221
+ bands_list_ = [list (subinterval ) for subinterval in bands_list ]
222
+ if all ([type (band )== int for band in sum (bands_list_ , [])]):
222
223
return True
223
224
else :
224
225
raise Exception (f"Whe using subintervals, the limits must be int." )
225
226
else :
226
- raise Exception (f"Excpected List[int] or List[str] or List[List[int]], but received { type (bands_list )} ." )
227
+ print (bands_list )
228
+ raise Exception (f"Excpected List[int] or List[str] or List[tuple[int, int]], but received { type (bands_list )} ." )
227
229
228
230
class GenericNonGeoSegmentationDataset (GenericPixelWiseDataset ):
229
231
"""GenericNonGeoSegmentationDataset"""
@@ -239,8 +241,8 @@ def __init__(
239
241
ignore_split_file_extensions : bool = True ,
240
242
allow_substring_split_file : bool = True ,
241
243
rgb_indices : list [str ] | None = None ,
242
- dataset_bands : list [HLSBands | int | list [ int ] | str ] | None = None ,
243
- output_bands : list [HLSBands | int | list [ int ] | str ] | None = None ,
244
+ dataset_bands : list [HLSBands | int | tuple [ int , int ] | str ] | None = None ,
245
+ output_bands : list [HLSBands | int | tuple [ int , int ] | str ] | None = None ,
244
246
class_names : list [str ] | None = None ,
245
247
constant_scale : float = 1 ,
246
248
transform : A .Compose | None = None ,
@@ -406,8 +408,8 @@ def __init__(
406
408
ignore_split_file_extensions : bool = True ,
407
409
allow_substring_split_file : bool = True ,
408
410
rgb_indices : list [int ] | None = None ,
409
- dataset_bands : list [HLSBands | int | list [ int ] | str ] | None = None ,
410
- output_bands : list [HLSBands | int | list [ int ] | str ] | None = None ,
411
+ dataset_bands : list [HLSBands | int | tuple [ int , int ] | str ] | None = None ,
412
+ output_bands : list [HLSBands | int | tuple [ int , int ] | str ] | None = None ,
411
413
constant_scale : float = 1 ,
412
414
transform : A .Compose | None = None ,
413
415
no_data_replace : float | None = None ,
0 commit comments