Code Duplication    Length = 38-38 lines in 2 locations

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,

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6771-6808 (lines=38) @@
6768
6769
        return self._send_xml_command(cmd)
6770
6771
    def modify_setting(
6772
        self,
6773
        setting_id: Optional[str] = None,
6774
        name: Optional[str] = None,
6775
        value: Optional[str] = None,
6776
    ) -> Any:
6777
        """Modifies an existing setting.
6778
6779
        Arguments:
6780
            setting_id: UUID of the setting to be changed.
6781
            name: The name of the setting. Either setting_id or name must be
6782
                passed.
6783
            value: The value of the setting.
6784
6785
        Returns:
6786
            The response. See :py:meth:`send_command` for details.
6787
        """
6788
        if not setting_id and not name:
6789
            raise RequiredArgument(
6790
                function=self.modify_setting.__name__,
6791
                argument='setting_id or name argument',
6792
            )
6793
6794
        if value is None:
6795
            raise RequiredArgument(
6796
                function=self.modify_setting.__name__, argument='value argument'
6797
            )
6798
6799
        cmd = XmlCommand("modify_setting")
6800
6801
        if setting_id:
6802
            cmd.set_attribute("setting_id", setting_id)
6803
        else:
6804
            cmd.add_element("name", name)
6805
6806
        cmd.add_element("value", _to_base64(value))
6807
6808
        return self._send_xml_command(cmd)
6809
6810
    def modify_target(
6811
        self,