Code Duplication    Length = 29-31 lines in 6 locations

gvm/protocols/gmpv7/__init__.py 6 locations

@@ 3816-3846 (lines=31) @@
3813
        cmd.set_attribute("role_id", role_id)
3814
        return self._send_xml_command(cmd)
3815
3816
    def get_scanners(
3817
        self,
3818
        *,
3819
        filter: Optional[str] = None,
3820
        filter_id: Optional[str] = None,
3821
        trash: Optional[bool] = None,
3822
        details: Optional[bool] = None
3823
    ) -> Any:
3824
        """Request a list of scanners
3825
3826
        Arguments:
3827
            filter: Filter term to use for the query
3828
            filter_id: UUID of an existing filter to use for the query
3829
            trash: Whether to get the trashcan scanners instead
3830
            details:  Whether to include extra details like tasks using this
3831
                scanner
3832
3833
        Returns:
3834
            The response. See :py:meth:`send_command` for details.
3835
        """
3836
        cmd = XmlCommand("get_scanners")
3837
3838
        _add_filter(cmd, filter, filter_id)
3839
3840
        if not trash is None:
3841
            cmd.set_attribute("trash", _to_bool(trash))
3842
3843
        if not details is None:
3844
            cmd.set_attribute("details", _to_bool(details))
3845
3846
        return self._send_xml_command(cmd)
3847
3848
    def get_scanner(self, scanner_id: str) -> Any:
3849
        """Request a single scanner
@@ 4052-4081 (lines=30) @@
4049
        cmd.set_attribute("tag_id", tag_id)
4050
        return self._send_xml_command(cmd)
4051
4052
    def get_targets(
4053
        self,
4054
        *,
4055
        filter: Optional[str] = None,
4056
        filter_id: Optional[str] = None,
4057
        trash: Optional[bool] = None,
4058
        tasks: Optional[bool] = None
4059
    ) -> Any:
4060
        """Request a list of targets
4061
4062
        Arguments:
4063
            filter: Filter term to use for the query
4064
            filter_id: UUID of an existing filter to use for the query
4065
            trash: Whether to get the trashcan targets instead
4066
            tasks: Whether to include list of tasks that use the target
4067
4068
        Returns:
4069
            The response. See :py:meth:`send_command` for details.
4070
        """
4071
        cmd = XmlCommand("get_targets")
4072
4073
        _add_filter(cmd, filter, filter_id)
4074
4075
        if not trash is None:
4076
            cmd.set_attribute("trash", _to_bool(trash))
4077
4078
        if not tasks is None:
4079
            cmd.set_attribute("tasks", _to_bool(tasks))
4080
4081
        return self._send_xml_command(cmd)
4082
4083
    def get_target(self, target_id: str) -> Any:
4084
        """Request a single target
@@ 4003-4032 (lines=30) @@
4000
4001
        return self._send_xml_command(cmd)
4002
4003
    def get_tags(
4004
        self,
4005
        *,
4006
        filter: Optional[str] = None,
4007
        filter_id: Optional[str] = None,
4008
        trash: Optional[bool] = None,
4009
        names_only: Optional[bool] = None
4010
    ) -> Any:
4011
        """Request a list of tags
4012
4013
        Arguments:
4014
            filter: Filter term to use for the query
4015
            filter_id: UUID of an existing filter to use for the query
4016
            trash: Whether to get tags from the trashcan instead
4017
            names_only: Whether to get only distinct tag names
4018
4019
        Returns:
4020
            The response. See :py:meth:`send_command` for details.
4021
        """
4022
        cmd = XmlCommand("get_tags")
4023
4024
        _add_filter(cmd, filter, filter_id)
4025
4026
        if not trash is None:
4027
            cmd.set_attribute("trash", _to_bool(trash))
4028
4029
        if not names_only is None:
4030
            cmd.set_attribute("names_only", _to_bool(names_only))
4031
4032
        return self._send_xml_command(cmd)
