Code Duplication    Length = 35-36 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 2 locations

@@ 2858-2893 (lines=36) @@
2855
2856
        return self._send_xml_command(cmd)
2857
2858
    def get_credentials(
2859
        self,
2860
        *,
2861
        filter: Optional[str] = None,
2862
        filter_id: Optional[str] = None,
2863
        scanners: Optional[bool] = None,
2864
        trash: Optional[bool] = None,
2865
        targets: Optional[bool] = None
2866
    ) -> Any:
2867
        """Request a list of credentials
2868
2869
        Arguments:
2870
            filter: Filter term to use for the query
2871
            filter_id: UUID of an existing filter to use for the query
2872
            scanners: Whether to include a list of scanners using the
2873
                credentials
2874
            trash: Whether to get the trashcan credentials instead
2875
            targets: Whether to include a list of targets using the credentials
2876
2877
        Returns:
2878
            The response. See :py:meth:`send_command` for details.
2879
        """
2880
        cmd = XmlCommand("get_credentials")
2881
2882
        _add_filter(cmd, filter, filter_id)
2883
2884
        if scanners is not None:
2885
            cmd.set_attribute("scanners", _to_bool(scanners))
2886
2887
        if trash is not None:
2888
            cmd.set_attribute("trash", _to_bool(trash))
2889
2890
        if targets is not None:
2891
            cmd.set_attribute("targets", _to_bool(targets))
2892
2893
        return self._send_xml_command(cmd)
2894
2895
    def get_credential(
2896
        self,
@@ 3458-3492 (lines=35) @@
3455
        cmd.set_attribute("permission_id", permission_id)
3456
        return self._send_xml_command(cmd)
3457
3458
    def get_port_lists(
3459
        self,
3460
        *,
3461
        filter: Optional[str] = None,
3462
        filter_id: Optional[str] = None,
3463
        details: Optional[bool] = None,
3464
        targets: Optional[bool] = None,
3465
        trash: Optional[bool] = None
3466
    ) -> Any:
3467
        """Request a list of port lists
3468
3469
        Arguments:
3470
            filter: Filter term to use for the query
3471
            filter_id: UUID of an existing filter to use for the query
3472
            details: Whether to include full port list details
3473
            targets: Whether to include targets using this port list
3474
            trash: Whether to get port lists in the trashcan instead
3475
3476
        Returns:
3477
            The response. See :py:meth:`send_command` for details.
3478
        """
3479
        cmd = XmlCommand("get_port_lists")
3480
3481
        _add_filter(cmd, filter, filter_id)
3482
3483
        if details is not None:
3484
            cmd.set_attribute("details", _to_bool(details))
3485
3486
        if targets is not None:
3487
            cmd.set_attribute("targets", _to_bool(targets))
3488
3489
        if trash is not None:
3490
            cmd.set_attribute("trash", _to_bool(trash))
3491
3492
        return self._send_xml_command(cmd)
3493
3494
    def get_port_list(self, port_list_id: str):
3495
        """Request a single port list