From e271b0e2336ed89a7ca814bb73110d8662405b4a Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sun, 9 Jun 2024 14:38:39 +0100 Subject: [PATCH] run black --- src/exabgp/bgp/message/update/nlri/mup/dsd.py | 6 +----- src/exabgp/bgp/message/update/nlri/mup/isd.py | 2 +- src/exabgp/bgp/message/update/nlri/mup/t1st.py | 2 +- src/exabgp/bgp/message/update/nlri/mup/t2st.py | 4 ++-- src/exabgp/configuration/static/mpls.py | 4 ++-- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/exabgp/bgp/message/update/nlri/mup/dsd.py b/src/exabgp/bgp/message/update/nlri/mup/dsd.py index b8ed01f65..01c0e6a63 100644 --- a/src/exabgp/bgp/message/update/nlri/mup/dsd.py +++ b/src/exabgp/bgp/message/update/nlri/mup/dsd.py @@ -38,11 +38,7 @@ def index(self): return MUP.index(self) def __eq__(self, other): - return ( - isinstance(other, DirectSegmentDiscoveryRoute) - and self.rd == other.rd - and self.ip == other.ip - ) + return isinstance(other, DirectSegmentDiscoveryRoute) and self.rd == other.rd and self.ip == other.ip def __ne__(self, other): return not self.__eq__(other) diff --git a/src/exabgp/bgp/message/update/nlri/mup/isd.py b/src/exabgp/bgp/message/update/nlri/mup/isd.py index 01b908668..7b1924c0e 100644 --- a/src/exabgp/bgp/message/update/nlri/mup/isd.py +++ b/src/exabgp/bgp/message/update/nlri/mup/isd.py @@ -99,6 +99,6 @@ def json(self, compact=None): content += '"code": %d, ' % self.CODE content += '"prefix_ip_len": %d, ' % self.prefix_ip_len content += '"prefix_ip": "%s", ' % str(self.prefix_ip) - content += self.rd.json() + content += self.rd.json() content += ', "raw": "%s"' % self._raw() return '{ %s }' % content diff --git a/src/exabgp/bgp/message/update/nlri/mup/t1st.py b/src/exabgp/bgp/message/update/nlri/mup/t1st.py index 06f927f31..79f3d776f 100644 --- a/src/exabgp/bgp/message/update/nlri/mup/t1st.py +++ b/src/exabgp/bgp/message/update/nlri/mup/t1st.py @@ -220,7 +220,7 @@ def json(self, compact=None): content += '"prefix_ip": "%s", ' % str(self.prefix_ip) content += '"teid": "%s", ' % str(self.teid) content += '"qfi": "%s", ' % str(self.qfi) - content += self.rd.json() + ', ' + content += self.rd.json() + ', ' content += '"endpoint_ip_len": %d, ' % self.endpoint_ip_len content += '"endpoint_ip": "%s"' % str(self.endpoint_ip) content += '"source_ip_len": %d, ' % self.source_ip_len diff --git a/src/exabgp/bgp/message/update/nlri/mup/t2st.py b/src/exabgp/bgp/message/update/nlri/mup/t2st.py index 631bcc4bf..4c8014ef0 100644 --- a/src/exabgp/bgp/message/update/nlri/mup/t2st.py +++ b/src/exabgp/bgp/message/update/nlri/mup/t2st.py @@ -100,7 +100,7 @@ def _pack(self, packed=None): teid_size = self.endpoint_len - endpoint_size if teid_size < 0 or teid_size > 32: - raise Exception("teid is too large %d (range 0~32)" % teid_size) + raise Exception("teid is too large %d (range 0~32)" % teid_size) teid_packed = pack('!I', self.teid) @@ -123,7 +123,7 @@ def unpack(cls, data, afi): rd = RouteDistinguisher.unpack(data[:8]) endpoint_len = data[8] end = 9 + afi_bytes_size - endpoint_ip = IP.unpack(data[9 : end]) + endpoint_ip = IP.unpack(data[9:end]) teid = 0 if endpoint_len > afi_bit_size: diff --git a/src/exabgp/configuration/static/mpls.py b/src/exabgp/configuration/static/mpls.py index 21c1831cb..18ff2592d 100644 --- a/src/exabgp/configuration/static/mpls.py +++ b/src/exabgp/configuration/static/mpls.py @@ -237,7 +237,7 @@ def srv6_mup_dsd(tokeniser, afi): ip = IPv6.unpack(IPv6.pton(tokeniser())) else: raise Exception("unexpect afi: %s" % afi) - + value = tokeniser() if value != "rd": raise Exception("expect rd, but received '%s'" % value) @@ -333,7 +333,7 @@ def srv6_mup_t2st(tokeniser, afi): if not (0 <= teid_len <= 32): raise Exception("unexpect teid format, this expect format /") - if teid >= pow(2,teid_len): + if teid >= pow(2, teid_len): raise Exception(f"unexpect teid format, we can not store {teid} using {teid_len} bits") return Type2SessionTransformedRoute(