Code Duplication    Length = 33-33 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 5286-5318 (lines=33) @@
5283
5284
        return self._send_xml_command(cmd)
5285
5286
    def get_preference(
5287
        self,
5288
        name: str,
5289
        *,
5290
        nvt_oid: Optional[str] = None,
5291
        config_id: Optional[str] = None,
5292
    ) -> Any:
5293
        """Request a nvt preference
5294
5295
        Arguments:
5296
            name: name of a particular preference
5297
            nvt_oid: OID of nvt
5298
            config_id: UUID of scan config of which to show preference values
5299
5300
        Returns:
5301
            The response. See :py:meth:`send_command` for details.
5302
        """
5303
        cmd = XmlCommand("get_preferences")
5304
5305
        if not name:
5306
            raise RequiredArgument(
5307
                function=self.get_preference.__name__, argument='name'
5308
            )
5309
5310
        cmd.set_attribute("preference", name)
5311
5312
        if nvt_oid:
5313
            cmd.set_attribute("nvt_oid", nvt_oid)
5314
5315
        if config_id:
5316
            cmd.set_attribute("config_id", config_id)
5317
5318
        return self._send_xml_command(cmd)
5319
5320
    def get_reports(
5321
        self,

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,