1515import  unittest .mock 
1616import  zipfile 
1717from  collections  import  defaultdict 
18- from  typing  import  Any , Callable , Dict , Iterator , List , Optional , Sequence , Tuple , Union 
18+ from  typing  import  Any , Callable , Dict , List , Optional , Tuple , Union 
19+ from  collections .abc  import  Iterator , Sequence 
1920
2021import  numpy  as  np 
2122
@@ -280,7 +281,7 @@ def test_baz(self):
280281        "download_and_extract_archive" ,
281282    }
282283
283-     def  dataset_args (self , tmpdir : str , config : Dict [str , Any ]) ->  Sequence [Any ]:
284+     def  dataset_args (self , tmpdir : str , config : dict [str , Any ]) ->  Sequence [Any ]:
284285        """Define positional arguments passed to the dataset. 
285286
286287        .. note:: 
@@ -299,7 +300,7 @@ def dataset_args(self, tmpdir: str, config: Dict[str, Any]) -> Sequence[Any]:
299300        """ 
300301        return  (tmpdir ,)
301302
302-     def  inject_fake_data (self , tmpdir : str , config : Dict [str , Any ]) ->  Union [int , Dict [str , Any ]]:
303+     def  inject_fake_data (self , tmpdir : str , config : dict [str , Any ]) ->  Union [int , dict [str , Any ]]:
303304        """Inject fake data for dataset into a temporary directory. 
304305
305306        During the creation of the dataset the download and extract logic is disabled. Thus, the fake data injected 
@@ -323,11 +324,11 @@ def inject_fake_data(self, tmpdir: str, config: Dict[str, Any]) -> Union[int, Di
323324    @contextlib .contextmanager  
324325    def  create_dataset (
325326        self ,
326-         config : Optional [Dict [str , Any ]] =  None ,
327+         config : Optional [dict [str , Any ]] =  None ,
327328        inject_fake_data : bool  =  True ,
328329        patch_checks : Optional [bool ] =  None ,
329330        ** kwargs : Any ,
330-     ) ->  Iterator [Tuple [torchvision .datasets .VisionDataset , Dict [str , Any ]]]:
331+     ) ->  Iterator [tuple [torchvision .datasets .VisionDataset , dict [str , Any ]]]:
331332        r"""Create the dataset in a temporary directory. 
332333
333334        The configuration passed to the dataset is populated to contain at least all parameters with default values. 
@@ -616,11 +617,11 @@ class ImageDatasetTestCase(DatasetTestCase):
616617    @contextlib .contextmanager  
617618    def  create_dataset (
618619        self ,
619-         config : Optional [Dict [str , Any ]] =  None ,
620+         config : Optional [dict [str , Any ]] =  None ,
620621        inject_fake_data : bool  =  True ,
621622        patch_checks : Optional [bool ] =  None ,
622623        ** kwargs : Any ,
623-     ) ->  Iterator [Tuple [torchvision .datasets .VisionDataset , Dict [str , Any ]]]:
624+     ) ->  Iterator [tuple [torchvision .datasets .VisionDataset , dict [str , Any ]]]:
624625        with  super ().create_dataset (
625626            config = config ,
626627            inject_fake_data = inject_fake_data ,
@@ -799,7 +800,7 @@ def create_image_folder(
799800    num_examples : int ,
800801    size : Optional [Union [Sequence [int ], int , Callable [[int ], Union [Sequence [int ], int ]]]] =  None ,
801802    ** kwargs : Any ,
802- ) ->  List [pathlib .Path ]:
803+ ) ->  list [pathlib .Path ]:
803804    """Create a folder of random images. 
804805
805806    Args: 
@@ -821,7 +822,7 @@ def create_image_folder(
821822    """ 
822823    if  size  is  None :
823824
824-         def  size (idx : int ) ->  Tuple [int , int , int ]:
825+         def  size (idx : int ) ->  tuple [int , int , int ]:
825826            num_channels  =  3 
826827            height , width  =  torch .randint (3 , 11 , size = (2 ,), dtype = torch .int ).tolist ()
827828            return  (num_channels , height , width )
@@ -913,7 +914,7 @@ def create_video_folder(
913914    size : Optional [Union [Sequence [int ], int , Callable [[int ], Union [Sequence [int ], int ]]]] =  None ,
914915    fps = 25 ,
915916    ** kwargs ,
916- ) ->  List [pathlib .Path ]:
917+ ) ->  list [pathlib .Path ]:
917918    """Create a folder of random videos. 
918919
919920    Args: 
0 commit comments