Code Duplication    Length = 25-25 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 5874-5898 (lines=25) @@
5871
5872
        return self._send_xml_command(cmd)
5873
5874
    def get_target(
5875
        self, target_id: str, *, tasks: Optional[bool] = None
5876
    ) -> Any:
5877
        """Request a single target
5878
5879
        Arguments:
5880
            target_id: UUID of an existing target
5881
            tasks: Whether to include list of tasks that use the target
5882
5883
        Returns:
5884
            The response. See :py:meth:`send_command` for details.
5885
        """
5886
        cmd = XmlCommand("get_targets")
5887
5888
        if not target_id:
5889
            raise RequiredArgument(
5890
                function=self.get_target.__name__, argument='target_id'
5891
            )
5892
5893
        cmd.set_attribute("target_id", target_id)
5894
5895
        if tasks is not None:
5896
            cmd.set_attribute("tasks", _to_bool(tasks))
5897
5898
        return self._send_xml_command(cmd)
5899
5900
    def get_users(
5901
        self, *, filter: Optional[str] = None, filter_id: Optional[str] = None

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,