From a912d105f3a1d8fed0b4cf6b18e0ef7789be81bf Mon Sep 17 00:00:00 2001 From: selias Date: Fri, 30 Sep 2016 14:04:06 +0200 Subject: Fix pylint warnings in python libraries - no functional changes - fixes 80+ PEP-8 violations Change-Id: Icf414778ec40d5cb44364fa69a876f9a1870c3c7 Signed-off-by: selias --- resources/libraries/python/PacketVerifier.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'resources/libraries/python/PacketVerifier.py') diff --git a/resources/libraries/python/PacketVerifier.py b/resources/libraries/python/PacketVerifier.py index 59ea2db5a3..bbfdfe8688 100644 --- a/resources/libraries/python/PacketVerifier.py +++ b/resources/libraries/python/PacketVerifier.py @@ -68,7 +68,7 @@ import socket import select from scapy.all import ETH_P_IP, ETH_P_IPV6, ETH_P_ALL, ETH_P_ARP -from scapy.all import Ether, ARP, Packet +from scapy.all import Ether, ARP from scapy.layers.inet6 import IPv6 __all__ = ['RxQueue', 'TxQueue', 'Interface', 'create_gratuitous_arp_request', @@ -276,17 +276,32 @@ class TxQueue(PacketVerifier): class Interface(object): + """Class for network interfaces. Contains methods for sending and receiving + packets.""" def __init__(self, if_name): + """Initialize the interface class. + + :param if_name: Name of the interface. + :type if_name: str + """ self.if_name = if_name self.sent_packets = [] self.rxq = RxQueue(if_name) self.txq = TxQueue(if_name) def send_pkt(self, pkt): + """Send the provided packet out the interface.""" self.sent_packets.append(pkt) self.txq.send(pkt) def recv_pkt(self, timeout=3): + """Read one packet from the interface's receive queue. + + :param timeout: Timeout value in seconds. + :type timeout: int + :return: Ether() initialized object from packet data. + :rtype: scapy.Ether + """ return self.rxq.recv(timeout, self.sent_packets) -- cgit 1.2.3-korg