From 0cea3711f9f591dad244d67ae4b92222de392b32 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Thu, 17 Oct 2024 16:56:46 +0100 Subject: [PATCH] split extensive into an helper function --- src/exabgp/reactor/api/command/neighbor.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/exabgp/reactor/api/command/neighbor.py b/src/exabgp/reactor/api/command/neighbor.py index 3a4e4685f..c61b645b0 100644 --- a/src/exabgp/reactor/api/command/neighbor.py +++ b/src/exabgp/reactor/api/command/neighbor.py @@ -129,11 +129,12 @@ def as_dict(cls, answer): return formated @classmethod - def extensive(cls, answer): + def formated_dict(cls, answer): if answer['duration']: duration = cls.extensive_kv % ('up for', timedelta(seconds=answer['duration']), '', '') else: duration = cls.extensive_kv % ('down for', timedelta(seconds=answer['down']), '', '') + formated = { 'peer-address': answer['peer-address'], 'local-address': cls.extensive_kv % ('local', answer['local-address'], '', ''), @@ -154,7 +155,11 @@ def extensive(cls, answer): ), } - return cls.extensive_template % formated + return formated + + @classmethod + def extensive(cls, answer): + return cls.extensive_template % cls.formated_dict(answer) @classmethod def summary(cls, answer):