Code Duplication    Length = 33-33 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 3652-3684 (lines=33) @@
3649
3650
        return self._send_xml_command(cmd)
3651
3652
    def get_preference(
3653
        self,
3654
        name: str,
3655
        *,
3656
        nvt_oid: Optional[str] = None,
3657
        config_id: Optional[str] = None,
3658
    ) -> Any:
3659
        """Request a nvt preference
3660
3661
        Arguments:
3662
            name: name of a particular preference
3663
            nvt_oid: OID of nvt
3664
            config_id: UUID of scan config of which to show preference values
3665
3666
        Returns:
3667
            The response. See :py:meth:`send_command` for details.
3668
        """
3669
        cmd = XmlCommand("get_preferences")
3670
3671
        if not name:
3672
            raise RequiredArgument(
3673
                function=self.get_preference.__name__, argument='name'
3674
            )
3675
3676
        cmd.set_attribute("preference", name)
3677
3678
        if nvt_oid:
3679
            cmd.set_attribute("nvt_oid", nvt_oid)
3680
3681
        if config_id:
3682
            cmd.set_attribute("config_id", config_id)
3683
3684
        return self._send_xml_command(cmd)
3685
3686
    def get_reports(
3687
        self,

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 5318-5350 (lines=33) @@
5315
5316
        return self._send_xml_command(cmd)
5317
5318
    def get_preference(
5319
        self,
5320
        name: str,
5321
        *,
5322
        nvt_oid: Optional[str] = None,
5323
        config_id: Optional[str] = None,
5324
    ) -> Any:
5325
        """Request a nvt preference
5326
5327
        Arguments:
5328
            name: name of a particular preference
5329
            nvt_oid: OID of nvt
5330
            config_id: UUID of scan config of which to show preference values
5331
5332
        Returns:
5333
            The response. See :py:meth:`send_command` for details.
5334
        """
5335
        cmd = XmlCommand("get_preferences")
5336
5337
        if not name:
5338
            raise RequiredArgument(
5339
                function=self.get_preference.__name__, argument='name'
5340
            )
5341
5342
        cmd.set_attribute("preference", name)
5343
5344
        if nvt_oid:
5345
            cmd.set_attribute("nvt_oid", nvt_oid)
5346
5347
        if config_id:
5348
            cmd.set_attribute("config_id", config_id)
5349
5350
        return self._send_xml_command(cmd)
5351
5352
    def get_reports(
5353
        self,