Code Duplication    Length = 11-11 lines in 2 locations

pyof/v0x01/controller2switch/stats_reply.py 1 location

@@ 91-101 (lines=11) @@
88
89
        return FixedTypeList(pyof_class=pyof_class)
90
91
    def _get_body_class(self):
92
        if isinstance(self.body_type, (int, UBInt16)):
93
            self.body_type = self.body_type.enum_ref(self.body_type.value)
94
95
        body_name = self.body_type.name.replace('OFPST_', '').title()
96
        module = import_module('pyof.v0x01.controller2switch.common')
97
98
        for class_name in module.__all__:
99
            if 'Request' not in class_name and body_name in class_name:
100
                return getattr(module, class_name)
101
        return None
102

pyof/v0x01/controller2switch/stats_request.py 1 location

@@ 67-77 (lines=11) @@
64
        self.body = FixedTypeList(pyof_class=class_name)
65
        self.body.unpack(buff)
66
67
    def _get_body_class(self):
68
        if isinstance(self.body_type, (int, UBInt16)):
69
            self.body_type = self.body_type.enum_ref(self.body_type.value)
70
71
        module = import_module('pyof.v0x01.controller2switch.common')
72
        body_name = self.body_type.name.replace('OFPST_', '').title()
73
74
        for class_name in module.__all__:
75
            if 'Request' in class_name and body_name in class_name:
76
                return getattr(module, class_name)
77
        return None
78