Code Duplication    Length = 22-29 lines in 2 locations

pyof/v0x04/common/queue.py 1 location

@@ 75-103 (lines=29) @@
72
                         items=items)
73
74
75
class PacketQueue(GenericStruct):
76
    """Describe a queue."""
77
78
    #: id for the specific queue
79
    queue_id = UBInt32()
80
    #: Port this queue is attached to.
81
    port = UBInt32()
82
    #: Length, in bytes, of this queue desc.
83
    length = UBInt16()
84
    #: 64-bit alignment.
85
    pad = Pad(6)
86
    #: List of properties
87
    properties = ListOfProperties()
88
89
    def __init__(self, queue_id=None, port=None, length=None, properties=None):
90
        """Create a PacketQueue with the optional parameters below.
91
92
        Args:
93
            queue_id (int): ID of the specific queue.
94
            port (int): Port his queue is attached to.
95
            length (int): Length in bytes of this queue desc.
96
            properties(~pyof.v0x04.common.queue.ListOfProperties):
97
                Queue's list of properties. Default is an empty list.
98
        """
99
        super().__init__()
100
        self.queue_id = queue_id
101
        self.port = port
102
        self.length = length
103
        self.properties = [] if properties is None else properties
104
105
106
class ListOfQueues(FixedTypeList):

pyof/v0x01/common/queue.py 1 location

@@ 70-91 (lines=22) @@
67
        self.length = length
68
69
70
class PacketQueue(GenericStruct):
71
    """Describe a queue."""
72
73
    queue_id = UBInt32()
74
    length = UBInt16()
75
    #: 64-bit alignment.
76
    pad = Pad(2)
77
    properties = ListOfProperties()
78
79
    def __init__(self, queue_id=None, length=None, properties=None):
80
        """Create a PacketQueue with the optional parameters below.
81
82
        Args:
83
            queue_id (int): ID of the specific queue.
84
            length (int): Length in bytes of this queue desc.
85
            properties(~pyof.v0x01.common.queue.ListOfProperties):
86
                Queue's list of properties. Default is an empty list.
87
        """
88
        super().__init__()
89
        self.queue_id = queue_id
90
        self.length = length
91
        self.properties = [] if properties is None else properties
92
93
94
class QueuePropMinRate(GenericStruct):