Skip to content

Commit

Permalink
mypy errors fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
nforsg committed Aug 17, 2023
1 parent 692f550 commit e5574a1
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, Any
from typing import Dict, Any, Union
from csle_base.json_serializable import JSONSerializable


Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, Any
from typing import Dict, Any, Union
from csle_base.json_serializable import JSONSerializable


Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, Any
from typing import Dict, Any, Union
from csle_base.json_serializable import JSONSerializable


Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e5574a1

Please sign in to comment.