Code Duplication    Length = 41-47 lines in 2 locations

pyof/v0x04/controller2switch/multipart_reply.py 1 location

@@ 318-364 (lines=47) @@
315
316
    # Can't avoid "too many local variables" (R0914) in this struct.
317
    # pylint: disable=R0914
318
    def __init__(self, port_no=None, rx_packets=None,
319
                 tx_packets=None, rx_bytes=None, tx_bytes=None,
320
                 rx_dropped=None, tx_dropped=None, rx_errors=None,
321
                 tx_errors=None, rx_frame_err=None, rx_over_err=None,
322
                 rx_crc_err=None, collisions=None, duration_sec=None,
323
                 duration_nsec=None):
324
        """The constructor assigns parameters to object attributes.
325
326
        Args:
327
            port_no (:class:`int`, :class:`~pyof.v0x04.common.port.Port`):
328
                Port number.
329
            rx_packets (int): Number of received packets.
330
            tx_packets (int): Number of transmitted packets.
331
            rx_bytes (int): Number of received bytes.
332
            tx_bytes (int): Number of transmitted bytes.
333
            rx_dropped (int): Number of packets dropped by RX.
334
            tx_dropped (int): Number of packets dropped by TX.
335
            rx_errors (int): Number of receive errors. This is a super-set of
336
                more specific receive errors and should be greater than or
337
                equal to the sum of all rx_*_err values.
338
            tx_errors (int): Number of transmit errors.  This is a super-set of
339
                more specific transmit errors and should be greater than or
340
                equal to the sum of all tx_*_err values (none currently
341
                defined).
342
            rx_frame_err (int): Number of frame alignment errors.
343
            rx_over_err (int): Number of packets with RX overrun.
344
            rx_crc_err (int): Number of CRC errors.
345
            collisions (int): Number of collisions.
346
            duration_sec (int): Time port has been alive in seconds
347
            duration_nsec (int): Time port has been alive in nanoseconds beyond
348
                duration_sec
349
        """
350
        super().__init__()
351
        self.port_no = port_no
352
        self.rx_packets = rx_packets
353
        self.tx_packets = tx_packets
354
        self.rx_bytes = rx_bytes
355
        self.tx_bytes = tx_bytes
356
        self.rx_dropped = rx_dropped
357
        self.tx_dropped = tx_dropped
358
        self.rx_errors = rx_errors
359
        self.tx_errors = tx_errors
360
        self.rx_frame_err = rx_frame_err
361
        self.rx_over_err = rx_over_err
362
        self.rx_crc_err = rx_crc_err
363
        self.collisions = collisions
364
        self.duration_sec = duration_sec
365
        self.duration_nsec = duration_nsec
366
367

pyof/v0x01/controller2switch/common.py 1 location

@@ 289-329 (lines=41) @@
286
    rx_over_err = UBInt64()
287
    rx_crc_err = UBInt64()
288
    collisions = UBInt64()
289
290
    def __init__(self, port_no=None, rx_packets=None,
291
                 tx_packets=None, rx_bytes=None, tx_bytes=None,
292
                 rx_dropped=None, tx_dropped=None, rx_errors=None,
293
                 tx_errors=None, rx_frame_err=None, rx_over_err=None,
294
                 rx_crc_err=None, collisions=None):
295
        """The constructor assigns parameters to object attributes.
296
297
        Args:
298
            port_no (:class:`int`, :class:`~pyof.v0x01.common.phy_port.Port`):
299
                Port number.
300
            rx_packets (int): Number of received packets.
301
            tx_packets (int): Number of transmitted packets.
302
            rx_bytes (int): Number of received bytes.
303
            tx_bytes (int): Number of transmitted bytes.
304
            rx_dropped (int): Number of packets dropped by RX.
305
            tx_dropped (int): Number of packets dropped by TX.
306
            rx_errors (int): Number of receive errors. This is a super-set of
307
                more specific receive errors and should be greater than or
308
                equal to the sum of all rx_*_err values.
309
            tx_errors (int): Number of transmit errors.  This is a super-set of
310
                more specific transmit errors and should be greater than or
311
                equal to the sum of all tx_*_err values (none currently
312
                defined).
313
            rx_frame_err (int): Number of frame alignment errors.
314
            rx_over_err (int): Number of packets with RX overrun.
315
            rx_crc_err (int): Number of CRC errors.
316
            collisions (int): Number of collisions.
317
        """
318
        super().__init__()
319
        self.port_no = port_no
320
        self.rx_packets = rx_packets
321
        self.tx_packets = tx_packets
322
        self.rx_bytes = rx_bytes
323
        self.tx_bytes = tx_bytes
324
        self.rx_dropped = rx_dropped
325
        self.tx_dropped = tx_dropped
326
        self.rx_errors = rx_errors
327
        self.tx_errors = tx_errors
328
        self.rx_frame_err = rx_frame_err
329
        self.rx_over_err = rx_over_err
330
        self.rx_crc_err = rx_crc_err
331
        self.collisions = collisions
332