Code Duplication    Length = 28-28 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 4564-4591 (lines=28) @@
4561
4562
        return self._send_xml_command(cmd)
4563
4564
    def modify_auth(self, group_name: str, auth_conf_settings: dict) -> Any:
4565
        """Modifies an existing auth.
4566
4567
        Arguments:
4568
            group_name: Name of the group to be modified.
4569
            auth_conf_settings: The new auth config.
4570
4571
        Returns:
4572
            The response. See :py:meth:`send_command` for details.
4573
        """
4574
        if not group_name:
4575
            raise RequiredArgument(
4576
                function=self.modify_auth.__name__, argument='group_name'
4577
            )
4578
        if not auth_conf_settings:
4579
            raise RequiredArgument(
4580
                function=self.modify_auth.__name__,
4581
                argument='auth_conf_settings',
4582
            )
4583
        cmd = XmlCommand("modify_auth")
4584
        _xmlgroup = cmd.add_element("group", attrs={"name": str(group_name)})
4585
4586
        for key, value in auth_conf_settings.items():
4587
            _xmlauthconf = _xmlgroup.add_element("auth_conf_setting")
4588
            _xmlauthconf.add_element("key", key)
4589
            _xmlauthconf.add_element("value", value)
4590
4591
        return self._send_xml_command(cmd)
4592
4593
    def modify_config_set_nvt_preference(
4594
        self,

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6030-6057 (lines=28) @@
6027
6028
        return self._send_xml_command(cmd)
6029
6030
    def modify_auth(self, group_name: str, auth_conf_settings: dict) -> Any:
6031
        """Modifies an existing auth.
6032
6033
        Arguments:
6034
            group_name: Name of the group to be modified.
6035
            auth_conf_settings: The new auth config.
6036
6037
        Returns:
6038
            The response. See :py:meth:`send_command` for details.
6039
        """
6040
        if not group_name:
6041
            raise RequiredArgument(
6042
                function=self.modify_auth.__name__, argument='group_name'
6043
            )
6044
        if not auth_conf_settings:
6045
            raise RequiredArgument(
6046
                function=self.modify_auth.__name__,
6047
                argument='auth_conf_settings',
6048
            )
6049
        cmd = XmlCommand("modify_auth")
6050
        _xmlgroup = cmd.add_element("group", attrs={"name": str(group_name)})
6051
6052
        for key, value in auth_conf_settings.items():
6053
            _xmlauthconf = _xmlgroup.add_element("auth_conf_setting")
6054
            _xmlauthconf.add_element("key", key)
6055
            _xmlauthconf.add_element("value", value)
6056
6057
        return self._send_xml_command(cmd)
6058
6059
    def modify_config_set_nvt_preference(
6060
        self,