Code Duplication    Length = 30-31 lines in 3 locations

gvm/protocols/gmpv7/gmpv7.py 3 locations

@@ 3826-3856 (lines=31) @@
3823
        cmd.set_attribute("role_id", role_id)
3824
        return self._send_xml_command(cmd)
3825
3826
    def get_scanners(
3827
        self,
3828
        *,
3829
        filter: Optional[str] = None,
3830
        filter_id: Optional[str] = None,
3831
        trash: Optional[bool] = None,
3832
        details: Optional[bool] = None
3833
    ) -> Any:
3834
        """Request a list of scanners
3835
3836
        Arguments:
3837
            filter: Filter term to use for the query
3838
            filter_id: UUID of an existing filter to use for the query
3839
            trash: Whether to get the trashcan scanners instead
3840
            details:  Whether to include extra details like tasks using this
3841
                scanner
3842
3843
        Returns:
3844
            The response. See :py:meth:`send_command` for details.
3845
        """
3846
        cmd = XmlCommand("get_scanners")
3847
3848
        _add_filter(cmd, filter, filter_id)
3849
3850
        if trash is not None:
3851
            cmd.set_attribute("trash", _to_bool(trash))
3852
3853
        if details is not None:
3854
            cmd.set_attribute("details", _to_bool(details))
3855
3856
        return self._send_xml_command(cmd)
3857
3858
    def get_scanner(self, scanner_id: str) -> Any:
3859
        """Request a single scanner
@@ 3362-3391 (lines=30) @@
3359
3360
        return self._send_xml_command(cmd)
3361
3362
    def get_overrides(
3363
        self,
3364
        *,
3365
        filter: Optional[str] = None,
3366
        filter_id: Optional[str] = None,
3367
        details: Optional[bool] = None,
3368
        result: Optional[bool] = None
3369
    ) -> Any:
3370
        """Request a list of overrides
3371
3372
        Arguments:
3373
            filter: Filter term to use for the query
3374
            filter_id: UUID of an existing filter to use for the query
3375
            details: Whether to include full details
3376
            result: Whether to include results using the override
3377
3378
        Returns:
3379
            The response. See :py:meth:`send_command` for details.
3380
        """
3381
        cmd = XmlCommand("get_overrides")
3382
3383
        _add_filter(cmd, filter, filter_id)
3384
3385
        if details is not None:
3386
            cmd.set_attribute("details", _to_bool(details))
3387
3388
        if result is not None:
3389
            cmd.set_attribute("result", _to_bool(result))
3390
3391
        return self._send_xml_command(cmd)
3392
3393
    def get_override(self, override_id: str) -> Any:
3394
        """Request a single override
@@ 3212-3241 (lines=30) @@
3209
        cmd.set_attribute("details", "1")
3210
        return self._send_xml_command(cmd)
3211
3212
    def get_notes(
3213
        self,
3214
        *,
3215
        filter: Optional[str] = None,
3216
        filter_id: Optional[str] = None,
3217
        details: Optional[bool] = None,
3218
        result: Optional[bool] = None
3219
    ) -> Any:
3220
        """Request a list of notes
3221
3222
        Arguments:
3223
            filter: Filter term to use for the query
3224
            filter_id: UUID of an existing filter to use for the query
3225
            details: Add info about connected results and tasks
3226
            result: Return the details of possible connected results.
3227
3228
        Returns:
3229
            The response. See :py:meth:`send_command` for details.
3230
        """
3231
        cmd = XmlCommand("get_notes")
3232
3233
        _add_filter(cmd, filter, filter_id)
3234
3235
        if details is not None:
3236
            cmd.set_attribute("details", _to_bool(details))
3237
3238
        if result is not None:
3239
            cmd.set_attribute("result", _to_bool(result))
3240
3241
        return self._send_xml_command(cmd)
3242
3243
    def get_note(self, note_id: str) -> Any:
3244
        """Request a single note