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

add typing to aiokafka/cluster.py #1024

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dimastbk
Copy link
Contributor

@dimastbk dimastbk commented Jul 2, 2024

Changes

Fixes #

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> (e.g. 588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the PR
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: Fix issue with non-ascii contents in doctest text files.

aiokafka/cluster.py Fixed Show fixed Hide fixed
return self._port

def send(self, request, expect_response=True):
@overload
def send(self, request: Request[ResponseT]) -> Coroutine[None, None, ResponseT]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
@overload
def send(
self, request: Request[ResponseT], expect_response: Literal[False]
) -> Coroutine[None, None, None]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
@overload
def _send_sasl_token(
self, payload: bytes, expect_response: Literal[False]
) -> Coroutine[None, None, None]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
@overload
def _send_sasl_token(
self, payload: bytes, expect_response: bool
) -> Union[Coroutine[None, None, None], Coroutine[None, None, bytes]]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
@overload
def _send_sasl_token(
self, payload: bytes, expect_response: Literal[True]
) -> Coroutine[None, None, bytes]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
self, payload: bytes, expect_response: Literal[True]
) -> Coroutine[None, None, bytes]: ...
@overload
def _send_sasl_token(self, payload: bytes) -> Coroutine[None, None, bytes]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
Comment on lines +41 to +42
if TYPE_CHECKING:
from aiokafka.client import CoordinationType
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about moving ConnectionGroup and CoordinationType to structs.py instead? Also, I see that they just namespace classes, so it's meaningless to use them in type declarations. Probably we need to make them enums?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, create aiokafka/enums.py for common enums.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants