From e5574a18b3c7415ea237535d3ebd7ea5cb112df7 Mon Sep 17 00:00:00 2001 From: nforsg Date: Thu, 17 Aug 2023 14:20:40 +0200 Subject: [PATCH] mypy errors fixed --- .../src/csle_common/dao/emulation_action_result/nmap_hop.py | 2 +- .../src/csle_common/dao/emulation_action_result/nmap_os.py | 6 +++--- .../dao/emulation_config/client_managers_info.py | 2 +- .../src/csle_common/dao/emulation_config/cluster_node.py | 6 +++--- .../dao/emulation_config/docker_stats_managers_info.py | 2 +- .../csle_common/dao/emulation_config/elk_managers_info.py | 2 +- .../src/csle_common/dao/emulation_config/flag.py | 6 +++--- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_action_result/nmap_hop.py b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_action_result/nmap_hop.py index 00c726f6a..b5720d1f3 100644 --- a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_action_result/nmap_hop.py +++ b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_action_result/nmap_hop.py @@ -38,7 +38,7 @@ def to_dict(self) -> Dict[str, Any]: :return: a dict representation of the object """ - d = {} + d: Dict[str, Any] = {} d["ttl"] = self.ttl d["ipaddr"] = self.ipaddr d["rtt"] = self.rtt diff --git a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_action_result/nmap_os.py b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_action_result/nmap_os.py index f936075dc..16f5f876f 100644 --- a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_action_result/nmap_os.py +++ b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_action_result/nmap_os.py @@ -1,4 +1,4 @@ -from typing import Dict, Any +from typing import Dict, Any, Union from csle_base.json_serializable import JSONSerializable @@ -42,13 +42,13 @@ def get_best_match(os_matches): best_os = os return best_os - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> Dict[str, Union[str, int]]: """ Converts the object to a dict representation :return: a dict representation of the object """ - d = {} + d: Dict[str, Union[str, int]] = {} d["name"] = self.name d["vendor"] = self.vendor d["osfamily"] = self.osfamily diff --git a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/client_managers_info.py b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/client_managers_info.py index 89f634fc5..5248f9aa1 100644 --- a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/client_managers_info.py +++ b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/client_managers_info.py @@ -48,7 +48,7 @@ def to_dict(self) -> Dict[str, Any]: :return: a dict representation of the object """ - d = {} + d: Dict[str, Any] = {} d["client_managers_running"] = self.client_managers_running d["ips"] = self.ips d["ports"] = self.ports diff --git a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/cluster_node.py b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/cluster_node.py index dd23f5f58..9b780bf05 100644 --- a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/cluster_node.py +++ b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/cluster_node.py @@ -1,4 +1,4 @@ -from typing import Dict, Any +from typing import Dict, Any, Union from csle_base.json_serializable import JSONSerializable @@ -23,13 +23,13 @@ def __init__(self, ip: str, leader: bool, cpus: int, gpus: int, RAM: int): self.gpus = gpus self.RAM = RAM - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> Dict[str, Union[str, bool, int]]: """ Converts the object to a dict representation :return: a dict representation of the object """ - d = {} + d: Dict[str, Union[str, bool, int]] = {} d["ip"] = self.ip d["leader"] = self.leader d["cpus"] = self.cpus diff --git a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/docker_stats_managers_info.py b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/docker_stats_managers_info.py index 03b1e114e..4e195ee61 100644 --- a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/docker_stats_managers_info.py +++ b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/docker_stats_managers_info.py @@ -50,7 +50,7 @@ def to_dict(self) -> Dict[str, Any]: :return: a dict representation of the object """ - d = {} + d: Dict[str, Any] = {} d["docker_stats_managers_running"] = self.docker_stats_managers_running d["ips"] = self.ips d["emulation_name"] = self.emulation_name diff --git a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/elk_managers_info.py b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/elk_managers_info.py index 11dd38159..cf68765e8 100644 --- a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/elk_managers_info.py +++ b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/elk_managers_info.py @@ -53,7 +53,7 @@ def to_dict(self) -> Dict[str, Any]: :return: a dict representation of the object """ - d = {} + d: Dict[str, Any] = {} d["elk_managers_running"] = self.elk_managers_running d["ips"] = self.ips d["ports"] = self.ports diff --git a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/flag.py b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/flag.py index 56930abe3..85182fcb4 100644 --- a/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/flag.py +++ b/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/flag.py @@ -1,4 +1,4 @@ -from typing import Dict, Any +from typing import Dict, Any, Union from csle_base.json_serializable import JSONSerializable @@ -47,13 +47,13 @@ def from_dict(d: Dict[str, Any]) -> "Flag": ) return obj - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> Dict[str, Union[str, int, bool]]: """ Converts the object to a dict representation :return: a dict representation of the object """ - d = {} + d: Dict[str, Union[str, int, bool]] = {} d["name"] = self.name d["dir"] = self.dir d["id"] = self.id