-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add typing to aiokafka/protocol/* (#999)
* add typing to aiokafka/protocol/* * fix review * fix VarInt64 * fix review tuple -> list * fix review * fix review * move ALL_TOPICS/NO_TOPICS to docs * remove default values from Message() * fix checking abstractproperty in test * fix review * fix review (from docstrings to comments) * fix: collections.abc.Sequence -> typing.Sequence * fix review: Message * add FIXME * fix review: Message * use NotImplemented instead of False
- Loading branch information
Showing
11 changed files
with
415 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
import abc | ||
from io import BytesIO | ||
from typing import Generic, TypeVar | ||
|
||
T = TypeVar("T") | ||
|
||
class AbstractType(metaclass=abc.ABCMeta): | ||
|
||
class AbstractType(Generic[T], metaclass=abc.ABCMeta): | ||
@classmethod | ||
@abc.abstractmethod | ||
def encode(cls, value): ... | ||
def encode(cls, value: T) -> bytes: ... | ||
|
||
@classmethod | ||
@abc.abstractmethod | ||
def decode(cls, data): ... | ||
def decode(cls, data: BytesIO) -> T: ... | ||
|
||
@classmethod | ||
def repr(cls, value): | ||
def repr(cls, value: T) -> str: | ||
return repr(value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.