Code Duplication    Length = 54-54 lines in 2 locations

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,

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6611-6664 (lines=54) @@
6608
6609
        return self._send_xml_command(cmd)
6610
6611
    def modify_report_format(
6612
        self,
6613
        report_format_id: Optional[Union[str, ReportFormatType]] = None,
6614
        *,
6615
        active: Optional[bool] = None,
6616
        name: Optional[str] = None,
6617
        summary: Optional[str] = None,
6618
        param_name: Optional[str] = None,
6619
        param_value: Optional[str] = None,
6620
    ) -> Any:
6621
        """Modifies an existing report format.
6622
6623
        Arguments:
6624
            report_format_id: UUID of report format to modify
6625
                              or ReportFormatType (enum)
6626
            active: Whether the report format is active.
6627
            name: The name of the report format.
6628
            summary: A summary of the report format.
6629
            param_name: The name of the param.
6630
            param_value: The value of the param.
6631
6632
        Returns:
6633
            The response. See :py:meth:`send_command` for details.
6634
        """
6635
        if not report_format_id:
6636
            raise RequiredArgument(
6637
                function=self.modify_report_format.__name__,
6638
                argument='report_format_id ',
6639
            )
6640
6641
        cmd = XmlCommand("modify_report_format")
6642
6643
        if isinstance(report_format_id, ReportFormatType):
6644
            report_format_id = report_format_id.value
6645
6646
        cmd.set_attribute("report_format_id", report_format_id)
6647
6648
        if active is not None:
6649
            cmd.add_element("active", _to_bool(active))
6650
6651
        if name:
6652
            cmd.add_element("name", name)
6653
6654
        if summary:
6655
            cmd.add_element("summary", summary)
6656
6657
        if param_name:
6658
            _xmlparam = cmd.add_element("param")
6659
            _xmlparam.add_element("name", param_name)
6660
6661
            if param_value is not None:
6662
                _xmlparam.add_element("value", param_value)
6663
6664
        return self._send_xml_command(cmd)
6665
6666
    def modify_role(
6667
        self,