diff --git a/.github/workflows/check_release_tag.py b/.github/workflows/check_release_tag.py index da36956..62d3db0 100644 --- a/.github/workflows/check_release_tag.py +++ b/.github/workflows/check_release_tag.py @@ -1,4 +1,5 @@ """Check that the GitHub release tag matches the package version.""" + import argparse import pathlib import re diff --git a/disk_objectstore/container.py b/disk_objectstore/container.py index 7ba394e..13043b8 100644 --- a/disk_objectstore/container.py +++ b/disk_objectstore/container.py @@ -1,6 +1,7 @@ """ The main implementation of the ``Container`` class of the object store. """ + # pylint: disable=too-many-lines import dataclasses import io @@ -176,14 +177,12 @@ def _get_config_file(self) -> Path: @overload def _get_session( self, create: bool = False, raise_if_missing: Literal[True] = True - ) -> Session: - ... + ) -> Session: ... @overload def _get_session( self, create: bool = False, raise_if_missing: Literal[False] = False - ) -> Optional[Session]: - ... + ) -> Optional[Session]: ... def _get_session( self, create: bool = False, raise_if_missing: bool = False @@ -521,8 +520,7 @@ def _get_objects_stream_meta_generator( hashkeys: Sequence[str], skip_if_missing: bool, with_streams: Literal[False], - ) -> Iterator[Tuple[str, ObjectMeta]]: - ... + ) -> Iterator[Tuple[str, ObjectMeta]]: ... @overload def _get_objects_stream_meta_generator( @@ -530,8 +528,7 @@ def _get_objects_stream_meta_generator( hashkeys: Sequence[str], skip_if_missing: bool, with_streams: Literal[True], - ) -> Iterator[Tuple[str, Optional[StreamSeekBytesType], ObjectMeta]]: - ... + ) -> Iterator[Tuple[str, Optional[StreamSeekBytesType], ObjectMeta]]: ... def _get_objects_stream_meta_generator( # pylint: disable=too-many-branches,too-many-statements,too-many-locals self, @@ -2653,9 +2650,9 @@ def repack_pack( # pylint: disable=too-many-branches,too-many-statements source_compressed, ) in session.execute(stmt): # This is the read handle of the bytes in the pack - it might be - read_handle: Union[ - PackedObjectReader, ZlibStreamDecompresser - ] = PackedObjectReader(read_pack, offset, length) + read_handle: Union[PackedObjectReader, ZlibStreamDecompresser] = ( + PackedObjectReader(read_pack, offset, length) + ) # Determine if I should compress or not the destination - this function will # try to do it in a cheap way (e.g. if the source is already compressed, will just diff --git a/disk_objectstore/database.py b/disk_objectstore/database.py index 08c9436..8e1a4c3 100644 --- a/disk_objectstore/database.py +++ b/disk_objectstore/database.py @@ -1,4 +1,5 @@ """Models for the container index file (SQLite DB).""" + from pathlib import Path from typing import Optional diff --git a/disk_objectstore/dataclasses.py b/disk_objectstore/dataclasses.py index 81abb35..1e06c81 100644 --- a/disk_objectstore/dataclasses.py +++ b/disk_objectstore/dataclasses.py @@ -2,6 +2,7 @@ Definition of the dataclasses used as return values of a number of methods. """ + from dataclasses import asdict, dataclass from typing import TYPE_CHECKING, List, Optional, Union diff --git a/disk_objectstore/utils.py b/disk_objectstore/utils.py index 26f7984..6b133d2 100644 --- a/disk_objectstore/utils.py +++ b/disk_objectstore/utils.py @@ -3,6 +3,7 @@ Some might be useful also for end users, like the wrappers to get streams, like the ``LazyOpener``. """ + # pylint: disable= too-many-lines from __future__ import annotations @@ -809,9 +810,9 @@ def __init__( self._decompressor = self.decompressobj_class() self._internal_buffer = b"" self._pos = 0 - self._lazy_uncompressed_stream: None | ( - LazyLooseStream - ) = lazy_uncompressed_stream + self._lazy_uncompressed_stream: None | (LazyLooseStream) = ( + lazy_uncompressed_stream + ) # If True, this class just proxies request to the underlying # uncompressed stream self._use_uncompressed_stream: bool = False @@ -1326,11 +1327,9 @@ def safe_flush_to_disk( fhandle.flush() # Default fsync function, replaced on Mac OS X - _fsync_function: Callable[ - [Any], Any - ] = lambda fileno: os.fsync( # pylint: disable=unnecessary-lambda + _fsync_function: Callable[[Any], Any] = lambda fileno: os.fsync( fileno - ) + ) # pylint: disable=unnecessary-lambda # Flush to disk if hasattr(fcntl, "F_FULLFSYNC") is not None and ( diff --git a/tests/conftest.py b/tests/conftest.py index 38d4e99..5185e24 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ """Configuration file for pytest tests.""" + import hashlib import os import random diff --git a/tests/test_basic.py b/tests/test_basic.py index 340e16d..10cfd37 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -2,6 +2,7 @@ This is also a way to verify the behavior of the underlying OS/filesystem. """ + import os import subprocess import sys diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py index a3fea86..2c6ba9f 100644 --- a/tests/test_benchmark.py +++ b/tests/test_benchmark.py @@ -1,4 +1,5 @@ """Test the performance of the container implementation.""" + import hashlib import random diff --git a/tests/test_cli.py b/tests/test_cli.py index 5b7e2b9..4dfea2f 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,4 +1,5 @@ """Test the CLI commands""" + import platform from pathlib import Path diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index 3d58f1d..e7ef781 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -1,4 +1,5 @@ """Test of the object-store container module.""" + import os import subprocess import sys diff --git a/tests/test_container.py b/tests/test_container.py index dae8841..af2b6ba 100644 --- a/tests/test_container.py +++ b/tests/test_container.py @@ -1,4 +1,5 @@ """Test of the object-store container module.""" + # pylint: disable=too-many-lines,protected-access import dataclasses import functools diff --git a/tests/test_examples.py b/tests/test_examples.py index 65b2e53..6f6d8ea 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -1,4 +1,5 @@ """Test of the object-store container module.""" + import subprocess import sys import tempfile diff --git a/tests/test_optional.py b/tests/test_optional.py index 3a222b1..b2a2296 100644 --- a/tests/test_optional.py +++ b/tests/test_optional.py @@ -1,5 +1,6 @@ """Additional optional tests to check additional functionality, such as if the library works also with other external optional modules.""" + from pathlib import Path import numpy as np diff --git a/tests/test_utils.py b/tests/test_utils.py index 812748b..ead9716 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,5 @@ """Test of the utils wrappers.""" + # pylint: disable=too-many-lines,protected-access import functools import hashlib