Skip to content

Commit

Permalink
Format files
Browse files Browse the repository at this point in the history
  • Loading branch information
exg committed Feb 29, 2024
1 parent 073fcb4 commit ed9732e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
6 changes: 4 additions & 2 deletions make_release.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import argparse
from pathlib import Path

import argparse
import re
import subprocess

Expand All @@ -14,7 +15,8 @@ def make_release(version: str) -> None:
subprocess.run(["git", "-C", str(project_directory), "add", str(version_filename)], check=True)
subprocess.run(["git", "-C", str(project_directory), "commit", "-m", f"Bump to version {version}"], check=True)
subprocess.run(
["git", "-C", str(project_directory), "tag", "-s", "-a", f"releases/{version}", "-m", f"Version {version}"], check=True
["git", "-C", str(project_directory), "tag", "-s", "-a", f"releases/{version}", "-m", f"Version {version}"],
check=True,
)
subprocess.run(["git", "-C", str(project_directory), "log", "-n", "1", "-p"], check=True)
print("Run 'git push --follow-tags' to confirm the release")
Expand Down
6 changes: 4 additions & 2 deletions rohmu/object_storage/sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ def iter_key(
metadata = None

last_modified = datetime.datetime.fromtimestamp(
attr.st_mtime, tz=datetime.timezone.utc # type: ignore[arg-type]
attr.st_mtime, # type: ignore[arg-type]
tz=datetime.timezone.utc,
)
yield IterKeyItem(
type=KEY_TYPE_OBJECT,
Expand Down Expand Up @@ -172,7 +173,8 @@ def iter_key(
metadata = None

last_modified = datetime.datetime.fromtimestamp(
attr.st_mtime, tz=datetime.timezone.utc # type: ignore[arg-type]
attr.st_mtime, # type: ignore[arg-type]
tz=datetime.timezone.utc,
)
yield IterKeyItem(
type=KEY_TYPE_OBJECT,
Expand Down
7 changes: 6 additions & 1 deletion test/notifier/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ def post(self, *args: Any, **kwargs: Any) -> None:
def __enter__(self) -> None:
pass

def __exit__(self, type: Type[BaseException], value: BaseException, traceback: TracebackType) -> None:
def __exit__(
self,
type: Type[BaseException],
value: BaseException,
traceback: TracebackType,
) -> None:
pass


Expand Down
4 changes: 1 addition & 3 deletions test/test_atomic_opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ def test_no_fd_leak_if_fdopen_fails_because_of_unknown_mode(tmp_path: Path) -> N
final_path = tmp_path / "file"
opened_fd: list[int] = []
try:
with atomic_opener(
final_path, mode="somethingrandomw", encoding="ascii", _fd_spy=opened_fd.append
): # type: ignore[call-overload]
with atomic_opener(final_path, mode="somethingrandomw", encoding="ascii", _fd_spy=opened_fd.append): # type: ignore[call-overload]
pass
pytest.fail("should fail, mode is wrong")
except ValueError:
Expand Down
15 changes: 12 additions & 3 deletions test/test_rohmu.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ def _compress_file( # type: ignore[no-untyped-def]


def _upload_compressed_file(
storage: BaseTransfer, file_to_upload: str, file_key: str, metadata: Metadata # type: ignore[type-arg]
storage: BaseTransfer, # type: ignore[type-arg]
file_to_upload: str,
file_key: str,
metadata: Metadata,
) -> None:
def upload_progress_callback(n_bytes: int) -> None:
log.debug("File: '%s', uploaded %d bytes", file_key, n_bytes)
Expand All @@ -148,7 +151,10 @@ def upload_progress_callback(n_bytes: int) -> None:


def _download_and_decompress_with_sink(
storage: BaseTransfer, output_path: str, file_key: str, metadata: Metadata # type: ignore[type-arg]
storage: BaseTransfer, # type: ignore[type-arg]
output_path: str,
file_key: str,
metadata: Metadata,
) -> int:
data, _ = storage.get_contents_to_string(file_key)
file_size = len(data)
Expand All @@ -163,7 +169,10 @@ def _download_and_decompress_with_sink(


def _download_and_decompress_with_file(
storage: BaseTransfer, output_path: str, file_key: str, metadata: Metadata # type: ignore[type-arg]
storage: BaseTransfer, # type: ignore[type-arg]
output_path: str,
file_key: str,
metadata: Metadata,
) -> int:
# Download the compressed file
file_download_path = output_path + ".tmp"
Expand Down

0 comments on commit ed9732e

Please sign in to comment.