Code Duplication    Length = 27-27 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 1384-1410 (lines=27) @@
1381
        cmd.add_element("copy", report_format_id)
1382
        return self._send_xml_command(cmd)
1383
1384
    def import_report_format(self, report_format: str) -> Any:
1385
        """Import a report format from XML
1386
1387
        Arguments:
1388
            report_format: Report format XML as string to import. This XML must
1389
                contain a :code:`<get_report_formats_response>` root element.
1390
1391
        Returns:
1392
            The response. See :py:meth:`send_command` for details.
1393
        """
1394
        if not report_format:
1395
            raise RequiredArgument(
1396
                function=self.import_report_format.__name__,
1397
                argument='report_format',
1398
            )
1399
1400
        cmd = XmlCommand("create_report_format")
1401
1402
        try:
1403
            cmd.append_xml_str(report_format)
1404
        except etree.XMLSyntaxError as e:
1405
            raise InvalidArgument(
1406
                function=self.import_report_format.__name__,
1407
                argument='report_format',
1408
            ) from e
1409
1410
        return self._send_xml_command(cmd)
1411
1412
    def create_role(
1413
        self,

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 3831-3857 (lines=27) @@
3828
        cmd.add_element("copy", report_format_id)
3829
        return self._send_xml_command(cmd)
3830
3831
    def import_report_format(self, report_format: str) -> Any:
3832
        """Import a report format from XML
3833
3834
        Arguments:
3835
            report_format: Report format XML as string to import. This XML must
3836
                contain a :code:`<get_report_formats_response>` root element.
3837
3838
        Returns:
3839
            The response. See :py:meth:`send_command` for details.
3840
        """
3841
        if not report_format:
3842
            raise RequiredArgument(
3843
                function=self.import_report_format.__name__,
3844
                argument='report_format',
3845
            )
3846
3847
        cmd = XmlCommand("create_report_format")
3848
3849
        try:
3850
            cmd.append_xml_str(report_format)
3851
        except etree.XMLSyntaxError as e:
3852
            raise InvalidArgument(
3853
                function=self.import_report_format.__name__,
3854
                argument='report_format',
3855
            ) from e
3856
3857
        return self._send_xml_command(cmd)
3858
3859
    def create_role(
3860
        self,