Code Duplication    Length = 25-25 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 3157-3181 (lines=25) @@
3154
3155
        return self._send_xml_command(cmd)
3156
3157
    def get_filter(
3158
        self, filter_id: str, *, alerts: Optional[bool] = None
3159
    ) -> Any:
3160
        """Request a single filter
3161
3162
        Arguments:
3163
            filter_id: UUID of an existing filter
3164
            alerts: Whether to include list of alerts that use the filter.
3165
3166
        Returns:
3167
            The response. See :py:meth:`send_command` for details.
3168
        """
3169
        cmd = XmlCommand("get_filters")
3170
3171
        if not filter_id:
3172
            raise RequiredArgument(
3173
                function=self.get_filter.__name__, argument='filter_id'
3174
            )
3175
3176
        cmd.set_attribute("filter_id", filter_id)
3177
3178
        if alerts is not None:
3179
            cmd.set_attribute("alerts", _to_bool(alerts))
3180
3181
        return self._send_xml_command(cmd)
3182
3183
    def get_groups(
3184
        self,

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 4911-4935 (lines=25) @@
4908
4909
        return self._send_xml_command(cmd)
4910
4911
    def get_filter(
4912
        self, filter_id: str, *, alerts: Optional[bool] = None
4913
    ) -> Any:
4914
        """Request a single filter
4915
4916
        Arguments:
4917
            filter_id: UUID of an existing filter
4918
            alerts: Whether to include list of alerts that use the filter.
4919
4920
        Returns:
4921
            The response. See :py:meth:`send_command` for details.
4922
        """
4923
        cmd = XmlCommand("get_filters")
4924
4925
        if not filter_id:
4926
            raise RequiredArgument(
4927
                function=self.get_filter.__name__, argument='filter_id'
4928
            )
4929
4930
        cmd.set_attribute("filter_id", filter_id)
4931
4932
        if alerts is not None:
4933
            cmd.set_attribute("alerts", _to_bool(alerts))
4934
4935
        return self._send_xml_command(cmd)
4936
4937
    def get_groups(
4938
        self,