Code Duplication    Length = 35-36 lines in 2 locations

gvm/protocols/gmpv208/entities/port_lists.py 1 location

@@ 207-241 (lines=35) @@
204
205
        return self._send_xml_command(cmd)
206
207
    def get_port_lists(
208
        self,
209
        *,
210
        filter: Optional[str] = None,
211
        filter_id: Optional[str] = None,
212
        details: Optional[bool] = None,
213
        targets: Optional[bool] = None,
214
        trash: Optional[bool] = None,
215
    ) -> Any:
216
        """Request a list of port lists
217
218
        Arguments:
219
            filter: Filter term to use for the query
220
            filter_id: UUID of an existing filter to use for the query
221
            details: Whether to include full port list details
222
            targets: Whether to include targets using this port list
223
            trash: Whether to get port lists in the trashcan instead
224
225
        Returns:
226
            The response. See :py:meth:`send_command` for details.
227
        """
228
        cmd = XmlCommand("get_port_lists")
229
230
        add_filter(cmd, filter, filter_id)
231
232
        if details is not None:
233
            cmd.set_attribute("details", to_bool(details))
234
235
        if targets is not None:
236
            cmd.set_attribute("targets", to_bool(targets))
237
238
        if trash is not None:
239
            cmd.set_attribute("trash", to_bool(trash))
240
241
        return self._send_xml_command(cmd)
242
243
    def get_port_list(self, port_list_id: str):
244
        """Request a single port list

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 4040-4075 (lines=36) @@
4037
4038
        return self._send_xml_command(cmd)
4039
4040
    def get_credentials(
4041
        self,
4042
        *,
4043
        filter: Optional[str] = None,
4044
        filter_id: Optional[str] = None,
4045
        scanners: Optional[bool] = None,
4046
        trash: Optional[bool] = None,
4047
        targets: Optional[bool] = None,
4048
    ) -> Any:
4049
        """Request a list of credentials
4050
4051
        Arguments:
4052
            filter: Filter term to use for the query
4053
            filter_id: UUID of an existing filter to use for the query
4054
            scanners: Whether to include a list of scanners using the
4055
                credentials
4056
            trash: Whether to get the trashcan credentials instead
4057
            targets: Whether to include a list of targets using the credentials
4058
4059
        Returns:
4060
            The response. See :py:meth:`send_command` for details.
4061
        """
4062
        cmd = XmlCommand("get_credentials")
4063
4064
        add_filter(cmd, filter, filter_id)
4065
4066
        if scanners is not None:
4067
            cmd.set_attribute("scanners", to_bool(scanners))
4068
4069
        if trash is not None:
4070
            cmd.set_attribute("trash", to_bool(trash))
4071
4072
        if targets is not None:
4073
            cmd.set_attribute("targets", to_bool(targets))
4074
4075
        return self._send_xml_command(cmd)
4076
4077
    def get_credential(
4078
        self,