Code Duplication    Length = 36-36 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 3277-3312 (lines=36) @@
3274
3275
        return self._send_xml_command(cmd)
3276
3277
    def get_info(self, info_id: str, info_type: InfoType) -> Any:
3278
        """Request a single secinfo
3279
3280
        Arguments:
3281
            info_id: UUID of an existing secinfo
3282
            info_type: Type must be either CERT_BUND_ADV, CPE, CVE,
3283
                DFN_CERT_ADV, OVALDEF, NVT or ALLINFO
3284
3285
        Returns:
3286
            The response. See :py:meth:`send_command` for details.
3287
        """
3288
        cmd = XmlCommand("get_info")
3289
3290
        if not info_type:
3291
            raise RequiredArgument(
3292
                function=self.get_info.__name__, argument='info_type'
3293
            )
3294
3295
        if not isinstance(info_type, InfoType):
3296
            raise InvalidArgumentType(
3297
                function=self.get_info.__name__,
3298
                argument='info_type',
3299
                arg_type=InfoType.__name__,
3300
            )
3301
3302
        if not info_id:
3303
            raise RequiredArgument(
3304
                function=self.get_info.__name__, argument='info_id'
3305
            )
3306
3307
        cmd.set_attribute("info_id", info_id)
3308
3309
        cmd.set_attribute("type", info_type.value)
3310
3311
        # for single entity always request all details
3312
        cmd.set_attribute("details", "1")
3313
3314
        return self._send_xml_command(cmd)
3315

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 2316-2351 (lines=36) @@
2313
2314
        return self._send_xml_command(cmd)
2315
2316
    def get_info(self, info_id: str, info_type: InfoType) -> Any:
2317
        """Request a single secinfo
2318
2319
        Arguments:
2320
            info_id: UUID of an existing secinfo
2321
            info_type: Type must be either CERT_BUND_ADV, CPE, CVE,
2322
                DFN_CERT_ADV, OVALDEF, NVT
2323
2324
        Returns:
2325
            The response. See :py:meth:`send_command` for details.
2326
        """
2327
        if not info_type:
2328
            raise RequiredArgument(
2329
                function=self.get_info.__name__, argument='info_type'
2330
            )
2331
2332
        if not isinstance(info_type, InfoType):
2333
            raise InvalidArgumentType(
2334
                function=self.get_info.__name__,
2335
                argument='info_type',
2336
                arg_type=InfoType.__name__,
2337
            )
2338
2339
        if not info_id:
2340
            raise RequiredArgument(
2341
                function=self.get_info.__name__, argument='info_id'
2342
            )
2343
2344
        cmd = XmlCommand("get_info")
2345
        cmd.set_attribute("info_id", info_id)
2346
2347
        cmd.set_attribute("type", info_type.value)
2348
2349
        # for single entity always request all details
2350
        cmd.set_attribute("details", "1")
2351
        return self._send_xml_command(cmd)
2352
2353
    def create_target(
2354
        self,