Code Duplication    Length = 28-32 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 5363-5394 (lines=32) @@
5360
5361
        return self._send_xml_command(cmd)
5362
5363
    def verify_report_format(
5364
        self, report_format_id: Union[str, ReportFormatType]
5365
    ) -> Any:
5366
        """Verify an existing report format
5367
5368
        Verifies the trust level of an existing report format. It will be
5369
        checked whether the signature of the report format currently matches the
5370
        report format. This includes the script and files used to generate
5371
        reports of this format. It is *not* verified if the report format works
5372
        as expected by the user.
5373
5374
        Arguments:
5375
            report_format_id: UUID of the report format to be verified
5376
                              or ReportFormatType (enum)
5377
5378
        Returns:
5379
            The response. See :py:meth:`send_command` for details.
5380
        """
5381
        if not report_format_id:
5382
            raise RequiredArgument(
5383
                function=self.verify_report_format.__name__,
5384
                argument='report_format_id',
5385
            )
5386
5387
        cmd = XmlCommand("verify_report_format")
5388
5389
        if isinstance(report_format_id, ReportFormatType):
5390
            report_format_id = report_format_id.value
5391
5392
        cmd.set_attribute("report_format_id", report_format_id)
5393
5394
        return self._send_xml_command(cmd)
5395
5396
    def verify_scanner(self, scanner_id: str) -> Any:
5397
        """Verify an existing scanner
@@ 4135-4162 (lines=28) @@
4132
4133
        return self._send_xml_command(cmd)
4134
4135
    def get_report_format(
4136
        self, report_format_id: Union[str, ReportFormatType]
4137
    ) -> Any:
4138
        """Request a single report format
4139
4140
        Arguments:
4141
            report_format_id: UUID of an existing report format
4142
                              or ReportFormatType (enum)
4143
4144
        Returns:
4145
            The response. See :py:meth:`send_command` for details.
4146
        """
4147
        cmd = XmlCommand("get_report_formats")
4148
4149
        if not report_format_id:
4150
            raise RequiredArgument(
4151
                function=self.get_report_format.__name__,
4152
                argument='report_format_id',
4153
            )
4154
4155
        if isinstance(report_format_id, ReportFormatType):
4156
            report_format_id = report_format_id.value
4157
4158
        cmd.set_attribute("report_format_id", report_format_id)
4159
4160
        # for single entity always request all details
4161
        cmd.set_attribute("details", "1")
4162
        return self._send_xml_command(cmd)
4163
4164
    def get_roles(
4165
        self,