Code Duplication    Length = 25-25 lines in 4 locations

gvm/protocols/gmpv7/__init__.py 3 locations

@@ 3772-3796 (lines=25) @@
3769
        cmd.set_attribute("details", "1")
3770
        return self._send_xml_command(cmd)
3771
3772
    def get_roles(
3773
        self,
3774
        *,
3775
        filter: Optional[str] = None,
3776
        filter_id: Optional[str] = None,
3777
        trash: Optional[bool] = None
3778
    ) -> Any:
3779
        """Request a list of roles
3780
3781
        Arguments:
3782
            filter: Filter term to use for the query
3783
            filter_id: UUID of an existing filter to use for the query
3784
            trash: Whether to get the trashcan roles instead
3785
3786
        Returns:
3787
            The response. See :py:meth:`send_command` for details.
3788
        """
3789
        cmd = XmlCommand("get_roles")
3790
3791
        _add_filter(cmd, filter, filter_id)
3792
3793
        if not trash is None:
3794
            cmd.set_attribute("trash", _to_bool(trash))
3795
3796
        return self._send_xml_command(cmd)
3797
3798
    def get_role(self, role_id: str) -> Any:
3799
        """Request a single role
@@ 3404-3428 (lines=25) @@
3401
        cmd.set_attribute("details", "1")
3402
        return self._send_xml_command(cmd)
3403
3404
    def get_permissions(
3405
        self,
3406
        *,
3407
        filter: Optional[str] = None,
3408
        filter_id: Optional[str] = None,
3409
        trash: Optional[bool] = None
3410
    ) -> Any:
3411
        """Request a list of permissions
3412
3413
        Arguments:
3414
            filter: Filter term to use for the query
3415
            filter_id: UUID of an existing filter to use for the query
3416
            trash: Whether to get permissions in the trashcan instead
3417
3418
        Returns:
3419
            The response. See :py:meth:`send_command` for details.
3420
        """
3421
        cmd = XmlCommand("get_permissions")
3422
3423
        _add_filter(cmd, filter, filter_id)
3424
3425
        if not trash is None:
3426
            cmd.set_attribute("trash", _to_bool(trash))
3427
3428
        return self._send_xml_command(cmd)
3429
3430
    def get_permission(self, permission_id: str) -> Any:
3431
        """Request a single permission
@@ 3072-3096 (lines=25) @@
3069
        cmd.set_attribute("filter_id", filter_id)
3070
        return self._send_xml_command(cmd)
3071
3072
    def get_groups(
3073
        self,
3074
        *,
3075
        filter: Optional[str] = None,
3076
        filter_id: Optional[str] = None,
3077
        trash: Optional[bool] = None
3078
    ) -> Any:
3079
        """Request a list of groups
3080
3081
        Arguments:
3082
            filter: Filter term to use for the query
3083
            filter_id: UUID of an existing filter to use for the query
3084
            trash: Whether to get the trashcan groups instead
3085
3086
        Returns:
3087
            The response. See :py:meth:`send_command` for details.
3088
        """
3089
        cmd = XmlCommand("get_groups")
3090
3091
        _add_filter(cmd, filter, filter_id)
3092
3093
        if not trash is None:
3094
            cmd.set_attribute("trash", _to_bool(trash))
3095
3096
        return self._send_xml_command(cmd)
3097
3098
    def get_group(self, group_id: str) -> Any:
3099
        """Request a single group

gvm/protocols/gmpv8/__init__.py 1 location

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