Code Duplication    Length = 11-11 lines in 3 locations

kytos/core/switch.py 1 location

@@ 127-137 (lines=11) @@
124
            return '0x0' + str(self.connection.protocol.version)
125
        return None
126
127
    @property
128
    def status(self):
129
        """Return the current status of the Entity."""
130
        state = super().status
131
        if state == EntityStatus.DISABLED:
132
            return state
133
134
        for status_func in self.status_funcs.values():
135
            if status_func(self) == EntityStatus.DOWN:
136
                return EntityStatus.DOWN
137
        return state
138
139
    @classmethod
140
    def register_status_func(cls, name: str, func):

kytos/core/link.py 1 location

@@ 59-69 (lines=11) @@
56
        """Register status func given its name and a callable at setup time."""
57
        cls.status_funcs[name] = func
58
59
    @property
60
    def status(self):
61
        """Return the current status of the Entity."""
62
        state = super().status
63
        if state == EntityStatus.DISABLED:
64
            return state
65
66
        for status_func in self.status_funcs.values():
67
            if status_func(self) == EntityStatus.DOWN:
68
                return EntityStatus.DOWN
69
        return state
70
71
    @classmethod
72
    def register_status_reason_func(cls, name: str, func):

kytos/core/interface.py 1 location

@@ 193-203 (lines=11) @@
190
        """Return if an interface is a user-to-network Interface."""
191
        return not self.nni
192
193
    @property
194
    def status(self):
195
        """Return the current status of the Entity."""
196
        state = super().status
197
        if state == EntityStatus.DISABLED:
198
            return state
199
200
        for status_func in self.status_funcs.values():
201
            if status_func(self) == EntityStatus.DOWN:
202
                return EntityStatus.DOWN
203
        return state
204
205
    @classmethod
206
    def register_status_func(cls, name: str, func):