Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use abstract classes for base classes in protocol package #459

Open
PerchunPak opened this issue Jan 8, 2023 · 0 comments
Open

Use abstract classes for base classes in protocol package #459

PerchunPak opened this issue Jan 8, 2023 · 0 comments
Labels
area: API Related to core API of the project type: enhancement Improvement to an existing feature

Comments

@PerchunPak
Copy link
Member

class BaseConnection:
"""Base Connection class. Implements flush, receive, and remaining."""
__slots__ = ()
def __repr__(self) -> str:
"""Return representation of self."""
return f"<{self.__class__.__name__} Object>"
def flush(self) -> bytearray:
"""Raise TypeError, unsupported."""
raise TypeError(f"{self.__class__.__name__} does not support flush()")
def receive(self, data: BytesConvertable | bytearray) -> None:
"""Raise TypeError, unsupported."""
raise TypeError(f"{self.__class__.__name__} does not support receive()")
def remaining(self) -> int:
"""Raise TypeError, unsupported."""
raise TypeError(f"{self.__class__.__name__} does not support remaining()")

This class only adds methods, that just raise exception. We should use abstract class here.

@kevinkjt2000 kevinkjt2000 added type: enhancement Improvement to an existing feature area: API Related to core API of the project labels Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Related to core API of the project type: enhancement Improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants