adopt ruff as the replacement for python black (#332)

This commit is contained in:
Shuchang Zheng
2024-05-16 18:20:11 -07:00
committed by GitHub
parent 7a2be7e355
commit 2466897158
44 changed files with 1081 additions and 321 deletions

View File

@@ -28,7 +28,11 @@ class LocalStorage(BaseStorage):
with open(file_path, "wb") as f:
f.write(data)
except Exception:
LOG.exception("Failed to store artifact locally.", file_path=file_path, artifact=artifact)
LOG.exception(
"Failed to store artifact locally.",
file_path=file_path,
artifact=artifact,
)
async def store_artifact_from_path(self, artifact: Artifact, path: str) -> None:
file_path = None
@@ -37,7 +41,11 @@ class LocalStorage(BaseStorage):
self._create_directories_if_not_exists(file_path)
Path(path).replace(file_path)
except Exception:
LOG.exception("Failed to store artifact locally.", file_path=file_path, artifact=artifact)
LOG.exception(
"Failed to store artifact locally.",
file_path=file_path,
artifact=artifact,
)
async def retrieve_artifact(self, artifact: Artifact) -> bytes | None:
file_path = None
@@ -46,7 +54,11 @@ class LocalStorage(BaseStorage):
with open(file_path, "rb") as f:
return f.read()
except Exception:
LOG.exception("Failed to retrieve local artifact.", file_path=file_path, artifact=artifact)
LOG.exception(
"Failed to retrieve local artifact.",
file_path=file_path,
artifact=artifact,
)
return None
async def get_share_link(self, artifact: Artifact) -> str: