Code Duplication    Length = 17-19 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 1961-1979 (lines=19) @@
1958
            if community:
1959
                cmd.add_element("community", community)
1960
1961
            if privacy_algorithm is not None or privacy_password:
1962
                _xmlprivacy = cmd.add_element("privacy")
1963
1964
                if privacy_algorithm is not None:
1965
                    if not isinstance(
1966
                        privacy_algorithm, self.types.SnmpPrivacyAlgorithm
1967
                    ):
1968
                        raise InvalidArgumentType(
1969
                            function=self.create_credential.__name__,
1970
                            argument='privacy_algorithm',
1971
                            arg_type=SnmpPrivacyAlgorithm.__name__,
1972
                        )
1973
1974
                    _xmlprivacy.add_element(
1975
                        "algorithm", privacy_algorithm.value
1976
                    )
1977
1978
                if privacy_password:
1979
                    _xmlprivacy.add_element("password", privacy_password)
1980
1981
        if credential_type == CredentialType.PGP_ENCRYPTION_KEY:
1982
            if not public_key:
@@ 2083-2099 (lines=17) @@
2080
        if community:
2081
            cmd.add_element("community", community)
2082
2083
        if privacy_algorithm is not None or privacy_password is not None:
2084
            _xmlprivacy = cmd.add_element("privacy")
2085
2086
            if privacy_algorithm is not None:
2087
                if not isinstance(
2088
                    privacy_algorithm, self.types.SnmpPrivacyAlgorithm
2089
                ):
2090
                    raise InvalidArgumentType(
2091
                        function=self.modify_credential.__name__,
2092
                        argument='privacy_algorithm',
2093
                        arg_type=SnmpPrivacyAlgorithm.__name__,
2094
                    )
2095
2096
                _xmlprivacy.add_element("algorithm", privacy_algorithm.value)
2097
2098
            if privacy_password is not None:
2099
                _xmlprivacy.add_element("password", privacy_password)
2100
2101
        if public_key:
2102
            _xmlkey = cmd.add_element("key")