From 1f1ed62a6dd1916e708c874b002ffc4677ca2310 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Tue, 17 Nov 2020 10:09:26 +0100 Subject: [PATCH] FRR: carp_event_handler annotate function parameters (2) --- net/frr/src/opnsense/scripts/frr/lib/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/frr/src/opnsense/scripts/frr/lib/__init__.py b/net/frr/src/opnsense/scripts/frr/lib/__init__.py index bada445ec..21ef2ce23 100644 --- a/net/frr/src/opnsense/scripts/frr/lib/__init__.py +++ b/net/frr/src/opnsense/scripts/frr/lib/__init__.py @@ -27,6 +27,8 @@ import time import subprocess import ujson +from collections.abc import Callable + class InterfaceStatus: def __init__(self): @@ -54,7 +56,7 @@ class InterfaceStatus: self._carp_addresses = carp_addresses - def address_status(self, address): + def address_status(self, address: str): if address in self._carp_addresses: return self._carp_addresses[address]['status'] return 'none' @@ -77,14 +79,14 @@ class VtySH: except VtySHExecError: time.sleep(1) - def is_running(self, daemon): + def is_running(self, daemon: str): return daemon in self._daemons @property def is_active(self): return len(self._daemons) > 0 - def execute(self, command, translate=ujson.loads, configure=False): + def execute(self, command: str, translate: Callable=ujson.loads, configure: bool=False): args = ['/usr/local/bin/vtysh'] if configure: args = args + ['-c', 'configure terminal']