Skip to content

Commit

Permalink
run black
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-mangin committed Jun 9, 2024
1 parent 74c6353 commit e271b0e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/exabgp/bgp/message/update/nlri/mup/dsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/exabgp/bgp/message/update/nlri/mup/isd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/exabgp/bgp/message/update/nlri/mup/t1st.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/exabgp/bgp/message/update/nlri/mup/t2st.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/exabgp/configuration/static/mpls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -333,7 +333,7 @@ def srv6_mup_t2st(tokeniser, afi):
if not (0 <= teid_len <= 32):
raise Exception("unexpect teid format, this expect format <teid>/<length, expect 0 ~ 32>")

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(
Expand Down

0 comments on commit e271b0e

Please sign in to comment.