Code Duplication    Length = 13-14 lines in 2 locations

ospd_openvas/preferencehandler.py 2 locations

@@ 315-327 (lines=13) @@
312
        target_opt_prefs_list = []
313
        alive_test = None
314
315
        if target_options:
316
            # Alive test speciefied as bit field.
317
            alive_test = target_options.get('alive_test')
318
            # Alive test speciefied as individual methods.
319
            alive_test_methods = target_options.get('alive_test_methods')
320
            # alive_test takes precedence over alive_test_methods
321
            if alive_test is None and alive_test_methods:
322
                alive_test = alive_test_methods_to_bit_field(
323
                    icmp=target_options.get('icmp') == '1',
324
                    tcp_syn=target_options.get('tcp_syn') == '1',
325
                    tcp_ack=target_options.get('tcp_ack') == '1',
326
                    arp=target_options.get('arp') == '1',
327
                    consider_alive=target_options.get('consider_alive') == '1',
328
                )
329
330
        if target_options and alive_test:
@@ 453-466 (lines=14) @@
450
        else:
451
            return
452
453
        if target_options:
454
            alive_test_ports = target_options.get('alive_test_ports')
455
            # Alive test was speciefied as bit field.
456
            alive_test = target_options.get('alive_test')
457
            # Alive test was speciefied as individual methods.
458
            alive_test_methods = target_options.get('alive_test_methods')
459
            # <alive_test> takes precedence over <alive_test_methods>
460
            if alive_test is None and alive_test_methods:
461
                alive_test = alive_test_methods_to_bit_field(
462
                    icmp=target_options.get('icmp') == '1',
463
                    tcp_syn=target_options.get('tcp_syn') == '1',
464
                    tcp_ack=target_options.get('tcp_ack') == '1',
465
                    arp=target_options.get('arp') == '1',
466
                    consider_alive=target_options.get('consider_alive') == '1',
467
                )
468
469
        if alive_test is not None: