Code Duplication    Length = 13-14 lines in 2 locations

ospd_openvas/preferencehandler.py 2 locations

@@ 328-340 (lines=13) @@
325
        target_opt_prefs_list = {}
326
        alive_test = None
327
328
        if target_options:
329
            # Alive test specified as bit field.
330
            alive_test = target_options.get('alive_test')
331
            # Alive test specified as individual methods.
332
            alive_test_methods = target_options.get('alive_test_methods')
333
            # alive_test takes precedence over alive_test_methods
334
            if alive_test is None and alive_test_methods:
335
                alive_test = alive_test_methods_to_bit_field(
336
                    icmp=target_options.get('icmp') == '1',
337
                    tcp_syn=target_options.get('tcp_syn') == '1',
338
                    tcp_ack=target_options.get('tcp_ack') == '1',
339
                    arp=target_options.get('arp') == '1',
340
                    consider_alive=target_options.get('consider_alive') == '1',
341
                )
342
343
        if target_options and alive_test:
@@ 450-463 (lines=14) @@
447
        else:
448
            return
449
450
        if target_options:
451
            alive_test_ports = target_options.get('alive_test_ports')
452
            # Alive test was specified as bit field.
453
            alive_test = target_options.get('alive_test')
454
            # Alive test was specified as individual methods.
455
            alive_test_methods = target_options.get('alive_test_methods')
456
            # <alive_test> takes precedence over <alive_test_methods>
457
            if alive_test is None and alive_test_methods:
458
                alive_test = alive_test_methods_to_bit_field(
459
                    icmp=target_options.get('icmp') == '1',
460
                    tcp_syn=target_options.get('tcp_syn') == '1',
461
                    tcp_ack=target_options.get('tcp_ack') == '1',
462
                    arp=target_options.get('arp') == '1',
463
                    consider_alive=target_options.get('consider_alive') == '1',
464
                )
465
466
        if alive_test is not None: