1515import  unittest .mock 
1616import  zipfile 
1717from  collections  import  defaultdict 
18- from  typing  import  Any , Callable , Dict , Iterator , List , Optional , Sequence , Tuple , Union 
18+ from  collections .abc  import  Iterator , Sequence 
19+ from  typing  import  Any , Callable , Optional , Union 
1920
2021import  numpy  as  np 
2122
@@ -63,6 +64,7 @@ class LazyImporter:
6364    provide modules listed in MODULES as attributes. They are only imported when accessed. 
6465
6566    """ 
67+ 
6668    MODULES  =  (
6769        "av" ,
6870        "lmdb" ,
@@ -280,7 +282,7 @@ def test_baz(self):
280282        "download_and_extract_archive" ,
281283    }
282284
283-     def  dataset_args (self , tmpdir : str , config : Dict [str , Any ]) ->  Sequence [Any ]:
285+     def  dataset_args (self , tmpdir : str , config : dict [str , Any ]) ->  Sequence [Any ]:
284286        """Define positional arguments passed to the dataset. 
285287
286288        .. note:: 
@@ -299,7 +301,7 @@ def dataset_args(self, tmpdir: str, config: Dict[str, Any]) -> Sequence[Any]:
299301        """ 
300302        return  (tmpdir ,)
301303
302-     def  inject_fake_data (self , tmpdir : str , config : Dict [str , Any ]) ->  Union [int , Dict [str , Any ]]:
304+     def  inject_fake_data (self , tmpdir : str , config : dict [str , Any ]) ->  Union [int , dict [str , Any ]]:
303305        """Inject fake data for dataset into a temporary directory. 
304306
305307        During the creation of the dataset the download and extract logic is disabled. Thus, the fake data injected 
@@ -323,11 +325,11 @@ def inject_fake_data(self, tmpdir: str, config: Dict[str, Any]) -> Union[int, Di
323325    @contextlib .contextmanager  
324326    def  create_dataset (
325327        self ,
326-         config : Optional [Dict [str , Any ]] =  None ,
328+         config : Optional [dict [str , Any ]] =  None ,
327329        inject_fake_data : bool  =  True ,
328330        patch_checks : Optional [bool ] =  None ,
329331        ** kwargs : Any ,
330-     ) ->  Iterator [Tuple [torchvision .datasets .VisionDataset , Dict [str , Any ]]]:
332+     ) ->  Iterator [tuple [torchvision .datasets .VisionDataset , dict [str , Any ]]]:
331333        r"""Create the dataset in a temporary directory. 
332334
333335        The configuration passed to the dataset is populated to contain at least all parameters with default values. 
@@ -616,11 +618,11 @@ class ImageDatasetTestCase(DatasetTestCase):
616618    @contextlib .contextmanager  
617619    def  create_dataset (
618620        self ,
619-         config : Optional [Dict [str , Any ]] =  None ,
621+         config : Optional [dict [str , Any ]] =  None ,
620622        inject_fake_data : bool  =  True ,
621623        patch_checks : Optional [bool ] =  None ,
622624        ** kwargs : Any ,
623-     ) ->  Iterator [Tuple [torchvision .datasets .VisionDataset , Dict [str , Any ]]]:
625+     ) ->  Iterator [tuple [torchvision .datasets .VisionDataset , dict [str , Any ]]]:
624626        with  super ().create_dataset (
625627            config = config ,
626628            inject_fake_data = inject_fake_data ,
@@ -799,7 +801,7 @@ def create_image_folder(
799801    num_examples : int ,
800802    size : Optional [Union [Sequence [int ], int , Callable [[int ], Union [Sequence [int ], int ]]]] =  None ,
801803    ** kwargs : Any ,
802- ) ->  List [pathlib .Path ]:
804+ ) ->  list [pathlib .Path ]:
803805    """Create a folder of random images. 
804806
805807    Args: 
@@ -821,7 +823,7 @@ def create_image_folder(
821823    """ 
822824    if  size  is  None :
823825
824-         def  size (idx : int ) ->  Tuple [int , int , int ]:
826+         def  size (idx : int ) ->  tuple [int , int , int ]:
825827            num_channels  =  3 
826828            height , width  =  torch .randint (3 , 11 , size = (2 ,), dtype = torch .int ).tolist ()
827829            return  (num_channels , height , width )
@@ -913,7 +915,7 @@ def create_video_folder(
913915    size : Optional [Union [Sequence [int ], int , Callable [[int ], Union [Sequence [int ], int ]]]] =  None ,
914916    fps = 25 ,
915917    ** kwargs ,
916- ) ->  List [pathlib .Path ]:
918+ ) ->  list [pathlib .Path ]:
917919    """Create a folder of random videos. 
918920
919921    Args: 
0 commit comments