From 1f6ca9332b1e74ccec76738ec40937d429044df1 Mon Sep 17 00:00:00 2001 From: Aris Tritas Date: Fri, 12 Apr 2024 19:12:57 +0200 Subject: [PATCH] Fix end of files and apply formatting changes --- .github/ISSUE_TEMPLATE/01_question.md | 1 - .github/ISSUE_TEMPLATE/02_bug.md | 1 - .github/PULL_REQUEST_TEMPLATE.md | 1 - .github/workflows/sphinx.yml | 1 - codecov.yml | 1 - docs/api__object_storage.rst | 1 - rohmu/atomic_opener.py | 6 ++-- rohmu/common/strenum.py | 1 + rohmu/compressor.py | 1 + rohmu/dates.py | 1 + rohmu/encryptor.py | 1 + rohmu/filewrap.py | 1 + rohmu/object_storage/base.py | 1 + rohmu/object_storage/google.py | 3 +- rohmu/snappyfile.py | 1 + rohmu/typing.py | 48 +++++++++------------------ rohmu/util.py | 1 + rohmu/zstdfile.py | 1 + test/common/test_statsd.py | 1 + test/test_dates.py | 1 + 20 files changed, 30 insertions(+), 44 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/01_question.md b/.github/ISSUE_TEMPLATE/01_question.md index f26695a6..64676aeb 100644 --- a/.github/ISSUE_TEMPLATE/01_question.md +++ b/.github/ISSUE_TEMPLATE/01_question.md @@ -10,4 +10,3 @@ about: Got stuck or missing something from the docs? Ask away! # Where would you expect to find this information? - diff --git a/.github/ISSUE_TEMPLATE/02_bug.md b/.github/ISSUE_TEMPLATE/02_bug.md index 2f3099c7..d89f5908 100644 --- a/.github/ISSUE_TEMPLATE/02_bug.md +++ b/.github/ISSUE_TEMPLATE/02_bug.md @@ -14,4 +14,3 @@ about: Spotted a problem? Let us know # What else do we need to know? - diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 8e3cbd33..9e8f40b3 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -9,4 +9,3 @@ Resolves: #xxxxx # Why this way - diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index 8f16b402..c6d0290f 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -45,4 +45,3 @@ jobs: git diff-index --quiet HEAD || git commit -m "From $GITHUB_REF $(echo ${GITHUB_SHA} | cut -c 1-8)" git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} git push - diff --git a/codecov.yml b/codecov.yml index 8467f897..e6761fba 100644 --- a/codecov.yml +++ b/codecov.yml @@ -9,4 +9,3 @@ coverage: if_ci_failed: error #success, failure, error, ignore only_pulls: false if_not_found: failure - diff --git a/docs/api__object_storage.rst b/docs/api__object_storage.rst index d7002f44..f52caaf2 100644 --- a/docs/api__object_storage.rst +++ b/docs/api__object_storage.rst @@ -58,4 +58,3 @@ Swift .. autoclass:: rohmu.object_storage.swift.SwiftTransfer :members: - diff --git a/rohmu/atomic_opener.py b/rohmu/atomic_opener.py index cdcc9409..3cedc04c 100644 --- a/rohmu/atomic_opener.py +++ b/rohmu/atomic_opener.py @@ -32,8 +32,7 @@ def atomic_opener( encoding: Optional[str] = None, _fd_spy: Callable[[int], None] = lambda unused: None, _after_link_hook: Callable[[], None] = lambda: None, -) -> ContextManager[BinaryIO]: - ... +) -> ContextManager[BinaryIO]: ... @overload @@ -43,8 +42,7 @@ def atomic_opener( encoding: Optional[str] = None, _fd_spy: Callable[[int], None] = lambda unused: None, _after_link_hook: Callable[[], None] = lambda: None, -) -> ContextManager[TextIO]: - ... +) -> ContextManager[TextIO]: ... def atomic_opener( diff --git a/rohmu/common/strenum.py b/rohmu/common/strenum.py index fe9e1a0e..c4548ca3 100644 --- a/rohmu/common/strenum.py +++ b/rohmu/common/strenum.py @@ -1,6 +1,7 @@ # Copyright (c) 2023 Aiven, Helsinki, Finland. https://aiven.io/ # See LICENSE for details """rohmu - StrEnum""" + from __future__ import annotations from typing import Optional diff --git a/rohmu/compressor.py b/rohmu/compressor.py index d90cd7b5..376476f2 100644 --- a/rohmu/compressor.py +++ b/rohmu/compressor.py @@ -1,6 +1,7 @@ # Copyright (c) 2016 Ohmu Ltd # See LICENSE for details """Rohmu - compressor interface""" + from .errors import InvalidConfigurationError from .filewrap import Sink, Stream from .snappyfile import SnappyFile diff --git a/rohmu/dates.py b/rohmu/dates.py index 1d3843a1..cd757b24 100644 --- a/rohmu/dates.py +++ b/rohmu/dates.py @@ -1,6 +1,7 @@ # Copyright (c) 2017 Ohmu Ltd # See LICENSE for details """Rohmu - timestamp handling""" + import datetime import dateutil.parser import dateutil.tz diff --git a/rohmu/encryptor.py b/rohmu/encryptor.py index 982ae141..5fed051c 100644 --- a/rohmu/encryptor.py +++ b/rohmu/encryptor.py @@ -6,6 +6,7 @@ Copyright (c) 2023 Aiven, Helsinki, Finland. https://aiven.io/ See LICENSE for details """ + from .common.constants import IO_BLOCK_SIZE from .errors import UninitializedError from .filewrap import FileWrap, Sink, Stream diff --git a/rohmu/filewrap.py b/rohmu/filewrap.py index 1a847e9b..c5ca5011 100644 --- a/rohmu/filewrap.py +++ b/rohmu/filewrap.py @@ -1,6 +1,7 @@ # Copyright (c) 2016 Ohmu Ltd # See LICENSE for details """Rohmu - file transformation wrapper""" + from .errors import UninitializedError from .typing import BinaryData, FileLike, HasRead, HasWrite from typing import Callable, Optional diff --git a/rohmu/object_storage/base.py b/rohmu/object_storage/base.py index 5d97691c..10730019 100644 --- a/rohmu/object_storage/base.py +++ b/rohmu/object_storage/base.py @@ -2,6 +2,7 @@ # Copyright (c) 2022 Aiven, Helsinki, Finland. https://aiven.io/ # See LICENSE for details """Rohmu - object_storage.base""" + from __future__ import annotations from contextlib import suppress diff --git a/rohmu/object_storage/google.py b/rohmu/object_storage/google.py index c00ff5fc..9f6fba23 100644 --- a/rohmu/object_storage/google.py +++ b/rohmu/object_storage/google.py @@ -729,8 +729,7 @@ def _read_bytes(self, length: int, *, initial_data: Optional[bytes] = None) -> b class MediaDownloadProtocol(Protocol): - def next_chunk(self) -> tuple[MediaDownloadProgress, bool]: - ... + def next_chunk(self) -> tuple[MediaDownloadProgress, bool]: ... class MediaIoBaseDownloadWithByteRange: diff --git a/rohmu/snappyfile.py b/rohmu/snappyfile.py index 4c316438..629d1bb5 100644 --- a/rohmu/snappyfile.py +++ b/rohmu/snappyfile.py @@ -1,6 +1,7 @@ # Copyright (c) 2016 Ohmu Ltd # See LICENSE for details """Rohmu - file-like interface for snappy""" + from .common.constants import IO_BLOCK_SIZE from .filewrap import FileWrap from .typing import BinaryData, FileLike diff --git a/rohmu/typing.py b/rohmu/typing.py index 62390a61..90421348 100644 --- a/rohmu/typing.py +++ b/rohmu/typing.py @@ -34,23 +34,19 @@ class HasFileno(Protocol): - def fileno(self) -> int: - ... + def fileno(self) -> int: ... class HasRead(Protocol): - def read(self, n: int = -1, /) -> bytes: - ... + def read(self, n: int = -1, /) -> bytes: ... class HasWrite(Protocol): - def write(self, data: BinaryData) -> int: - ... + def write(self, data: BinaryData) -> int: ... class HasSeek(Protocol): - def seek(self, offset: int, whence: int = 0, /) -> int: - ... + def seek(self, offset: int, whence: int = 0, /) -> int: ... class HasName(Protocol): @@ -58,44 +54,32 @@ class HasName(Protocol): class FileLike(Protocol): - def __enter__(self) -> FileLike: - ... + def __enter__(self) -> FileLike: ... def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] - ) -> None: - ... + ) -> None: ... - def read(self, n: int = -1, /) -> bytes: - ... + def read(self, n: int = -1, /) -> bytes: ... - def flush(self) -> None: - ... + def flush(self) -> None: ... - def write(self, data: BinaryData) -> int: - ... + def write(self, data: BinaryData) -> int: ... - def close(self) -> None: - ... + def close(self) -> None: ... - def fileno(self) -> int: - ... + def fileno(self) -> int: ... - def tell(self) -> int: - ... + def tell(self) -> int: ... - def seek(self, offset: int, whence: int = 0, /) -> int: - ... + def seek(self, offset: int, whence: int = 0, /) -> int: ... class Compressor(Protocol): - def compress(self, data: bytes) -> bytes: - ... + def compress(self, data: bytes) -> bytes: ... - def flush(self) -> bytes: - ... + def flush(self) -> bytes: ... class Decompressor(Protocol): - def decompress(self, data: bytes) -> bytes: - ... + def decompress(self, data: bytes) -> bytes: ... diff --git a/rohmu/util.py b/rohmu/util.py index 8f2d4750..4f965afe 100644 --- a/rohmu/util.py +++ b/rohmu/util.py @@ -1,6 +1,7 @@ # Copyright (c) 2022 Ohmu Ltd # See LICENSE for details """Rohmu - common utility functions""" + from __future__ import annotations from io import BytesIO, UnsupportedOperation diff --git a/rohmu/zstdfile.py b/rohmu/zstdfile.py index 8999e181..2ea65148 100644 --- a/rohmu/zstdfile.py +++ b/rohmu/zstdfile.py @@ -1,6 +1,7 @@ # Copyright (c) 2016 Ohmu Ltd # See LICENSE for details """Rohmu - file-like interface for zstd""" + from .common.constants import IO_BLOCK_SIZE from .filewrap import FileWrap from .typing import BinaryData, FileLike diff --git a/test/common/test_statsd.py b/test/common/test_statsd.py index eeba9b21..eee6f1c6 100644 --- a/test/common/test_statsd.py +++ b/test/common/test_statsd.py @@ -4,6 +4,7 @@ This could be broader, but at least minimal functionality is tested here. """ + from __future__ import annotations from rohmu.common import statsd diff --git a/test/test_dates.py b/test/test_dates.py index d7d70f02..9d4af542 100644 --- a/test/test_dates.py +++ b/test/test_dates.py @@ -1,6 +1,7 @@ # Copyright (c) 2017 Ohmu Ltd # See LICENSE for details """Rohmu test case""" + from rohmu.dates import parse_timestamp import datetime