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
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ KAFKA_VERSION?=2.8.1
DOCKER_IMAGE=aiolibs/kafka:$(SCALA_VERSION)_$(KAFKA_VERSION)
DIFF_BRANCH=origin/master
FORMATTED_AREAS=\
aiokafka/cluster.py \
aiokafka/codec.py \
aiokafka/conn.py \
aiokafka/coordinator/ \
aiokafka/errors.py \
aiokafka/helpers.py \
aiokafka/structs.py \
aiokafka/util.py \
aiokafka/protocol/ \
aiokafka/record/ \
tests/test_cluster.py \
tests/test_codec.py \
tests/test_conn.py \
tests/test_helpers.py \
tests/test_protocol.py \
tests/test_protocol_object_conversion.py \
Expand Down
5 changes: 3 additions & 2 deletions aiokafka/abc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import abc
from typing import Dict


class ConsumerRebalanceListener(abc.ABC):
Expand Down Expand Up @@ -103,7 +104,7 @@ class AbstractTokenProvider(abc.ABC):
"""

@abc.abstractmethod
async def token(self):
async def token(self) -> str:
"""
An async callback returning a :class:`str` ID/Access Token to be sent to
the Kafka client. In case where a synchronous callback is needed,
Expand All @@ -122,7 +123,7 @@ def _token(self):
# The actual synchronous token callback.
"""

def extensions(self):
def extensions(self) -> Dict[str, str]:
"""
This is an OPTIONAL method that may be implemented.

Expand Down
3 changes: 2 additions & 1 deletion aiokafka/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import contextlib
import enum
import logging
import random
import time
Expand Down Expand Up @@ -45,7 +46,7 @@ class ConnectionGroup:
COORDINATION = 1


class CoordinationType:
class CoordinationType(enum.IntEnum):
GROUP = 0
TRANSACTION = 1

Expand Down
Loading
Loading