Code Duplication    Length = 35-35 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6122-6156 (lines=35) @@
6119
6120
        return self._send_xml_command(cmd)
6121
6122
    def modify_config_set_scanner_preference(
6123
        self, config_id: str, name: str, *, value: Optional[str] = None
6124
    ) -> Any:
6125
        """Modifies the scanner preferences of an existing scan config
6126
6127
        Arguments:
6128
            config_id: UUID of scan config to modify.
6129
            name: Name of the scanner preference to change
6130
            value: New value for the preference. None to delete the preference
6131
                and to use the default instead.
6132
6133
        """
6134
        if not config_id:
6135
            raise RequiredArgument(
6136
                function=self.modify_config_set_scanner_preference.__name__,
6137
                argument='config_id',
6138
            )
6139
6140
        if not name:
6141
            raise RequiredArgument(
6142
                function=self.modify_config_set_scanner_preference.__name__,
6143
                argument='name argument',
6144
            )
6145
6146
        cmd = XmlCommand("modify_config")
6147
        cmd.set_attribute("config_id", str(config_id))
6148
6149
        _xmlpref = cmd.add_element("preference")
6150
6151
        _xmlpref.add_element("name", name)
6152
6153
        if value:
6154
            _xmlpref.add_element("value", _to_base64(value))
6155
6156
        return self._send_xml_command(cmd)
6157
6158
    def modify_config_set_nvt_selection(
6159
        self, config_id: str, family: str, nvt_oids: List[str]

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 4688-4722 (lines=35) @@
4685
4686
        return self._send_xml_command(cmd)
4687
4688
    def modify_config_set_scanner_preference(
4689
        self, config_id: str, name: str, *, value: Optional[str] = None
4690
    ) -> Any:
4691
        """Modifies the scanner preferences of an existing scan config
4692
4693
        Arguments:
4694
            config_id: UUID of scan config to modify.
4695
            name: Name of the scanner preference to change
4696
            value: New value for the preference. None to delete the preference
4697
                and to use the default instead.
4698
4699
        """
4700
        if not config_id:
4701
            raise RequiredArgument(
4702
                function=self.modify_config_set_scanner_preference.__name__,
4703
                argument='config_id',
4704
            )
4705
4706
        if not name:
4707
            raise RequiredArgument(
4708
                function=self.modify_config_set_scanner_preference.__name__,
4709
                argument='name argument',
4710
            )
4711
4712
        cmd = XmlCommand("modify_config")
4713
        cmd.set_attribute("config_id", str(config_id))
4714
4715
        _xmlpref = cmd.add_element("preference")
4716
4717
        _xmlpref.add_element("name", name)
4718
4719
        if value:
4720
            _xmlpref.add_element("value", _to_base64(value))
4721
4722
        return self._send_xml_command(cmd)
4723
4724
    def modify_config_set_nvt_selection(
4725
        self, config_id: str, family: str, nvt_oids: List[str]