Skip to content

Commit

Permalink
Apply black code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sjlongland committed May 8, 2024
1 parent 1de9e4a commit 4f25ce9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion aioax25/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ def _update_state(self, prop, delta=None, value=None, comment=""):
comment += " delta=%s" % delta

# Always apply modulo op (assume 8 if not set)
value %= (self._modulo or 8)
value %= self._modulo or 8

self._log.debug(
"%s = %s" + comment, getattr(self, "%s_name" % prop), value
Expand Down
32 changes: 23 additions & 9 deletions aioax25/tools/listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ def __init__(self, peer, command, echo, log):
async def init(self):
self._log.info("Launching sub-process")
await asyncio.get_event_loop().subprocess_exec(
self._make_protocol, *self._command,
self._make_protocol,
*self._command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, bufsize=0
stderr=subprocess.STDOUT,
bufsize=0
)

def _make_protocol(self):
Expand Down Expand Up @@ -209,7 +211,12 @@ def _on_connection_request(self, peer, **kwargs):
async def _connect_peer(self, peer):
self._log.info("Incoming connection from %s", peer.address)
try:
session = PeerSession(peer, self._command, self._echo, self._log.getChild(str(peer.address)))
session = PeerSession(
peer,
self._command,
self._echo,
self._log.getChild(str(peer.address)),
)
await session.init()
except:
self._log.exception("Failed to initialise peer connection")
Expand All @@ -225,14 +232,20 @@ async def main():

ap.add_argument("--log-level", default="info", type=str, help="Log level")
ap.add_argument("--port", default=0, type=int, help="KISS port number")
ap.add_argument("--echo", default=False, action="store_const", const=True,
help="Echo input back to the caller")
ap.add_argument(
"--echo",
default=False,
action="store_const",
const=True,
help="Echo input back to the caller",
)
ap.add_argument(
"config", type=str, help="KISS serial port configuration file"
)
ap.add_argument("source", type=str, help="Source callsign/SSID")
ap.add_argument("command", type=str, nargs="+",
help="Program + args to run")
ap.add_argument(
"command", type=str, nargs="+", help="Program + args to run"
)

args = ap.parse_args()

Expand All @@ -245,8 +258,9 @@ async def main():
)
config = safe_load(open(args.config, "r").read())

ax25listen = AX25Listen(args.source, args.command, config, args.port,
args.echo)
ax25listen = AX25Listen(
args.source, args.command, config, args.port, args.echo
)
await ax25listen.listen()


Expand Down

0 comments on commit 4f25ce9

Please sign in to comment.