Code Duplication    Length = 30-33 lines in 4 locations

gvm/protocols/gmpv208/gmpv208.py 4 locations

@@ 852-884 (lines=33) @@
849
850
        return self._send_xml_command(cmd)
851
852
    def get_tls_certificates(
853
        self,
854
        *,
855
        filter: Optional[str] = None,
856
        filter_id: Optional[str] = None,
857
        include_certificate_data: Optional[bool] = None,
858
        details: Optional[bool] = None,
859
    ) -> Any:
860
        """Request a list of TLS certificates
861
862
        Arguments:
863
            filter: Filter term to use for the query
864
            filter_id: UUID of an existing filter to use for the query
865
            include_certificate_data: Whether to include the certificate data in
866
                the response
867
868
        Returns:
869
            The response. See :py:meth:`send_command` for details.
870
        """
871
872
        cmd = XmlCommand("get_tls_certificates")
873
874
        add_filter(cmd, filter, filter_id)
875
876
        if details is not None:
877
            cmd.set_attribute("details", to_bool(details))
878
879
        if include_certificate_data is not None:
880
            cmd.set_attribute(
881
                "include_certificate_data", to_bool(include_certificate_data)
882
            )
883
884
        return self._send_xml_command(cmd)
885
886
    def get_tls_certificate(self, tls_certificate_id: str) -> Any:
887
        """Request a single TLS certificate
@@ 4558-4588 (lines=31) @@
4555
        cmd.set_attribute("role_id", role_id)
4556
        return self._send_xml_command(cmd)
4557
4558
    def get_scanners(
4559
        self,
4560
        *,
4561
        filter: Optional[str] = None,
4562
        filter_id: Optional[str] = None,
4563
        trash: Optional[bool] = None,
4564
        details: Optional[bool] = None,
4565
    ) -> Any:
4566
        """Request a list of scanners
4567
4568
        Arguments:
4569
            filter: Filter term to use for the query
4570
            filter_id: UUID of an existing filter to use for the query
4571
            trash: Whether to get the trashcan scanners instead
4572
            details:  Whether to include extra details like tasks using this
4573
                scanner
4574
4575
        Returns:
4576
            The response. See :py:meth:`send_command` for details.
4577
        """
4578
        cmd = XmlCommand("get_scanners")
4579
4580
        add_filter(cmd, filter, filter_id)
4581
4582
        if trash is not None:
4583
            cmd.set_attribute("trash", to_bool(trash))
4584
4585
        if details is not None:
4586
            cmd.set_attribute("details", to_bool(details))
4587
4588
        return self._send_xml_command(cmd)
4589
4590
    def get_scanner(self, scanner_id: str) -> Any:
4591
        """Request a single scanner
@@ 4285-4314 (lines=30) @@
4282
        cmd.set_attribute("details", "1")
4283
        return self._send_xml_command(cmd)
4284
4285
    def get_overrides(
4286
        self,
4287
        *,
4288
        filter: Optional[str] = None,
4289
        filter_id: Optional[str] = None,
4290
        details: Optional[bool] = None,
4291
        result: Optional[bool] = None,
4292
    ) -> Any:
4293
        """Request a list of overrides
4294
4295
        Arguments:
4296
            filter: Filter term to use for the query
4297
            filter_id: UUID of an existing filter to use for the query
4298
            details: Whether to include full details
4299
            result: Whether to include results using the override
4300
4301
        Returns:
4302
            The response. See :py:meth:`send_command` for details.
4303
        """
4304
        cmd = XmlCommand("get_overrides")
4305
4306
        add_filter(cmd, filter, filter_id)
4307
4308
        if details is not None:
4309
            cmd.set_attribute("details", to_bool(details))
4310
4311
        if result is not None:
4312
            cmd.set_attribute("result", to_bool(result))
4313
4314
        return self._send_xml_command(cmd)
4315
4316
    def get_override(self, override_id: str) -> Any:
4317
        """Request a single override
@@ 4233-4262 (lines=30) @@
4230
        cmd.set_attribute("group_id", group_id)
4231
        return self._send_xml_command(cmd)
4232
4233
    def get_notes(
4234
        self,
4235
        *,
4236
        filter: Optional[str] = None,
4237
        filter_id: Optional[str] = None,
4238
        details: Optional[bool] = None,
4239
        result: Optional[bool] = None,
4240
    ) -> Any:
4241
        """Request a list of notes
4242
4243
        Arguments:
4244
            filter: Filter term to use for the query
4245
            filter_id: UUID of an existing filter to use for the query
4246
            details: Add info about connected results and tasks
4247
            result: Return the details of possible connected results.
4248
4249
        Returns:
4250
            The response. See :py:meth:`send_command` for details.
4251
        """
4252
        cmd = XmlCommand("get_notes")
4253
4254
        add_filter(cmd, filter, filter_id)
4255
4256
        if details is not None:
4257
            cmd.set_attribute("details", to_bool(details))
4258
4259
        if result is not None:
4260
            cmd.set_attribute("result", to_bool(result))
4261
4262
        return self._send_xml_command(cmd)
4263
4264
    def get_note(self, note_id: str) -> Any:
4265
        """Request a single note