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 6, 2024
1 parent 7efbbf5 commit 82891aa
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 22 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ exabgp-cli = 'exabgp.application.cli:main'
exabgp-healthcheck = 'exabgp.application.healthcheck:main'

[tool.black]
optional = true
line-length = 120
target-version = ['py36', 'py37', 'py38']
target-version = ['py36', 'py37', 'py38', 'py39', 'py310', 'py311', 'py312', 'py313']
skip_string_normalization = '1'
include = '\.pyi?$'
exclude = '''
Expand Down
2 changes: 1 addition & 1 deletion src/exabgp/application/tojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def process(self):
run,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
preexec_fn=preexec_helper
preexec_fn=preexec_helper,
# This flags exists for python 2.7.3 in the documentation but on on my MAC
# creationflags=subprocess.CREATE_NEW_PROCESS_GROUP
)
Expand Down
22 changes: 12 additions & 10 deletions src/exabgp/bgp/message/update/attribute/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,18 @@ def pack(self, negotiated, with_default=True):

default = {
Attribute.CODE.ORIGIN: lambda left, right: Origin(Origin.IGP),
Attribute.CODE.AS_PATH: lambda left, right: ASPath([])
if left == right
else ASPath(
[
SEQUENCE(
[
local_asn,
]
),
],
Attribute.CODE.AS_PATH: lambda left, right: (
ASPath([])
if left == right
else ASPath(
[
SEQUENCE(
[
local_asn,
]
),
],
)
),
Attribute.CODE.LOCAL_PREF: lambda left, right: LocalPreference(100) if left == right else NOTHING,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,11 @@ def __init__(self, ip, asn, community=None):
self.asn = asn
ExtendedCommunityIPv6.__init__(
self,
community
if community is not None
else pack("!BB16sH", 0x00, 0x02, socket.inet_pton(socket.AF_INET6, ip), asn),
(
community
if community is not None
else pack("!BB16sH", 0x00, 0x02, socket.inet_pton(socket.AF_INET6, ip), asn)
),
)

def __str__(self):
Expand Down
3 changes: 2 additions & 1 deletion src/exabgp/configuration/neighbor/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def local_address(tokeniser):
except (IndexError, ValueError, socket.error):
raise ValueError('"%s" is an invalid IP address' % value)


def source_interface(tokeniser):
try:
return string(tokeniser)
Expand Down Expand Up @@ -181,4 +182,4 @@ def rate_limit(tokeniser):
raise ValueError('"%s" is an invalid rate-limit' % value)
if rate <= 0:
raise ValueError('rate must be zero or at 1 (per second)')
return rate
return rate
2 changes: 1 addition & 1 deletion src/exabgp/reactor/api/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def _start(self, process):
run,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
preexec_fn=preexec_helper
preexec_fn=preexec_helper,
# This flags exists for python 2.7.3 in the documentation but on on my MAC
# creationflags=subprocess.CREATE_NEW_PROCESS_GROUP
)
Expand Down
2 changes: 1 addition & 1 deletion src/exabgp/reactor/network/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def create(afi, interface=None):

if interface is not None:
try:
if not hasattr(socket,'SO_BINDTODEVICE') :
if not hasattr(socket, 'SO_BINDTODEVICE'):
socket.SO_BINDTODEVICE = 25

io.setsockopt(socket.SOL_SOCKET, socket.SO_BINDTODEVICE, str(interface + '\0').encode("utf-8"))
Expand Down
4 changes: 1 addition & 3 deletions src/exabgp/reactor/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,7 @@ def _connect(self):
except Stop:
# Connection failed
if not connected and self.proto:
self._close(
'connection to %s:%d failed' % (self.neighbor['peer-address'], self.neighbor['connect'])
)
self._close('connection to %s:%d failed' % (self.neighbor['peer-address'], self.neighbor['connect']))

# A connection arrived before we could establish !
if not connected or self.proto:
Expand Down
1 change: 1 addition & 0 deletions src/exabgp/vendoring/objgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Released under the MIT licence.
"""

# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
Expand Down

0 comments on commit 82891aa

Please sign in to comment.