4033
4034
    def get_tag(self, tag_id: str) -> Any:
4035
        """Request a single tag
@@ 3869-3898 (lines=30) @@
3866
        cmd.set_attribute("details", "1")
3867
        return self._send_xml_command(cmd)
3868
3869
    def get_schedules(
3870
        self,
3871
        *,
3872
        filter: Optional[str] = None,
3873
        filter_id: Optional[str] = None,
3874
        trash: Optional[bool] = None,
3875
        tasks: Optional[bool] = None
3876
    ) -> Any:
3877
        """Request a list of schedules
3878
3879
        Arguments:
3880
            filter: Filter term to use for the query
3881
            filter_id: UUID of an existing filter to use for the query
3882
            trash: Whether to get the trashcan schedules instead
3883
            tasks: Whether to include tasks using the schedules
3884
3885
        Returns:
3886
            The response. See :py:meth:`send_command` for details.
3887
        """
3888
        cmd = XmlCommand("get_schedules")
3889
3890
        _add_filter(cmd, filter, filter_id)
3891
3892
        if not trash is None:
3893
            cmd.set_attribute("trash", _to_bool(trash))
3894
3895
        if not tasks is None:
3896
            cmd.set_attribute("tasks", _to_bool(tasks))
3897
3898
        return self._send_xml_command(cmd)
3899
3900
    def get_schedule(self, schedule_id: str) -> Any:
3901
        """Request a single schedule
@@ 3023-3052 (lines=30) @@
3020
3021
        return self._send_xml_command(cmd)
3022
3023
    def get_filters(
3024
        self,
3025
        *,
3026
        filter: Optional[str] = None,
3027
        filter_id: Optional[str] = None,
3028
        trash: Optional[bool] = None,
3029
        alerts: Optional[bool] = None
3030
    ) -> Any:
3031
        """Request a list of filters
3032
3033
        Arguments:
3034
            filter: Filter term to use for the query
3035
            filter_id: UUID of an existing filter to use for the query
3036
            trash: Whether to get the trashcan filters instead
3037
            alerts: Whether to include list of alerts that use the filter.
3038
3039
        Returns:
3040
            The response. See :py:meth:`send_command` for details.
3041
        """
3042
        cmd = XmlCommand("get_filters")
3043
3044
        _add_filter(cmd, filter, filter_id)
3045
3046
        if not trash is None:
3047
            cmd.set_attribute("trash", _to_bool(trash))
3048
3049
        if not alerts is None:
3050
            cmd.set_attribute("alerts", _to_bool(alerts))
3051
3052
        return self._send_xml_command(cmd)
3053
3054
    def get_filter(self, filter_id: str) -> Any:
3055
        """Request a single filter
@@ 2740-2768 (lines=29) @@
2737
        cmd.set_attributes(kwargs)
2738
        return self._send_xml_command(cmd)
2739
2740
    def get_alerts(
2741
        self,
2742
        *,
2743
        filter: Optional[str] = None,
2744
        filter_id: Optional[str] = None,
2745
        trash: Optional[bool] = None,
2746
        tasks: Optional[bool] = None
2747
    ) -> Any:
2748
        """Request a list of alerts
2749
2750
        Arguments:
2751
            filter: Filter term to use for the query
2752
            filter_id: UUID of an existing filter to use for the query
2753
            trash: True to request the alerts in the trashcan
2754
            tasks: Whether to include the tasks using the alerts
2755
        Returns:
2756
            The response. See :py:meth:`send_command` for details.
2757
        """
2758
        cmd = XmlCommand("get_alerts")
2759
2760
        _add_filter(cmd, filter, filter_id)
2761
2762
        if not trash is None:
2763
            cmd.set_attribute("trash", _to_bool(trash))
2764
2765
        if not tasks is None:
2766
            cmd.set_attribute("tasks", _to_bool(tasks))
2767
2768
        return self._send_xml_command(cmd)
2769
2770
    def get_alert(self, alert_id: str) -> Any:
2771
        """Request a single alert