From f85b52524a334d666f4311bd824406804dcb4fd2 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Tue, 5 Jan 2021 16:03:16 +0100 Subject: [PATCH] Linting --- squinnondation/hazel.py | 2 +- squinnondation/messages.py | 7 ++++--- squinnondation/squinnondation.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/squinnondation/hazel.py b/squinnondation/hazel.py index d11aeea..7b173f0 100644 --- a/squinnondation/hazel.py +++ b/squinnondation/hazel.py @@ -687,7 +687,7 @@ class Squirrel(Hazelnut): self.clean_inundation() # Broadcast a GoAway - gatlv = GoAwayTLV().construct(GoAwayType.EXIT, f"I am leaving! Good bye!") + gatlv = GoAwayTLV().construct(GoAwayType.EXIT, "I am leaving! Good bye!") pkt = Packet.construct(gatlv) for hazelnut in self.activehazelnuts.values(): self.send_packet(hazelnut[0], pkt) diff --git a/squinnondation/messages.py b/squinnondation/messages.py index 55b43c0..d6157a4 100644 --- a/squinnondation/messages.py +++ b/squinnondation/messages.py @@ -219,9 +219,10 @@ class NeighbourTLV(TLV): self.port.to_bytes(2, sys.byteorder) def handle(self, squirrel: Any, sender: Any) -> None: - if squirrel.address == str(self.ip_address) and squirrel.port == self.port : - #This case should never happen (and in our protocol it is not possible), but we include this test as a security measure. - return + if squirrel.address == str(self.ip_address) and squirrel.port == self.port: + # This case should never happen (and in our protocol it is not possible), + # but we include this test as a security measure. + return if not (str(self.ip_address), self.port) in squirrel.activehazelnuts \ and not (str(self.ip_address), self.port) in squirrel.potentialhazelnuts: squirrel.potentialhazelnuts[(str(self.ip_address), self.port)] = \ diff --git a/squinnondation/squinnondation.py b/squinnondation/squinnondation.py index e81d3c3..22c9999 100644 --- a/squinnondation/squinnondation.py +++ b/squinnondation/squinnondation.py @@ -5,7 +5,7 @@ import curses from argparse import ArgumentParser from typing import Any -from .hazel import Hazelnut, Squirrel, Worm, HazelManager, Inondator +from .hazel import Hazelnut, Squirrel from .messages import Packet, HelloTLV from .term_manager import TermManager