Code Duplication    Length = 36-36 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 143-178 (lines=36) @@
140
            )
141
        )
142
143
    def get_info(self, info_id: str, info_type: InfoType) -> Any:
144
        """Request a single secinfo
145
146
        Arguments:
147
            info_id: UUID of an existing secinfo
148
            info_type: Type must be either CERT_BUND_ADV, CPE, CVE,
149
                DFN_CERT_ADV, OVALDEF, NVT
150
151
        Returns:
152
            The response. See :py:meth:`send_command` for details.
153
        """
154
        if not info_type:
155
            raise RequiredArgument(
156
                function=self.get_info.__name__, argument='info_type'
157
            )
158
159
        if not isinstance(info_type, InfoType):
160
            raise InvalidArgumentType(
161
                function=self.get_info.__name__,
162
                argument='info_type',
163
                arg_type=InfoType.__name__,
164
            )
165
166
        if not info_id:
167
            raise RequiredArgument(
168
                function=self.get_info.__name__, argument='info_id'
169
            )
170
171
        cmd = XmlCommand("get_info")
172
        cmd.set_attribute("info_id", info_id)
173
174
        cmd.set_attribute("type", info_type.value)
175
176
        # for single entity always request all details
177
        cmd.set_attribute("details", "1")
178
        return self._send_xml_command(cmd)
179
180
    def create_target(
181
        self,

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