Skip to content

Commit

Permalink
test w/o protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy Starodubov committed Apr 24, 2024
1 parent 66b43bf commit c37c057
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 360 deletions.
21 changes: 5 additions & 16 deletions aiokafka/record/_crecords/default_records.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
from typing import ClassVar, final
from typing import ClassVar

from typing_extensions import Literal, Self

from aiokafka.record._protocols import (
DefaultRecordBatchBuilderProtocol,
DefaultRecordBatchProtocol,
DefaultRecordMetadataProtocol,
DefaultRecordProtocol,
)

@final
class DefaultRecord(DefaultRecordProtocol):
class DefaultRecord:
offset: int
key: bytes | None
value: bytes | None
Expand All @@ -31,8 +23,7 @@ class DefaultRecord(DefaultRecordProtocol):
@property
def timestamp_type(self) -> int | None: ...

@final
class DefaultRecordBatch(DefaultRecordBatchProtocol):
class DefaultRecordBatch:
CODEC_NONE: ClassVar[int]
CODEC_MASK: ClassVar[int]
CODEC_GZIP: ClassVar[int]
Expand Down Expand Up @@ -67,8 +58,7 @@ class DefaultRecordBatch(DefaultRecordBatchProtocol):
def __next__(self) -> DefaultRecord: ...
def validate_crc(self) -> bool: ...

@final
class DefaultRecordBatchBuilder(DefaultRecordBatchBuilderProtocol):
class DefaultRecordBatchBuilder:
producer_id: int
producer_epoch: int
base_sequence: int
Expand Down Expand Up @@ -118,8 +108,7 @@ class DefaultRecordBatchBuilder(DefaultRecordBatchBuilderProtocol):
headers: list[tuple[str, bytes | None]],
) -> int: ...

@final
class DefaultRecordMetadata(DefaultRecordMetadataProtocol):
class DefaultRecordMetadata:
offset: int
size: int
timestamp: int
Expand Down
21 changes: 5 additions & 16 deletions aiokafka/record/_crecords/legacy_records.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
from typing import Any, ClassVar, Generator, final
from typing import Any, ClassVar, Generator

from typing_extensions import Buffer, Literal, Never

from aiokafka.record._protocols import (
LegacyRecordBatchBuilderProtocol,
LegacyRecordBatchProtocol,
LegacyRecordMetadataProtocol,
LegacyRecordProtocol,
)

@final
class LegacyRecord(LegacyRecordProtocol):
class LegacyRecord:
offset: int
attributes: int
key: bytes | None
Expand All @@ -34,8 +26,7 @@ class LegacyRecord(LegacyRecordProtocol):
@property
def checksum(self) -> int: ...

@final
class LegacyRecordBatch(LegacyRecordBatchProtocol):
class LegacyRecordBatch:
RECORD_OVERHEAD_V0: ClassVar[int]
RECORD_OVERHEAD_V1: ClassVar[int]
CODEC_MASK: ClassVar[int]
Expand All @@ -52,8 +43,7 @@ class LegacyRecordBatch(LegacyRecordBatchProtocol):
def validate_crc(self) -> bool: ...
def __iter__(self) -> Generator[LegacyRecord, None, None]: ...

@final
class LegacyRecordBatchBuilder(LegacyRecordBatchBuilderProtocol):
class LegacyRecordBatchBuilder:
CODEC_MASK: ClassVar[int]
CODEC_GZIP: ClassVar[int]
CODEC_SNAPPY: ClassVar[int]
Expand All @@ -76,8 +66,7 @@ class LegacyRecordBatchBuilder(LegacyRecordBatchBuilderProtocol):
def record_overhead(magic: int) -> int: ...
def build(self) -> bytearray: ...

@final
class LegacyRecordMetadata(LegacyRecordMetadataProtocol):
class LegacyRecordMetadata:
offset: int
crc: int
size: int
Expand Down
7 changes: 1 addition & 6 deletions aiokafka/record/_crecords/memory_records.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
from typing import final

from aiokafka.record._protocols import MemoryRecordsProtocol

from .default_records import DefaultRecordBatch
from .legacy_records import LegacyRecordBatch

@final
class MemoryRecords(MemoryRecordsProtocol):
class MemoryRecords:
def __init__(self, bytes_data: bytes) -> None: ...
def size_in_bytes(self) -> int: ...
def has_next(self) -> bool: ...
Expand Down
262 changes: 0 additions & 262 deletions aiokafka/record/_protocols.py

This file was deleted.

Loading

0 comments on commit c37c057

Please sign in to comment.