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

@@ 3795-3830 (lines=36) @@
3792
3793
        return self._send_xml_command(cmd)
3794
3795
    def get_credentials(
3796
        self,
3797
        *,
3798
        filter: Optional[str] = None,
3799
        filter_id: Optional[str] = None,
3800
        scanners: Optional[bool] = None,
3801
        trash: Optional[bool] = None,
3802
        targets: Optional[bool] = None,
3803
    ) -> Any:
3804
        """Request a list of credentials
3805
3806
        Arguments:
3807
            filter: Filter term to use for the query
3808
            filter_id: UUID of an existing filter to use for the query
3809
            scanners: Whether to include a list of scanners using the
3810
                credentials
3811
            trash: Whether to get the trashcan credentials instead
3812
            targets: Whether to include a list of targets using the credentials
3813
3814
        Returns:
3815
            The response. See :py:meth:`send_command` for details.
3816
        """
3817
        cmd = XmlCommand("get_credentials")
3818
3819
        add_filter(cmd, filter, filter_id)
3820
3821
        if scanners is not None:
3822
            cmd.set_attribute("scanners", to_bool(scanners))
3823
3824
        if trash is not None:
3825
            cmd.set_attribute("trash", to_bool(trash))
3826
3827
        if targets is not None:
3828
            cmd.set_attribute("targets", to_bool(targets))
3829
3830
        return self._send_xml_command(cmd)
3831
3832
    def get_credential(
3833
        self,