From 12cb158a933adef9f3a3d903ed8a46fd240827f4 Mon Sep 17 00:00:00 2001 From: gatici Date: Thu, 18 Jul 2024 21:19:06 +0300 Subject: [PATCH] Adding typing to parameters and return value Signed-off-by: gatici --- conf/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/utils.py b/conf/utils.py index 2b7ae023f..4f336080b 100644 --- a/conf/utils.py +++ b/conf/utils.py @@ -63,7 +63,7 @@ def get_env(varname, default=None): exit(1, "Empty env var {}".format(varname)) -def ips_by_interface(name) -> list: +def ips_by_interface(name: str) -> list[str]: ndb = NDB() interfaces = ndb.interfaces if iface_record := interfaces.get(name): @@ -77,13 +77,13 @@ def atoh(ip): return socket.inet_aton(ip) -def alias_by_interface(name) -> Optional[str]: +def alias_by_interface(name: str) -> Optional[str]: ndb = NDB() if iface_record := ndb.interfaces.get(name): return iface_record["ifalias"] -def mac_by_interface(name) -> Optional[str]: +def mac_by_interface(name: str) -> Optional[str]: ndb = NDB() if iface_record := ndb.interfaces.get(name): return iface_record["address"] @@ -93,7 +93,7 @@ def mac2hex(mac): return int(mac.replace(":", ""), 16) -def peer_by_interface(name) -> str: +def peer_by_interface(name: str) -> str: ndb = NDB() try: peer_idx = ndb.interfaces[name]["link"]