Code Duplication    Length = 25-25 lines in 4 locations

gvm/protocols/gmpv7/__init__.py 3 locations

@@ 3563-3587 (lines=25) @@
3560
        cmd.set_attribute("details", "1")
3561
        return self._send_xml_command(cmd)
3562
3563
    def get_roles(
3564
        self,
3565
        *,
3566
        filter: Optional[str] = None,
3567
        filter_id: Optional[str] = None,
3568
        trash: Optional[bool] = None
3569
    ) -> Any:
3570
        """Request a list of roles
3571
3572
        Arguments:
3573
            filter: Filter term to use for the query
3574
            filter_id: UUID of an existing filter to use for the query
3575
            trash: Whether to get the trashcan roles instead
3576
3577
        Returns:
3578
            The response. See :py:meth:`send_command` for details.
3579
        """
3580
        cmd = XmlCommand("get_roles")
3581
3582
        _add_filter(cmd, filter, filter_id)
3583
3584
        if not trash is None:
3585
            cmd.set_attribute("trash", _to_bool(trash))
3586
3587
        return self._send_xml_command(cmd)
3588
3589
    def get_role(self, role_id: str) -> Any:
3590
        """Request a single role
@@ 3213-3237 (lines=25) @@
3210
        cmd.set_attribute("details", "1")
3211
        return self._send_xml_command(cmd)
3212
3213
    def get_permissions(
3214
        self,
3215
        *,
3216
        filter: Optional[str] = None,
3217
        filter_id: Optional[str] = None,
3218
        trash: Optional[bool] = None
3219
    ) -> Any:
3220
        """Request a list of permissions
3221
3222
        Arguments:
3223
            filter: Filter term to use for the query
3224
            filter_id: UUID of an existing filter to use for the query
3225
            trash: Whether to get permissions in the trashcan instead
3226
3227
        Returns:
3228
            The response. See :py:meth:`send_command` for details.
3229
        """
3230
        cmd = XmlCommand("get_permissions")
3231
3232
        _add_filter(cmd, filter, filter_id)
3233
3234
        if not trash is None:
3235
            cmd.set_attribute("trash", _to_bool(trash))
3236
3237
        return self._send_xml_command(cmd)
3238
3239
    def get_permission(self, permission_id: str) -> Any:
3240
        """Request a single permission
@@ 2897-2921 (lines=25) @@
2894
        cmd.set_attribute("filter_id", filter_id)
2895
        return self._send_xml_command(cmd)
2896
2897
    def get_groups(
2898
        self,
2899
        *,
2900
        filter: Optional[str] = None,
2901
        filter_id: Optional[str] = None,
2902
        trash: Optional[bool] = None
2903
    ) -> Any:
2904
        """Request a list of groups
2905
2906
        Arguments:
2907
            filter: Filter term to use for the query
2908
            filter_id: UUID of an existing filter to use for the query
2909
            trash: Whether to get the trashcan groups instead
2910
2911
        Returns:
2912
            The response. See :py:meth:`send_command` for details.
2913
        """
2914
        cmd = XmlCommand("get_groups")
2915
2916
        _add_filter(cmd, filter, filter_id)
2917
2918
        if not trash is None:
2919
            cmd.set_attribute("trash", _to_bool(trash))
2920
2921
        return self._send_xml_command(cmd)
2922
2923
    def get_group(self, group_id: str) -> Any:
2924
        """Request a single group

gvm/protocols/gmpv8/__init__.py 1 location

@@ 744-768 (lines=25) @@
741
742
        return self._send_xml_command(cmd)
743
744
    def get_tickets(
745
        self,
746
        *,
747
        trash: Optional[bool] = None,
748
        filter: Optional[str] = None,
749
        filter_id: Optional[str] = None
750
    ) -> Any:
751
        """Request a list of tickets
752
753
        Arguments:
754
            filter: Filter term to use for the query
755
            filter_id: UUID of an existing filter to use for the query
756
            trash: True to request the tickets in the trashcan
757
758
        Returns:
759
            The response. See :py:meth:`send_command` for details.
760
        """
761
        cmd = XmlCommand("get_tickets")
762
763
        _add_filter(cmd, filter, filter_id)
764
765
        if not trash is None:
766
            cmd.set_attribute("trash", _to_bool(trash))
767
768
        return self._send_xml_command(cmd)
769
770
    def get_ticket(self, ticket_id: str) -> Any:
771
        """Request a single ticket