Skip to content

Commit

Permalink
Fix typing bugs found by beartype (#993)
Browse files Browse the repository at this point in the history
  • Loading branch information
ods authored Mar 24, 2024
1 parent 256ce17 commit e43a738
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions aiokafka/admin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
from collections import defaultdict
from ssl import SSLContext
from typing import Any, Dict, List, Optional, Tuple, Union
from typing import Any, Dict, List, Optional, Sequence, Tuple, Type, Union

from aiokafka import __version__
from aiokafka.client import AIOKafkaClient
Expand Down Expand Up @@ -156,7 +156,7 @@ async def start(self):
log.debug("AIOKafkaAdminClient started")
self._started = True

def _matching_api_version(self, operation: List[Request]) -> int:
def _matching_api_version(self, operation: Sequence[Type[Request]]) -> int:
"""Find the latest version of the protocol operation
supported by both this library and the broker.
Expand Down Expand Up @@ -332,7 +332,9 @@ async def describe_configs(
futures.append(self._send_request(req))
return await asyncio.gather(*futures)

async def alter_configs(self, config_resources: List[ConfigResource]) -> Response:
async def alter_configs(
self, config_resources: List[ConfigResource]
) -> List[Response]:
"""Alter configuration parameters of one or more Kafka resources.
:param config_resources: A list of ConfigResource objects.
:return: Appropriate version of AlterConfigsResponse class.
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ select = [
"PL", # Pylint
"TRY", # tryceratops
"PERF", # Perflint
"LOG", # flake8-logging
# "LOG", # flake8-logging
"RUF", # Ruff-specific
]

Expand Down Expand Up @@ -168,3 +168,4 @@ strict_equality = true
warn_redundant_casts = true
warn_unused_ignores = true
follow_imports = "silent" # FIXME Remove after adding annotations
local_partial_types = true # TODO Remove when it becomes default
4 changes: 2 additions & 2 deletions requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r requirements-cython.txt
ruff==0.3.2
mypy==1.8.0
ruff==0.3.4
mypy==1.9.0
pytest==7.4.3
pytest-cov==4.1.0
pytest-asyncio==0.21.1
Expand Down
2 changes: 1 addition & 1 deletion requirements-win-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r requirements-cython.txt
ruff==0.3.2
mypy==1.8.0
mypy==1.9.0
pytest==7.4.3
pytest-cov==4.1.0
pytest-asyncio==0.21.1
Expand Down

0 comments on commit e43a738

Please sign in to comment.