Code Duplication    Length = 54-54 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6579-6632 (lines=54) @@
6576
6577
        return self._send_xml_command(cmd)
6578
6579
    def modify_report_format(
6580
        self,
6581
        report_format_id: Optional[Union[str, ReportFormatType]] = None,
6582
        *,
6583
        active: Optional[bool] = None,
6584
        name: Optional[str] = None,
6585
        summary: Optional[str] = None,
6586
        param_name: Optional[str] = None,
6587
        param_value: Optional[str] = None,
6588
    ) -> Any:
6589
        """Modifies an existing report format.
6590
6591
        Arguments:
6592
            report_format_id: UUID of report format to modify
6593
                              or ReportFormatType (enum)
6594
            active: Whether the report format is active.
6595
            name: The name of the report format.
6596
            summary: A summary of the report format.
6597
            param_name: The name of the param.
6598
            param_value: The value of the param.
6599
6600
        Returns:
6601
            The response. See :py:meth:`send_command` for details.
6602
        """
6603
        if not report_format_id:
6604
            raise RequiredArgument(
6605
                function=self.modify_report_format.__name__,
6606
                argument='report_format_id ',
6607
            )
6608
6609
        cmd = XmlCommand("modify_report_format")
6610
6611
        if isinstance(report_format_id, ReportFormatType):
6612
            report_format_id = report_format_id.value
6613
6614
        cmd.set_attribute("report_format_id", report_format_id)
6615
6616
        if active is not None:
6617
            cmd.add_element("active", _to_bool(active))
6618
6619
        if name:
6620
            cmd.add_element("name", name)
6621
6622
        if summary:
6623
            cmd.add_element("summary", summary)
6624
6625
        if param_name:
6626
            _xmlparam = cmd.add_element("param")
6627
            _xmlparam.add_element("name", param_name)
6628
6629
            if param_value is not None:
6630
                _xmlparam.add_element("value", param_value)
6631
6632
        return self._send_xml_command(cmd)
6633
6634
    def modify_role(
6635
        self,

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 5383-5436 (lines=54) @@
5380
5381
        return self._send_xml_command(cmd)
5382
5383
    def modify_report_format(
5384
        self,
5385
        report_format_id: Optional[Union[str, ReportFormatType]] = None,
5386
        *,
5387
        active: Optional[bool] = None,
5388
        name: Optional[str] = None,
5389
        summary: Optional[str] = None,
5390
        param_name: Optional[str] = None,
5391
        param_value: Optional[str] = None,
5392
    ) -> Any:
5393
        """Modifies an existing report format.
5394
5395
        Arguments:
5396
            report_format_id: UUID of report format to modify
5397
                              or ReportFormatType (enum)
5398
            active: Whether the report format is active.
5399
            name: The name of the report format.
5400
            summary: A summary of the report format.
5401
            param_name: The name of the param.
5402
            param_value: The value of the param.
5403
5404
        Returns:
5405
            The response. See :py:meth:`send_command` for details.
5406
        """
5407
        if not report_format_id:
5408
            raise RequiredArgument(
5409
                function=self.modify_report_format.__name__,
5410
                argument='report_format_id ',
5411
            )
5412
5413
        cmd = XmlCommand("modify_report_format")
5414
5415
        if isinstance(report_format_id, ReportFormatType):
5416
            report_format_id = report_format_id.value
5417
5418
        cmd.set_attribute("report_format_id", report_format_id)
5419
5420
        if active is not None:
5421
            cmd.add_element("active", _to_bool(active))
5422
5423
        if name:
5424
            cmd.add_element("name", name)
5425
5426
        if summary:
5427
            cmd.add_element("summary", summary)
5428
5429
        if param_name:
5430
            _xmlparam = cmd.add_element("param")
5431
            _xmlparam.add_element("name", param_name)
5432
5433
            if param_value is not None:
5434
                _xmlparam.add_element("value", param_value)
5435
5436
        return self._send_xml_command(cmd)
5437
5438
    def modify_role(
5439
        self,