Code Duplication    Length = 11-11 lines in 2 locations

pyof/v0x04/controller2switch/packet_out.py 1 location

@@ 77-87 (lines=11) @@
74
        except ValidationError:
75
            return False
76
77
    def pack(self, value=None):
78
        """Update the action_len attribute and call super's pack."""
79
        if value is None:
80
            self._update_actions_len()
81
            return super().pack()
82
        elif isinstance(value, type(self)):
83
            return value.pack()
84
        else:
85
            msg = "{} is not an instance of {}".format(value,
86
                                                       type(self).__name__)
87
            raise PackException(msg)
88
89
    def unpack(self, buff, offset=0):
90
        """Unpack a binary message into this object's attributes.

pyof/v0x01/controller2switch/packet_out.py 1 location

@@ 67-77 (lines=11) @@
64
        except ValidationError:
65
            return False
66
67
    def pack(self, value=None):
68
        """Update the action_len attribute and call super's pack."""
69
        if value is None:
70
            self._update_actions_len()
71
            return super().pack()
72
        elif isinstance(value, type(self)):
73
            return value.pack()
74
        else:
75
            msg = "{} is not an instance of {}".format(value,
76
                                                       type(self).__name__)
77
            raise PackException(msg)
78
79
    def unpack(self, buff, offset=0):
80
        """Unpack a binary message into this object's attributes.