@@ -304,7 +304,8 @@ def __init__(self, backend: SqlBackend, ws: WorkspaceClient, inventory_database:
304304 super ().__init__ (backend , "hive_metastore" , inventory_database , "mounts" , Mount )
305305 self ._dbutils = ws .dbutils
306306
307- def _deduplicate_mounts (self , mounts : list ) -> list :
307+ @staticmethod
308+ def _deduplicate_mounts (mounts : list ) -> list :
308309 seen = set ()
309310 deduplicated_mounts = []
310311 for obj in mounts :
@@ -395,7 +396,8 @@ def _try_fetch(self) -> Iterable[Table]:
395396 ):
396397 yield Table (* row )
397398
398- def _get_tables_paths_from_assessment (self , loaded_records : Iterable [Table ]) -> dict [str , str ]:
399+ @staticmethod
400+ def _get_tables_paths_from_assessment (loaded_records : Iterable [Table ]) -> dict [str , str ]:
399401 seen = {}
400402 for rec in loaded_records :
401403 if not rec .location :
@@ -410,8 +412,8 @@ def _crawl_tables(self, table_paths_from_assessment: dict[str, str]) -> list[Tab
410412 if self ._include_mounts and mount .name not in self ._include_mounts :
411413 logger .info (f"Filtering mount { mount .name } " )
412414 continue
413- table_paths = {}
414415 if self ._include_paths_in_mount :
416+ table_paths = {}
415417 for path in self ._include_paths_in_mount :
416418 table_paths .update (self ._find_delta_log_folders (path ))
417419 else :
@@ -446,7 +448,8 @@ def _crawl_tables(self, table_paths_from_assessment: dict[str, str]) -> list[Tab
446448 logger .info (f"Found a total of { len (all_tables )} tables in mount points" )
447449 return all_tables
448450
449- def _get_table_location (self , mount : Mount , path : str ):
451+ @staticmethod
452+ def _get_table_location (mount : Mount , path : str ) -> str :
450453 """
451454 There can be different cases for mounts:
452455 - Mount(name='/mnt/things/a', source='abfss://[email protected] /a') @@ -457,7 +460,11 @@ def _get_table_location(self, mount: Mount, path: str):
457460 return path .replace (f"dbfs:{ mount .name } /" , mount .source )
458461 return path .replace (f"dbfs:{ mount .name } " , mount .source )
459462
460- def _find_delta_log_folders (self , root_dir : str , delta_log_folders = None ) -> dict :
463+ def _find_delta_log_folders (
464+ self ,
465+ root_dir : str ,
466+ delta_log_folders : dict [str , TableInMount ] | None = None ,
467+ ) -> dict [str , TableInMount ]:
461468 if delta_log_folders is None :
462469 delta_log_folders = {}
463470 logger .info (f"Listing { root_dir } " )
@@ -519,18 +526,22 @@ def _assess_path(self, file_info: FileInfo) -> TableInMount | None:
519526 return TableInMount (format = "PARQUET" , is_partitioned = False )
520527 return None
521528
522- def _is_partitioned (self , file_name : str ) -> bool :
529+ @staticmethod
530+ def _is_partitioned (file_name : str ) -> bool :
523531 return '=' in file_name
524532
525- def _is_parquet (self , file_name : str ) -> bool :
533+ @staticmethod
534+ def _is_parquet (file_name : str ) -> bool :
526535 parquet_patterns = {'.parquet' }
527536 return any (pattern in file_name for pattern in parquet_patterns )
528537
529- def _is_csv (self , file_name : str ) -> bool :
538+ @staticmethod
539+ def _is_csv (file_name : str ) -> bool :
530540 csv_patterns = {'.csv' }
531541 return any (pattern in file_name for pattern in csv_patterns )
532542
533- def _is_json (self , file_name : str ) -> bool :
543+ @staticmethod
544+ def _is_json (file_name : str ) -> bool :
534545 json_patterns = {'.json' }
535546 return any (pattern in file_name for pattern in json_patterns )
536547
0 commit comments