Code Duplication    Length = 19-19 lines in 2 locations

pyof/v0x04/common/flow_instructions.py 1 location

@@ 76-94 (lines=19) @@
73
        super().__init__()
74
        self.instruction_type = instruction_type
75
76
    def pack(self, value=None):
77
        """Update the length and pack the massege into binary data.
78
79
        Returns:
80
            bytes: A binary data that represents the Message.
81
82
        Raises:
83
            Exception: If there are validation errors.
84
85
        """
86
        if value is None:
87
            self.update_length()
88
            return super().pack()
89
        elif isinstance(value, type(self)):
90
            return value.pack()
91
        else:
92
            msg = "{} is not an instance of {}".format(value,
93
                                                       type(self).__name__)
94
            raise PackException(msg)
95
96
    def update_length(self):
97
        """Update length attribute."""

pyof/v0x04/symmetric/hello.py 1 location

@@ 49-67 (lines=19) @@
46
        self.length = length
47
        self.content = content
48
49
    def pack(self, value=None):
50
        """Update the length and pack the massege into binary data.
51
52
        Returns:
53
            bytes: A binary data that represents the Message.
54
55
        Raises:
56
            Exception: If there are validation errors.
57
58
        """
59
        if value is None:
60
            self.update_length()
61
            return super().pack()
62
        elif isinstance(value, type(self)):
63
            return value.pack()
64
        else:
65
            msg = "{} is not an instance of {}".format(value,
66
                                                       type(self).__name__)
67
            raise PackException(msg)
68
69
    def update_length(self):
70
        """Update length attribute."""