From 5d272d2a5509d28eeec3e292e326d65e0b0a2694 Mon Sep 17 00:00:00 2001 From: Salomon Popp Date: Wed, 24 Jul 2024 09:54:34 +0200 Subject: [PATCH] Improve incomplete type hints --- kpops/component_handlers/topic/handler.py | 2 +- kpops/component_handlers/topic/proxy_wrapper.py | 4 ++-- kpops/component_handlers/topic/utils.py | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/kpops/component_handlers/topic/handler.py b/kpops/component_handlers/topic/handler.py index 47d7c3367..b798c446c 100644 --- a/kpops/component_handlers/topic/handler.py +++ b/kpops/component_handlers/topic/handler.py @@ -119,7 +119,7 @@ async def __execute_topic_creation( ) if differences: - json_body = [] + json_body: list[dict[str, str]] = [] for difference in differences: if difference.diff_type is DiffType.REMOVE: json_body.append( diff --git a/kpops/component_handlers/topic/proxy_wrapper.py b/kpops/component_handlers/topic/proxy_wrapper.py index 334523651..4cb003caa 100644 --- a/kpops/component_handlers/topic/proxy_wrapper.py +++ b/kpops/component_handlers/topic/proxy_wrapper.py @@ -2,7 +2,7 @@ import logging from functools import cached_property -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Any import httpx @@ -163,7 +163,7 @@ async def get_topic_config(self, topic_name: str) -> TopicConfigResponse: raise KafkaRestProxyError(response) async def batch_alter_topic_config( - self, topic_name: str, json_body: list[dict] + self, topic_name: str, json_body: list[dict[str, Any]] ) -> None: """Reset config of given config_name param to the default value on the Kafka server. diff --git a/kpops/component_handlers/topic/utils.py b/kpops/component_handlers/topic/utils.py index f5b096953..ff0a2ad27 100644 --- a/kpops/component_handlers/topic/utils.py +++ b/kpops/component_handlers/topic/utils.py @@ -1,3 +1,5 @@ +from typing import Any + from kpops.component_handlers.topic.model import ( BrokerConfigResponse, KafkaTopicConfigSource, @@ -6,8 +8,8 @@ def parse_and_compare_topic_configs( - topic_config_in_cluster: TopicConfigResponse, topic_config: dict[str, str] -) -> tuple[dict[str, str], dict[str, str]]: + topic_config_in_cluster: TopicConfigResponse, topic_config: dict[str, Any] +) -> tuple[dict[str, str], dict[str, Any]]: comparable_in_cluster_config_dict, default_configs = parse_rest_proxy_topic_config( topic_config_in_cluster )