Skip to content

Commit

Permalink
Adding typing to parameters and return value
Browse files Browse the repository at this point in the history
Signed-off-by: gatici <[email protected]>
  • Loading branch information
gatici committed Jul 18, 2024
1 parent a830145 commit 12cb158
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions conf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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"]
Expand All @@ -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"]
Expand Down

0 comments on commit 12cb158

Please sign in to comment.