Code Duplication    Length = 28-28 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 2128-2155 (lines=28) @@
2125
2126
        return self._send_xml_command(cmd)
2127
2128
    def create_container_task(
2129
        self, name: str, *, comment: Optional[str] = None
2130
    ) -> Any:
2131
        """Create a new container task
2132
2133
        A container task is a "meta" task to import and view reports from other
2134
        systems.
2135
2136
        Arguments:
2137
            name: Name of the task
2138
            comment: Comment for the task
2139
2140
        Returns:
2141
            The response. See :py:meth:`send_command` for details.
2142
        """
2143
        if not name:
2144
            raise RequiredArgument(
2145
                function=self.create_container_task.__name__, argument='name'
2146
            )
2147
2148
        cmd = XmlCommand("create_task")
2149
        cmd.add_element("name", name)
2150
        cmd.add_element("target", attrs={"id": "0"})
2151
2152
        if comment:
2153
            cmd.add_element("comment", comment)
2154
2155
        return self._send_xml_command(cmd)
2156
2157
    def clone_task(self, task_id: str) -> Any:
2158
        """Clone an existing task

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 4057-4084 (lines=28) @@
4054
        cmd.add_element("copy", target_id)
4055
        return self._send_xml_command(cmd)
4056
4057
    def create_container_task(
4058
        self, name: str, *, comment: Optional[str] = None
4059
    ) -> Any:
4060
        """Create a new container task
4061
4062
        A container task is a "meta" task to import and view reports from other
4063
        systems.
4064
4065
        Arguments:
4066
            name: Name of the task
4067
            comment: Comment for the task
4068
4069
        Returns:
4070
            The response. See :py:meth:`send_command` for details.
4071
        """
4072
        if not name:
4073
            raise RequiredArgument(
4074
                function=self.create_container_task.__name__, argument='name'
4075
            )
4076
4077
        cmd = XmlCommand("create_task")
4078
        cmd.add_element("name", name)
4079
        cmd.add_element("target", attrs={"id": "0"})
4080
4081
        if comment:
4082
            cmd.add_element("comment", comment)
4083
4084
        return self._send_xml_command(cmd)
4085
4086
    def clone_task(self, task_id: str) -> Any:
4087
        """Clone an existing task