Code Duplication    Length = 27-27 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 3799-3825 (lines=27) @@
3796
        cmd.add_element("copy", report_format_id)
3797
        return self._send_xml_command(cmd)
3798
3799
    def import_report_format(self, report_format: str) -> Any:
3800
        """Import a report format from XML
3801
3802
        Arguments:
3803
            report_format: Report format XML as string to import. This XML must
3804
                contain a :code:`<get_report_formats_response>` root element.
3805
3806
        Returns:
3807
            The response. See :py:meth:`send_command` for details.
3808
        """
3809
        if not report_format:
3810
            raise RequiredArgument(
3811
                function=self.import_report_format.__name__,
3812
                argument='report_format',
3813
            )
3814
3815
        cmd = XmlCommand("create_report_format")
3816
3817
        try:
3818
            cmd.append_xml_str(report_format)
3819
        except etree.XMLSyntaxError as e:
3820
            raise InvalidArgument(
3821
                function=self.import_report_format.__name__,
3822
                argument='report_format',
3823
            ) from e
3824
3825
        return self._send_xml_command(cmd)
3826
3827
    def create_role(
3828
        self,

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,