Code Duplication    Length = 35-35 lines in 2 locations

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]

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6154-6188 (lines=35) @@
6151
6152
        return self._send_xml_command(cmd)
6153
6154
    def modify_config_set_scanner_preference(
6155
        self, config_id: str, name: str, *, value: Optional[str] = None
6156
    ) -> Any:
6157
        """Modifies the scanner preferences of an existing scan config
6158
6159
        Arguments:
6160
            config_id: UUID of scan config to modify.
6161
            name: Name of the scanner preference to change
6162
            value: New value for the preference. None to delete the preference
6163
                and to use the default instead.
6164
6165
        """
6166
        if not config_id:
6167
            raise RequiredArgument(
6168
                function=self.modify_config_set_scanner_preference.__name__,
6169
                argument='config_id',
6170
            )
6171
6172
        if not name:
6173
            raise RequiredArgument(
6174
                function=self.modify_config_set_scanner_preference.__name__,
6175
                argument='name argument',
6176
            )
6177
6178
        cmd = XmlCommand("modify_config")
6179
        cmd.set_attribute("config_id", str(config_id))
6180
6181
        _xmlpref = cmd.add_element("preference")
6182
6183
        _xmlpref.add_element("name", name)
6184
6185
        if value:
6186
            _xmlpref.add_element("value", _to_base64(value))
6187
6188
        return self._send_xml_command(cmd)
6189
6190
    def modify_config_set_nvt_selection(
6191
        self, config_id: str, family: str, nvt_oids: List[str]