Code Duplication    Length = 17-17 lines in 2 locations

pyof/v0x04/common/flow_instructions.py 1 location

@@ 76-92 (lines=17) @@
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
        if isinstance(value, type(self)):
90
            return value.pack()
91
        msg = "{} is not an instance of {}".format(value, type(self).__name__)
92
        raise PackException(msg)
93
94
    def update_length(self):
95
        """Update length attribute."""

pyof/v0x04/symmetric/hello.py 1 location

@@ 49-65 (lines=17) @@
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
        if isinstance(value, type(self)):
63
            return value.pack()
64
        msg = "{} is not an instance of {}".format(value, type(self).__name__)
65
        raise PackException(msg)
66
67
    def update_length(self):
68
        """Update length attribute."""