Code Duplication    Length = 38-38 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6739-6776 (lines=38) @@
6736
6737
        return self._send_xml_command(cmd)
6738
6739
    def modify_setting(
6740
        self,
6741
        setting_id: Optional[str] = None,
6742
        name: Optional[str] = None,
6743
        value: Optional[str] = None,
6744
    ) -> Any:
6745
        """Modifies an existing setting.
6746
6747
        Arguments:
6748
            setting_id: UUID of the setting to be changed.
6749
            name: The name of the setting. Either setting_id or name must be
6750
                passed.
6751
            value: The value of the setting.
6752
6753
        Returns:
6754
            The response. See :py:meth:`send_command` for details.
6755
        """
6756
        if not setting_id and not name:
6757
            raise RequiredArgument(
6758
                function=self.modify_setting.__name__,
6759
                argument='setting_id or name argument',
6760
            )
6761
6762
        if value is None:
6763
            raise RequiredArgument(
6764
                function=self.modify_setting.__name__, argument='value argument'
6765
            )
6766
6767
        cmd = XmlCommand("modify_setting")
6768
6769
        if setting_id:
6770
            cmd.set_attribute("setting_id", setting_id)
6771
        else:
6772
            cmd.add_element("name", name)
6773
6774
        cmd.add_element("value", _to_base64(value))
6775
6776
        return self._send_xml_command(cmd)
6777
6778
    def modify_target(
6779
        self,

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 5738-5775 (lines=38) @@
5735
5736
        return self._send_xml_command(cmd)
5737
5738
    def modify_setting(
5739
        self,
5740
        setting_id: Optional[str] = None,
5741
        name: Optional[str] = None,
5742
        value: Optional[str] = None,
5743
    ) -> Any:
5744
        """Modifies an existing setting.
5745
5746
        Arguments:
5747
            setting_id: UUID of the setting to be changed.
5748
            name: The name of the setting. Either setting_id or name must be
5749
                passed.
5750
            value: The value of the setting.
5751
5752
        Returns:
5753
            The response. See :py:meth:`send_command` for details.
5754
        """
5755
        if not setting_id and not name:
5756
            raise RequiredArgument(
5757
                function=self.modify_setting.__name__,
5758
                argument='setting_id or name argument',
5759
            )
5760
5761
        if value is None:
5762
            raise RequiredArgument(
5763
                function=self.modify_setting.__name__, argument='value argument'
5764
            )
5765
5766
        cmd = XmlCommand("modify_setting")
5767
5768
        if setting_id:
5769
            cmd.set_attribute("setting_id", setting_id)
5770
        else:
5771
            cmd.add_element("name", name)
5772
5773
        cmd.add_element("value", _to_base64(value))
5774
5775
        return self._send_xml_command(cmd)
5776
5777
    def modify_tag(
5778
        self,