mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
zulip-ec2-configure-interfaces: Convert function type annotations.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
f8339f019d
commit
5e01a0ae8b
@@ -53,15 +53,13 @@ import netifaces
|
||||
|
||||
from typing import Optional
|
||||
|
||||
def address_of(device_id):
|
||||
# type: (int) -> Optional[str]
|
||||
def address_of(device_id: int) -> Optional[str]:
|
||||
try:
|
||||
return netifaces.ifaddresses("ens%i" % (device_id,))[netifaces.AF_INET][0]['addr']
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
def guess_gateway(device_id):
|
||||
# type: (int) -> Optional[str]
|
||||
def guess_gateway(device_id: int) -> Optional[str]:
|
||||
# This will not work if the default gateway isn't n.n.n.1.
|
||||
address = address_of(device_id)
|
||||
if address is None:
|
||||
|
||||
Reference in New Issue
Block a user