Code Duplication    Length = 35-36 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 2 locations

@@ 2916-2951 (lines=36) @@
2913
2914
        return self._send_xml_command(cmd)
2915
2916
    def get_credentials(
2917
        self,
2918
        *,
2919
        filter: Optional[str] = None,
2920
        filter_id: Optional[str] = None,
2921
        scanners: Optional[bool] = None,
2922
        trash: Optional[bool] = None,
2923
        targets: Optional[bool] = None
2924
    ) -> Any:
2925
        """Request a list of credentials
2926
2927
        Arguments:
2928
            filter: Filter term to use for the query
2929
            filter_id: UUID of an existing filter to use for the query
2930
            scanners: Whether to include a list of scanners using the
2931
                credentials
2932
            trash: Whether to get the trashcan credentials instead
2933
            targets: Whether to include a list of targets using the credentials
2934
2935
        Returns:
2936
            The response. See :py:meth:`send_command` for details.
2937
        """
2938
        cmd = XmlCommand("get_credentials")
2939
2940
        _add_filter(cmd, filter, filter_id)
2941
2942
        if scanners is not None:
2943
            cmd.set_attribute("scanners", _to_bool(scanners))
2944
2945
        if trash is not None:
2946
            cmd.set_attribute("trash", _to_bool(trash))
2947
2948
        if targets is not None:
2949
            cmd.set_attribute("targets", _to_bool(targets))
2950
2951
        return self._send_xml_command(cmd)
2952
2953
    def get_credential(
2954
        self,
@@ 3549-3583 (lines=35) @@
3546
        cmd.set_attribute("permission_id", permission_id)
3547
        return self._send_xml_command(cmd)
3548
3549
    def get_port_lists(
3550
        self,
3551
        *,
3552
        filter: Optional[str] = None,
3553
        filter_id: Optional[str] = None,
3554
        details: Optional[bool] = None,
3555
        targets: Optional[bool] = None,
3556
        trash: Optional[bool] = None
3557
    ) -> Any:
3558
        """Request a list of port lists
3559
3560
        Arguments:
3561
            filter: Filter term to use for the query
3562
            filter_id: UUID of an existing filter to use for the query
3563
            details: Whether to include full port list details
3564
            targets: Whether to include targets using this port list
3565
            trash: Whether to get port lists in the trashcan instead
3566
3567
        Returns:
3568
            The response. See :py:meth:`send_command` for details.
3569
        """
3570
        cmd = XmlCommand("get_port_lists")
3571
3572
        _add_filter(cmd, filter, filter_id)
3573
3574
        if details is not None:
3575
            cmd.set_attribute("details", _to_bool(details))
3576
3577
        if targets is not None:
3578
            cmd.set_attribute("targets", _to_bool(targets))
3579
3580
        if trash is not None:
3581
            cmd.set_attribute("trash", _to_bool(trash))
3582
3583
        return self._send_xml_command(cmd)
3584
3585
    def get_port_list(self, port_list_id: str):
3586
        """Request a single port list