Code Duplication    Length = 18-20 lines in 2 locations

src/apex/plugins/apexparadigm/__init__.py 2 locations

@@ 206-225 (lines=20) @@
203
            elif selected_hop and selected_hop['index'] <= hop_index:
204
                break
205
206
            for port_name in self.port_map.keys():
207
                port = self.port_map[port_name]
208
209
                # since the callsign specifically was specified in the path after the band-path the callsign takes
210
                # precedence
211
                if port['identifier'] == hop:
212
                    selected_hop['index'] = hop_index
213
                    selected_hop['hop'] = hop
214
                    selected_hop['node'] = node
215
                    selected_hop['ssid'] = ssid
216
                    selected_hop['port_name'] = port_name
217
                    selected_hop['port'] = port
218
                    selected_hop['band_path'] = None
219
                    selected_hop['band_path_net'] = None
220
221
        if not selected_hop:
222
            return
223
224
        # now lets digipeat this packet
225
        new_path = []
226
        for hop_index in range(0, len(frame['path'])):
227
            hop = frame['path'][hop_index]
228
            if not apex.routing.is_hop_consumed(hop):
@@ 188-205 (lines=18) @@
185
                        selected_hop['port_name'] = port_name
186
                        selected_hop['port'] = port
187
                        selected_hop['band_path'] = band_path
188
                        selected_hop['band_path_net'] = band_path_net
189
                    elif ssid > selected_hop['ssid']:
190
                        selected_hop['index'] = hop_index
191
                        selected_hop['hop'] = hop
192
                        selected_hop['node'] = node
193
                        selected_hop['ssid'] = ssid
194
                        selected_hop['port_name'] = port_name
195
                        selected_hop['port'] = port
196
                        selected_hop['band_path'] = band_path
197
                        selected_hop['band_path_net'] = band_path_net
198
        for hop_index in reversed(range(0, len(frame['path']))):
199
            hop = frame['path'][hop_index]
200
            # If this is the last node before a spent node, or a spent node itself, we are done
201
            if apex.routing.is_hop_consumed(hop) or apex.routing.is_hop_consumed(frame['path'][hop_index-1]):
202
                break
203
            elif selected_hop and selected_hop['index'] <= hop_index:
204
                break
205
206
            for port_name in self.port_map.keys():
207
                port = self.port_map[port_name]
208