Code Duplication    Length = 30-31 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 4250-4280 (lines=31) @@
4247
        cmd.set_attribute("role_id", role_id)
4248
        return self._send_xml_command(cmd)
4249
4250
    def get_scanners(
4251
        self,
4252
        *,
4253
        filter: Optional[str] = None,
4254
        filter_id: Optional[str] = None,
4255
        trash: Optional[bool] = None,
4256
        details: Optional[bool] = None
4257
    ) -> Any:
4258
        """Request a list of scanners
4259
4260
        Arguments:
4261
            filter: Filter term to use for the query
4262
            filter_id: UUID of an existing filter to use for the query
4263
            trash: Whether to get the trashcan scanners instead
4264
            details:  Whether to include extra details like tasks using this
4265
                scanner
4266
4267
        Returns:
4268
            The response. See :py:meth:`send_command` for details.
4269
        """
4270
        cmd = XmlCommand("get_scanners")
4271
4272
        _add_filter(cmd, filter, filter_id)
4273
4274
        if not trash is None:
4275
            cmd.set_attribute("trash", _to_bool(trash))
4276
4277
        if not details is None:
4278
            cmd.set_attribute("details", _to_bool(details))
4279
4280
        return self._send_xml_command(cmd)
4281
4282
    def get_scanner(self, scanner_id: str) -> Any:
4283
        """Request a single scanner
@@ 3806-3835 (lines=30) @@
3803
3804
        return self._send_xml_command(cmd)
3805
3806
    def get_overrides(
3807
        self,
3808
        *,
3809
        filter: Optional[str] = None,
3810
        filter_id: Optional[str] = None,
3811
        details: Optional[bool] = None,
3812
        result: Optional[bool] = None
3813
    ) -> Any:
3814
        """Request a list of overrides
3815
3816
        Arguments:
3817
            filter: Filter term to use for the query
3818
            filter_id: UUID of an existing filter to use for the query
3819
            details: Wether to include full details
3820
            result: Wether to include results using the override
3821
3822
        Returns:
3823
            The response. See :py:meth:`send_command` for details.
3824
        """
3825
        cmd = XmlCommand("get_overrides")
3826
3827
        _add_filter(cmd, filter, filter_id)
3828
3829
        if not details is None:
3830
            cmd.set_attribute("details", _to_bool(details))
3831
3832
        if not result is None:
3833
            cmd.set_attribute("result", _to_bool(result))
3834
3835
        return self._send_xml_command(cmd)
3836
3837
    def get_override(self, override_id: str) -> Any:
3838
        """Request a single override
@@ 3660-3689 (lines=30) @@
3657
        cmd.set_attribute("details", "1")
3658
        return self._send_xml_command(cmd)
3659
3660
    def get_notes(
3661
        self,
3662
        *,
3663
        filter: Optional[str] = None,
3664
        filter_id: Optional[str] = None,
3665
        details: Optional[bool] = None,
3666
        result: Optional[bool] = None
3667
    ) -> Any:
3668
        """Request a list of notes
3669
3670
        Arguments:
3671
            filter: Filter term to use for the query
3672
            filter_id: UUID of an existing filter to use for the query
3673
            details: Add info about connected results and tasks
3674
            result: Return the details of possible connected results.
3675
3676
        Returns:
3677
            The response. See :py:meth:`send_command` for details.
3678
        """
3679
        cmd = XmlCommand("get_notes")
3680
3681
        _add_filter(cmd, filter, filter_id)
3682
3683
        if not details is None:
3684
            cmd.set_attribute("details", _to_bool(details))
3685
3686
        if not result is None:
3687
            cmd.set_attribute("result", _to_bool(result))
3688
3689
        return self._send_xml_command(cmd)
3690
3691
    def get_note(self, note_id: str) -> Any:
3692
        """Request a single note