Upload register.py with huggingface_hub
Browse files112326 unmodified lines3031323433343536373839394041424316 unmodified lines606162626364656667686970716772737475import copyimport importlibimport inspectimport os26 unmodified lines
def register_local_catalog(catalog_path: str): assert os.path.exists(catalog_path), f"Catalog path {catalog_path} does not exist." assert os.path.isdir(catalog_path), f"Catalog path {catalog_path} is not a directory." assert os.path.isdir( catalog_path ), f"Catalog path {catalog_path} is not a directory." _register_catalog(LocalCatalog(location=catalog_path))
def _catalogs_list(): return list(a for a in Artifactories()) return list(Artifactories())
def _register_all_catalogs():16 unmodified lines file_name = os.path.basename(__file__)
for file in os.listdir(dir): if file.endswith(".py") and file not in non_registered_files and file != file_name: if ( file.endswith(".py") and file not in non_registered_files and file != file_name ): module_name = file.replace(".py", "")
module = importlib.import_module("." + module_name, __package__)
for name, obj in inspect.getmembers(module): for _name, obj in inspect.getmembers(module): # Make sure the object is a class if inspect.isclass(obj): # Make sure the class is a subclass of Artifact (but not Artifact itself)register.py+10-5