@@ -170,7 +170,7 @@ def _discover_available_indices(self, refresh: bool = False) -> dict:
170170 refresh is requested.
171171
172172 Args:
173- refresh: If True, forces a refresh of the cached index list and schemas.
173+ refresh: If True, forces a refresh of the cached index list and schemas.
174174 If False, loads from disk cache if available.
175175
176176 Returns:
@@ -293,10 +293,12 @@ def _discover_available_indices(self, refresh: bool = False) -> dict:
293293 "description" : "Index containing one row per DICOM series from all previous IDC versions that are not in current version." ,
294294 "installed" : True ,
295295 "url" : None ,
296- "file_path" : str (idc_index_data .PRIOR_VERSIONS_INDEX_PARQUET_FILEPATH ),
296+ "file_path" : str (
297+ idc_index_data .PRIOR_VERSIONS_INDEX_PARQUET_FILEPATH
298+ ),
297299 },
298300 }
299-
301+
300302 # Try to fetch schemas for bundled indices even when API fails
301303 for index_name , schema_filename in [
302304 ("index" , "idc_index.json" ),
@@ -305,7 +307,9 @@ def _discover_available_indices(self, refresh: bool = False) -> dict:
305307 schema_url = f"{ asset_endpoint_url } /{ schema_filename } "
306308 schema = self ._fetch_index_schema_from_url (schema_url )
307309 if schema :
308- indices [index_name ]["description" ] = schema .get ("table_description" , indices [index_name ]["description" ])
310+ indices [index_name ]["description" ] = schema .get (
311+ "table_description" , indices [index_name ]["description" ]
312+ )
309313 self ._index_schemas [index_name ] = schema
310314
311315 # Save to disk cache
@@ -321,21 +325,21 @@ def _load_indices_cache_from_disk(self) -> dict | None:
321325 None otherwise.
322326 """
323327 cache_file = os .path .join (self .indices_data_dir , "indices_cache.json" )
324-
328+
325329 if not os .path .exists (cache_file ):
326330 return None
327331
328332 try :
329333 with open (cache_file ) as f :
330334 cache_data = json .load (f )
331-
335+
332336 # Verify cache is for current version
333337 if cache_data .get ("version" ) != idc_index_data .__version__ :
334338 logger .debug (
335339 f"Cache version mismatch: { cache_data .get ('version' )} != { idc_index_data .__version__ } "
336340 )
337341 return None
338-
342+
339343 return {
340344 "indices" : cache_data .get ("indices" , {}),
341345 "schemas" : cache_data .get ("schemas" , {}),
@@ -352,19 +356,19 @@ def _save_indices_cache_to_disk(self, indices: dict, schemas: dict) -> None:
352356 schemas: Dictionary of index schemas
353357 """
354358 cache_file = os .path .join (self .indices_data_dir , "indices_cache.json" )
355-
359+
356360 try :
357361 os .makedirs (self .indices_data_dir , exist_ok = True )
358-
362+
359363 cache_data = {
360364 "version" : idc_index_data .__version__ ,
361365 "indices" : indices ,
362366 "schemas" : schemas ,
363367 }
364-
368+
365369 with open (cache_file , "w" ) as f :
366370 json .dump (cache_data , f , indent = 2 )
367-
371+
368372 logger .debug (f"Saved indices cache to { cache_file } " )
369373 except (OSError , TypeError ) as e :
370374 logger .warning (f"Failed to save indices cache to disk: { e } " )
0 commit comments