mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-09-08 10:14:35 +08:00
Refactor: reformat all code for lefthook using ruff and gofmt (#16585)
This commit is contained in:
@@ -39,20 +39,14 @@ def _restore_common_data_source_package() -> None:
|
||||
return
|
||||
if not isinstance(mod, types.ModuleType) or not getattr(mod, "__path__", None):
|
||||
return
|
||||
keys = [
|
||||
key
|
||||
for key in sys.modules
|
||||
if key == "common.data_source" or key.startswith("common.data_source.")
|
||||
]
|
||||
keys = [key for key in sys.modules if key == "common.data_source" or key.startswith("common.data_source.")]
|
||||
for key in keys:
|
||||
del sys.modules[key]
|
||||
importlib.invalidate_caches()
|
||||
try:
|
||||
importlib.import_module("common.data_source")
|
||||
except Exception as exc: # pragma: no cover
|
||||
raise ImportError(
|
||||
"conftest: failed to restore real common.data_source package"
|
||||
) from exc
|
||||
raise ImportError("conftest: failed to restore real common.data_source package") from exc
|
||||
|
||||
|
||||
_restore_common_data_source_package()
|
||||
|
||||
Reference in New Issue
Block a user