Code Duplication    Length = 28-28 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 4025-4052 (lines=28) @@
4022
        cmd.add_element("copy", target_id)
4023
        return self._send_xml_command(cmd)
4024
4025
    def create_container_task(
4026
        self, name: str, *, comment: Optional[str] = None
4027
    ) -> Any:
4028
        """Create a new container task
4029
4030
        A container task is a "meta" task to import and view reports from other
4031
        systems.
4032
4033
        Arguments:
4034
            name: Name of the task
4035
            comment: Comment for the task
4036
4037
        Returns:
4038
            The response. See :py:meth:`send_command` for details.
4039
        """
4040
        if not name:
4041
            raise RequiredArgument(
4042
                function=self.create_container_task.__name__, argument='name'
4043
            )
4044
4045
        cmd = XmlCommand("create_task")
4046
        cmd.add_element("name", name)
4047
        cmd.add_element("target", attrs={"id": "0"})
4048
4049
        if comment:
4050
            cmd.add_element("comment", comment)
4051
4052
        return self._send_xml_command(cmd)
4053
4054
    def clone_task(self, task_id: str) -> Any:
4055
        """Clone an existing task

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