Code Duplication    Length = 30-31 lines in 3 locations

gvm/protocols/gmpv7/gmpv7.py 3 locations

@@ 3876-3906 (lines=31) @@
3873
        cmd.set_attribute("role_id", role_id)
3874
        return self._send_xml_command(cmd)
3875
3876
    def get_scanners(
3877
        self,
3878
        *,
3879
        filter: Optional[str] = None,
3880
        filter_id: Optional[str] = None,
3881
        trash: Optional[bool] = None,
3882
        details: Optional[bool] = None
3883
    ) -> Any:
3884
        """Request a list of scanners
3885
3886
        Arguments:
3887
            filter: Filter term to use for the query
3888
            filter_id: UUID of an existing filter to use for the query
3889
            trash: Whether to get the trashcan scanners instead
3890
            details:  Whether to include extra details like tasks using this
3891
                scanner
3892
3893
        Returns:
3894
            The response. See :py:meth:`send_command` for details.
3895
        """
3896
        cmd = XmlCommand("get_scanners")
3897
3898
        _add_filter(cmd, filter, filter_id)
3899
3900
        if trash is not None:
3901
            cmd.set_attribute("trash", _to_bool(trash))
3902
3903
        if details is not None:
3904
            cmd.set_attribute("details", _to_bool(details))
3905
3906
        return self._send_xml_command(cmd)
3907
3908
    def get_scanner(self, scanner_id: str) -> Any:
3909
        """Request a single scanner
@@ 3393-3422 (lines=30) @@
3390
3391
        return self._send_xml_command(cmd)
3392
3393
    def get_overrides(
3394
        self,
3395
        *,
3396
        filter: Optional[str] = None,
3397
        filter_id: Optional[str] = None,
3398
        details: Optional[bool] = None,
3399
        result: Optional[bool] = None
3400
    ) -> Any:
3401
        """Request a list of overrides
3402
3403
        Arguments:
3404
            filter: Filter term to use for the query
3405
            filter_id: UUID of an existing filter to use for the query
3406
            details: Whether to include full details
3407
            result: Whether to include results using the override
3408
3409
        Returns:
3410
            The response. See :py:meth:`send_command` for details.
3411
        """
3412
        cmd = XmlCommand("get_overrides")
3413
3414
        _add_filter(cmd, filter, filter_id)
3415
3416
        if details is not None:
3417
            cmd.set_attribute("details", _to_bool(details))
3418
3419
        if result is not None:
3420
            cmd.set_attribute("result", _to_bool(result))
3421
3422
        return self._send_xml_command(cmd)
3423
3424
    def get_override(self, override_id: str) -> Any:
3425
        """Request a single override
@@ 3242-3271 (lines=30) @@
3239
3240
        return self._send_xml_command(cmd)
3241
3242
    def get_notes(
3243
        self,
3244
        *,
3245
        filter: Optional[str] = None,
3246
        filter_id: Optional[str] = None,
3247
        details: Optional[bool] = None,
3248
        result: Optional[bool] = None
3249
    ) -> Any:
3250
        """Request a list of notes
3251
3252
        Arguments:
3253
            filter: Filter term to use for the query
3254
            filter_id: UUID of an existing filter to use for the query
3255
            details: Add info about connected results and tasks
3256
            result: Return the details of possible connected results.
3257
3258
        Returns:
3259
            The response. See :py:meth:`send_command` for details.
3260
        """
3261
        cmd = XmlCommand("get_notes")
3262
3263
        _add_filter(cmd, filter, filter_id)
3264
3265
        if details is not None:
3266
            cmd.set_attribute("details", _to_bool(details))
3267
3268
        if result is not None:
3269
            cmd.set_attribute("result", _to_bool(result))
3270
3271
        return self._send_xml_command(cmd)
3272
3273
    def get_note(self, note_id: str) -> Any:
3274
        """Request a single note