Code Duplication    Length = 25-25 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 4240-4264 (lines=25) @@
4237
4238
        return self._send_xml_command(cmd)
4239
4240
    def get_target(
4241
        self, target_id: str, *, tasks: Optional[bool] = None
4242
    ) -> Any:
4243
        """Request a single target
4244
4245
        Arguments:
4246
            target_id: UUID of an existing target
4247
            tasks: Whether to include list of tasks that use the target
4248
4249
        Returns:
4250
            The response. See :py:meth:`send_command` for details.
4251
        """
4252
        cmd = XmlCommand("get_targets")
4253
4254
        if not target_id:
4255
            raise RequiredArgument(
4256
                function=self.get_target.__name__, argument='target_id'
4257
            )
4258
4259
        cmd.set_attribute("target_id", target_id)
4260
4261
        if tasks is not None:
4262
            cmd.set_attribute("tasks", _to_bool(tasks))
4263
4264
        return self._send_xml_command(cmd)
4265
4266
    def get_tasks(
4267
        self,

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 5906-5930 (lines=25) @@
5903
5904
        return self._send_xml_command(cmd)
5905
5906
    def get_target(
5907
        self, target_id: str, *, tasks: Optional[bool] = None
5908
    ) -> Any:
5909
        """Request a single target
5910
5911
        Arguments:
5912
            target_id: UUID of an existing target
5913
            tasks: Whether to include list of tasks that use the target
5914
5915
        Returns:
5916
            The response. See :py:meth:`send_command` for details.
5917
        """
5918
        cmd = XmlCommand("get_targets")
5919
5920
        if not target_id:
5921
            raise RequiredArgument(
5922
                function=self.get_target.__name__, argument='target_id'
5923
            )
5924
5925
        cmd.set_attribute("target_id", target_id)
5926
5927
        if tasks is not None:
5928
            cmd.set_attribute("tasks", _to_bool(tasks))
5929
5930
        return self._send_xml_command(cmd)
5931
5932
    def get_users(
5933
        self, *, filter: Optional[str] = None, filter_id: Optional[str] = None