Code Duplication    Length = 17-19 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 1780-1798 (lines=19) @@
1777
            if community:
1778
                cmd.add_element("community", community)
1779
1780
            if privacy_algorithm is not None or privacy_password:
1781
                _xmlprivacy = cmd.add_element("privacy")
1782
1783
                if privacy_algorithm is not None:
1784
                    if not isinstance(
1785
                        privacy_algorithm, self.types.SnmpPrivacyAlgorithm
1786
                    ):
1787
                        raise InvalidArgumentType(
1788
                            function=self.create_credential.__name__,
1789
                            argument='privacy_algorithm',
1790
                            arg_type=SnmpPrivacyAlgorithm.__name__,
1791
                        )
1792
1793
                    _xmlprivacy.add_element(
1794
                        "algorithm", privacy_algorithm.value
1795
                    )
1796
1797
                if privacy_password:
1798
                    _xmlprivacy.add_element("password", privacy_password)
1799
1800
        if credential_type == CredentialType.PGP_ENCRYPTION_KEY:
1801
            if not public_key:
@@ 1902-1918 (lines=17) @@
1899
        if community:
1900
            cmd.add_element("community", community)
1901
1902
        if privacy_algorithm is not None or privacy_password is not None:
1903
            _xmlprivacy = cmd.add_element("privacy")
1904
1905
            if privacy_algorithm is not None:
1906
                if not isinstance(
1907
                    privacy_algorithm, self.types.SnmpPrivacyAlgorithm
1908
                ):
1909
                    raise InvalidArgumentType(
1910
                        function=self.modify_credential.__name__,
1911
                        argument='privacy_algorithm',
1912
                        arg_type=SnmpPrivacyAlgorithm.__name__,
1913
                    )
1914
1915
                _xmlprivacy.add_element("algorithm", privacy_algorithm.value)
1916
1917
            if privacy_password is not None:
1918
                _xmlprivacy.add_element("password", privacy_password)
1919
1920
        if public_key:
1921
            _xmlkey = cmd.add_element("key")