Skip to content
This repository was archived by the owner on Apr 22, 2024. It is now read-only.

Commit 427b56a

Browse files
committed
[minor] Fix linter (isort) errors.
Change the multi line output to keep the line width < 80.
1 parent 3f1a0c9 commit 427b56a

87 files changed

Lines changed: 91 additions & 148 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pyof/foundation/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
from enum import Enum, IntEnum
2424

2525
# Local source tree imports
26-
from pyof.foundation.exceptions import (BadValueException, PackException,
27-
UnpackException, ValidationError)
26+
from pyof.foundation.exceptions import (
27+
BadValueException, PackException, UnpackException, ValidationError)
2828

2929
# Third-party imports
3030

pyof/foundation/network_types.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"""
55

66
from pyof.foundation.base import GenericStruct
7-
from pyof.foundation.basic_types import (BinaryData, HWAddress, IPAddress,
8-
UBInt8, UBInt16)
7+
from pyof.foundation.basic_types import (
8+
BinaryData, HWAddress, IPAddress, UBInt8, UBInt16)
99
from pyof.foundation.exceptions import PackException
1010

1111
__all__ = ('Ethernet', 'GenericTLV', 'IPv4', 'TLVWithSubType', 'LLDP')
@@ -140,7 +140,7 @@ def get_size(self, value=None):
140140

141141

142142
class IPv4(GenericStruct):
143-
"""IPv4 packet "struct"
143+
"""IPv4 packet "struct".
144144
145145
Contains all fields of an IP version 4 packet header, plus the upper layer
146146
content as binary data.
@@ -197,7 +197,7 @@ def __init__(self, version=4, ihl=5, dscp=0, ecn=0, length=0, # noqa
197197
self.data = data
198198

199199
def _update_checksum(self):
200-
"""Updates the packet checksum to enable integrity check."""
200+
"""Update the packet checksum to enable integrity check."""
201201
source_list = [int(octet) for octet in self.source.split(".")]
202202
destination_list = [int(octet) for octet in
203203
self.destination.split(".")]
@@ -218,6 +218,10 @@ def _update_checksum(self):
218218
self.checksum = ~block_sum & 65535
219219

220220
def pack(self, value=None):
221+
"""Pack the struct in a binary representation.
222+
223+
Merge some fields to ensure correct packing.
224+
"""
221225
# Set the correct IHL based on options size
222226
if self.options:
223227
self.ihl += int(len(self.options) / 4)
@@ -235,6 +239,10 @@ def pack(self, value=None):
235239
return super().pack()
236240

237241
def unpack(self, buff, offset=0):
242+
"""Unpack a binary struct into this object's attributes.
243+
244+
Return the values instead of the lib's basic types.
245+
"""
238246
super().unpack(buff, offset)
239247

240248
self.version = self._version_ihl.value >> 4

pyof/v0x01/asynchronous/packet_in.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from enum import IntEnum
55

66
from pyof.foundation.base import GenericMessage
7-
from pyof.foundation.basic_types import (BinaryData, Pad, UBInt8, UBInt16,
8-
UBInt32)
7+
from pyof.foundation.basic_types import (
8+
BinaryData, Pad, UBInt8, UBInt16, UBInt32)
99
from pyof.v0x01.common.constants import NO_BUFFER
1010
from pyof.v0x01.common.header import Header, Type
1111

pyof/v0x01/common/action.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
# Local source tree imports
66
from pyof.foundation.base import GenericBitMask, GenericStruct
7-
from pyof.foundation.basic_types import (FixedTypeList, HWAddress, Pad, UBInt8,
8-
UBInt16, UBInt32)
7+
from pyof.foundation.basic_types import (
8+
FixedTypeList, HWAddress, Pad, UBInt8, UBInt16, UBInt32)
99
from pyof.foundation.constants import UBINT16_MAX_VALUE
1010

1111
# Third-party imports

pyof/v0x01/common/flow_match.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
# Local source tree imports
88
from pyof.foundation.base import GenericBitMask, GenericStruct
9-
from pyof.foundation.basic_types import (HWAddress, IPAddress, Pad, UBInt8,
10-
UBInt16, UBInt32)
9+
from pyof.foundation.basic_types import (
10+
HWAddress, IPAddress, Pad, UBInt8, UBInt16, UBInt32)
1111

1212
__all__ = ('Match', 'FlowWildCards')
1313

pyof/v0x01/common/phy_port.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
# Local source tree imports
77
from pyof.foundation.base import GenericBitMask, GenericStruct
8-
from pyof.foundation.basic_types import (Char, FixedTypeList, HWAddress,
9-
UBInt16, UBInt32)
8+
from pyof.foundation.basic_types import (
9+
Char, FixedTypeList, HWAddress, UBInt16, UBInt32)
1010
from pyof.foundation.constants import OFP_MAX_PORT_NAME_LEN
1111

1212
# Third-party imports

pyof/v0x01/common/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
from pyof.v0x01.controller2switch.get_config_request import GetConfigRequest
2222
from pyof.v0x01.controller2switch.packet_out import PacketOut
2323
from pyof.v0x01.controller2switch.port_mod import PortMod
24-
from pyof.v0x01.controller2switch.queue_get_config_reply import \
25-
QueueGetConfigReply
26-
from pyof.v0x01.controller2switch.queue_get_config_request import \
27-
QueueGetConfigRequest
24+
from pyof.v0x01.controller2switch.queue_get_config_reply import (
25+
QueueGetConfigReply)
26+
from pyof.v0x01.controller2switch.queue_get_config_request import (
27+
QueueGetConfigRequest)
2828
from pyof.v0x01.controller2switch.set_config import SetConfig
2929
from pyof.v0x01.controller2switch.stats_reply import StatsReply
3030
from pyof.v0x01.controller2switch.stats_request import StatsRequest

pyof/v0x01/controller2switch/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
from enum import IntEnum
55

66
from pyof.foundation.base import GenericMessage, GenericStruct
7-
from pyof.foundation.basic_types import (Char, Pad, UBInt8, UBInt16, UBInt32,
8-
UBInt64)
9-
from pyof.foundation.constants import (DESC_STR_LEN, OFP_MAX_TABLE_NAME_LEN,
10-
SERIAL_NUM_LEN)
7+
from pyof.foundation.basic_types import (
8+
Char, Pad, UBInt8, UBInt16, UBInt32, UBInt64)
9+
from pyof.foundation.constants import (
10+
DESC_STR_LEN, OFP_MAX_TABLE_NAME_LEN, SERIAL_NUM_LEN)
1111
# Local source tree imports
1212
from pyof.v0x01.common.action import ListOfActions
1313
from pyof.v0x01.common.flow_match import FlowWildCards, Match

pyof/v0x04/asynchronous/packet_in.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from enum import IntEnum
55

66
from pyof.foundation.base import GenericMessage
7-
from pyof.foundation.basic_types import (BinaryData, Pad, UBInt8, UBInt16,
8-
UBInt32, UBInt64)
7+
from pyof.foundation.basic_types import (
8+
BinaryData, Pad, UBInt8, UBInt16, UBInt32, UBInt64)
99
from pyof.v0x04.common.flow_match import Match
1010
from pyof.v0x04.common.header import Header, Type
1111

pyof/v0x04/common/action.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
# Local source tree imports
66
from pyof.foundation.base import GenericStruct
7-
from pyof.foundation.basic_types import (FixedTypeList, Pad, UBInt8, UBInt16,
8-
UBInt32)
7+
from pyof.foundation.basic_types import (
8+
FixedTypeList, Pad, UBInt8, UBInt16, UBInt32)
99

1010
# Third-party imports
1111

0 commit comments

Comments
 (0)