@@ -148,7 +148,7 @@ def get_path(self, file_name, verbose=True) -> Union[str, None]:
148148 if file_name == base_name :
149149 return file_path
150150 if verbose :
151- print ("{ } is not a file in this example" . format ( file_name ) )
151+ print (f' { file_name } is not a file in this example.' )
152152 return None
153153
154154 def downloaded (self ) -> bool :
@@ -179,9 +179,7 @@ def explain(self) -> None:
179179 def download (self , path = get_data_home ()):
180180 """Download the files for the example."""
181181
182- if self .downloaded ():
183- print ("Already downloaded" )
184- else :
182+ if not self .downloaded ():
185183 request = requests .get (self .download_url )
186184 archive = zipfile .ZipFile (io .BytesIO (request .content ))
187185 target = join (path , self .root )
@@ -231,7 +229,7 @@ def explain(self, example_name) -> str:
231229 print ("not available" )
232230
233231 def available (self ):
234- """Report available datasets."""
232+ """Return df of available datasets."""
235233 datasets = self .datasets
236234 names = list (datasets .keys ())
237235 names .sort ()
@@ -244,7 +242,7 @@ def available(self):
244242 data = rows , columns = ["Name" , "Description" , "Installed" ]
245243 )
246244 datasets .style .set_properties (subset = ["text" ], ** {"width" : "300px" })
247- print ( datasets . to_string ( max_colwidth = 60 ))
245+ return datasets
248246
249247 def load (self , example_name : str ) -> Example :
250248 """Load example dataset, download if not locally available."""
@@ -253,11 +251,10 @@ def load(self, example_name: str) -> Example:
253251 if example .installed :
254252 return example
255253 else :
256- "Downloading: {}" .format (example_name )
257254 example .download ()
258255 return example
259256 else :
260- print (" Example not available: {}" . format ( example_name ) )
257+ print (f' Example not available: { example_name } ' )
261258 return None
262259
263260 def download_remotes (self ):
@@ -271,7 +268,7 @@ def download_remotes(self):
271268 try :
272269 example .download ()
273270 except :
274- print (" Example not downloaded: {}" . format ( name ) )
271+ print (f' Example not downloaded: { name } .' )
275272
276273 def get_installed_names (self ) -> list :
277274 """Return names of all currently installed datasets."""
0 commit comments