diff --git a/swh/storage/interface.py b/swh/storage/interface.py --- a/swh/storage/interface.py +++ b/swh/storage/interface.py @@ -5,17 +5,7 @@ import datetime from enum import Enum -from typing import ( - TYPE_CHECKING, - Any, - Dict, - Iterable, - List, - Optional, - Sequence, - Tuple, - TypeVar, -) +from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, TypeVar import attr from typing_extensions import Protocol, TypedDict, runtime_checkable @@ -44,9 +34,6 @@ ) from swh.model.swhids import ExtendedSWHID, ObjectType -if TYPE_CHECKING: - from swh.storage.writer import JournalWriter - class ListOrder(Enum): """Specifies the order for paginated endpoints returning sorted results.""" @@ -89,8 +76,6 @@ @runtime_checkable class StorageInterface(Protocol): - journal_writer: Optional["JournalWriter"] - @remote_api_endpoint("check_config") def check_config(self, *, check_write: bool) -> bool: """Check that the storage is configured and ready to go.""" diff --git a/swh/storage/tests/test_backfill.py b/swh/storage/tests/test_backfill.py --- a/swh/storage/tests/test_backfill.py +++ b/swh/storage/tests/test_backfill.py @@ -243,8 +243,7 @@ for object_type, objects in TEST_OBJECTS.items(): method = getattr(storage, object_type + "_add") method(objects) - assert storage.journal_writer is not None - storage.journal_writer.journal.flush() + storage.journal_writer.journal.flush() # type: ignore[attr-defined] # now apply the backfiller on the storage to fill the journal under prefix2 backfiller_config = { diff --git a/swh/storage/tests/test_kafka_writer.py b/swh/storage/tests/test_kafka_writer.py --- a/swh/storage/tests/test_kafka_writer.py +++ b/swh/storage/tests/test_kafka_writer.py @@ -59,8 +59,7 @@ expected_messages += len(objs) else: assert False, obj_type - assert storage.journal_writer is not None - storage.journal_writer.journal.flush() + storage.journal_writer.journal.flush() # type: ignore[attr-defined] existing_topics = set( topic @@ -121,8 +120,7 @@ method = getattr(storage, obj_type + "_add") method(objs) expected_messages += len(objs) - assert storage.journal_writer is not None - storage.journal_writer.journal.flush() + storage.journal_writer.journal.flush() # type: ignore[attr-defined] existing_topics = set( topic diff --git a/swh/storage/tests/test_replay.py b/swh/storage/tests/test_replay.py --- a/swh/storage/tests/test_replay.py +++ b/swh/storage/tests/test_replay.py @@ -359,8 +359,7 @@ method = getattr(storage, obj_type + "_add") method(objs) nb_sent += len(objs) - assert storage.journal_writer is not None - storage.journal_writer.journal.flush() + storage.journal_writer.journal.flush() # type: ignore[attr-defined] # Fill a destination storage from Kafka, potentially using privileged topics dst_storage = get_storage(cls="memory")