Linting
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
a4cf467e59
commit
e06d7b9540
|
@ -193,9 +193,9 @@ class NeighbourTLV(TLV):
|
|||
|
||||
def marshal(self) -> bytes:
|
||||
return self.type.to_bytes(1, "big") + \
|
||||
self.length.to_bytes(1, "big") + \
|
||||
self.ip_address.packed + \
|
||||
self.port.to_bytes(2, "big")
|
||||
self.length.to_bytes(1, "big") + \
|
||||
self.ip_address.packed + \
|
||||
self.port.to_bytes(2, "big")
|
||||
|
||||
|
||||
class DataTLV(TLV):
|
||||
|
@ -214,10 +214,10 @@ class DataTLV(TLV):
|
|||
|
||||
def marshal(self) -> bytes:
|
||||
return self.type.to_bytes(1, "big") + \
|
||||
self.length.to_bytes(1, "big") + \
|
||||
self.sender_id.to_bytes(8, "big") + \
|
||||
self.nonce.to_bytes(4, "big") + \
|
||||
self.data
|
||||
self.length.to_bytes(1, "big") + \
|
||||
self.sender_id.to_bytes(8, "big") + \
|
||||
self.nonce.to_bytes(4, "big") + \
|
||||
self.data
|
||||
|
||||
|
||||
class AckTLV(TLV):
|
||||
|
@ -234,9 +234,9 @@ class AckTLV(TLV):
|
|||
|
||||
def marshal(self) -> bytes:
|
||||
return self.type.to_bytes(1, "big") + \
|
||||
self.length.to_bytes(1, "big") + \
|
||||
self.sender_id.to_bytes(8, "big") + \
|
||||
self.nonce.to_bytes(4, "big")
|
||||
self.length.to_bytes(1, "big") + \
|
||||
self.sender_id.to_bytes(8, "big") + \
|
||||
self.nonce.to_bytes(4, "big")
|
||||
|
||||
|
||||
class GoAwayTLV(TLV):
|
||||
|
@ -259,9 +259,9 @@ class GoAwayTLV(TLV):
|
|||
|
||||
def marshal(self) -> bytes:
|
||||
return self.type.to_bytes(1, "big") + \
|
||||
self.length.to_bytes(1, "big") + \
|
||||
self.code.value.to_bytes(1, "big") + \
|
||||
self.message.encode("UTF-8")[:self.length - 1]
|
||||
self.length.to_bytes(1, "big") + \
|
||||
self.code.value.to_bytes(1, "big") + \
|
||||
self.message.encode("UTF-8")[:self.length - 1]
|
||||
|
||||
|
||||
class WarningTLV(TLV):
|
||||
|
@ -276,8 +276,8 @@ class WarningTLV(TLV):
|
|||
|
||||
def marshal(self) -> bytes:
|
||||
return self.type.to_bytes(1, "big") + \
|
||||
self.length.to_bytes(1, "big") + \
|
||||
self.message.encode("UTF-8")[:self.length]
|
||||
self.length.to_bytes(1, "big") + \
|
||||
self.message.encode("UTF-8")[:self.length]
|
||||
|
||||
|
||||
class Packet:
|
||||
|
@ -317,7 +317,7 @@ class Packet:
|
|||
if not (0 <= tlv_type < len(TLV.tlv_classes())):
|
||||
raise ValueError(f"TLV type is not supported: {tlv_type}")
|
||||
pkt.body = TLV.tlv_classes()[tlv_type]()
|
||||
pkt.body.unmarshal(data[4:4+pkt.body_length])
|
||||
pkt.body.unmarshal(data[4:4 + pkt.body_length])
|
||||
|
||||
pkt.validate_data()
|
||||
|
||||
|
|
Loading…
Reference in New Issue