Code Duplication    Length = 17-19 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 2506-2524 (lines=19) @@
2503
            if community:
2504
                cmd.add_element("community", community)
2505
2506
            if privacy_algorithm is not None or privacy_password:
2507
                _xmlprivacy = cmd.add_element("privacy")
2508
2509
                if privacy_algorithm is not None:
2510
                    if not isinstance(
2511
                        privacy_algorithm, self.types.SnmpPrivacyAlgorithm
2512
                    ):
2513
                        raise InvalidArgumentType(
2514
                            function=self.create_credential.__name__,
2515
                            argument='privacy_algorithm',
2516
                            arg_type=SnmpPrivacyAlgorithm.__name__,
2517
                        )
2518
2519
                    _xmlprivacy.add_element(
2520
                        "algorithm", privacy_algorithm.value
2521
                    )
2522
2523
                if privacy_password:
2524
                    _xmlprivacy.add_element("password", privacy_password)
2525
2526
        if credential_type == CredentialType.PGP_ENCRYPTION_KEY:
2527
            if not public_key:
@@ 2628-2644 (lines=17) @@
2625
        if community:
2626
            cmd.add_element("community", community)
2627
2628
        if privacy_algorithm is not None or privacy_password is not None:
2629
            _xmlprivacy = cmd.add_element("privacy")
2630
2631
            if privacy_algorithm is not None:
2632
                if not isinstance(
2633
                    privacy_algorithm, self.types.SnmpPrivacyAlgorithm
2634
                ):
2635
                    raise InvalidArgumentType(
2636
                        function=self.modify_credential.__name__,
2637
                        argument='privacy_algorithm',
2638
                        arg_type=SnmpPrivacyAlgorithm.__name__,
2639
                    )
2640
2641
                _xmlprivacy.add_element("algorithm", privacy_algorithm.value)
2642
2643
            if privacy_password is not None:
2644
                _xmlprivacy.add_element("password", privacy_password)
2645
2646
        if public_key:
2647
            _xmlkey = cmd.add_element("key")