Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pre-commit hooks #267

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
args: ["--drop-empty-cells",
"--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
rev: v0.9.1
hooks:
- id: ruff-format
types_or: [ python, pyi ]
Expand All @@ -43,6 +43,6 @@ repos:
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: https://github.com/rhysd/actionlint
rev: v1.7.4
rev: v1.7.6
hooks:
- id: actionlint
2 changes: 1 addition & 1 deletion src/scitacean/_html_repr/_dataset_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _human_readable_size(size_in_bytes: int) -> str:
for power, prefix in ((4, "T"), (3, "G"), (2, "M"), (1, "k")):
n = 1024**power
if size_in_bytes >= n:
return f"{size_in_bytes/n:.2f} {prefix}iB"
return f"{size_in_bytes / n:.2f} {prefix}iB"
return f"{size_in_bytes} B"


Expand Down
2 changes: 1 addition & 1 deletion src/scitacean/_internal/file_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def decrement(self) -> Generator[int, None, None]:
count = self._read() - 1
if count < 0:
raise RuntimeError(
f"Broken file counter, got a file with a count of {count-1}."
f"Broken file counter, got a file with a count of {count - 1}."
)
if count == 0:
self._path.unlink()
Expand Down
2 changes: 1 addition & 1 deletion src/scitacean/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, *path_segments: str | RemotePath) -> None:
)
if not isinstance(segment, (str, RemotePath)):
raise TypeError(
"Expected str or RemotePath, " f"got {type(segment).__name__}"
f"Expected str or RemotePath, got {type(segment).__name__}"
)
self._path = "/".join(s for segment in path_segments if (s := _posix(segment)))

Expand Down
2 changes: 1 addition & 1 deletion src/scitacean/testing/sftp/_sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def configure(target_dir: Path | str) -> Path:
target_dir.joinpath("Dockerfile-sftp-server").write_text(_docker_file())

target_dir.joinpath(".env").write_text(
f"""DATA_DIR={target_dir / 'data'}
f"""DATA_DIR={target_dir / "data"}
SEED_DIR={target_seed_dir}"""
)

Expand Down
3 changes: 1 addition & 2 deletions src/scitacean/transfer/sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ def upload_files(self, *files: File) -> list[File]:
def _upload_file(self, file: File) -> File:
if file.local_path is None:
raise ValueError(
f"Cannot upload file to {file.remote_path}, "
"the file has no local path"
f"Cannot upload file to {file.remote_path}, the file has no local path"
)
remote_path = self.remote_path(file.remote_path)
get_logger().info(
Expand Down
6 changes: 3 additions & 3 deletions tests/client/datablock_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ def test_create_first_orig_datablock(
assert downloaded.dataFileList is not None
for i in range(len(orig_datablock.dataFileList)):
for key, expected in orig_datablock.dataFileList[i]:
assert (
dict(downloaded.dataFileList[i])[key] == expected
), f"i = {i}, key = {key}"
assert dict(downloaded.dataFileList[i])[key] == expected, (
f"i = {i}, key = {key}"
)
Loading