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

@@ 3214-3249 (lines=36) @@
3211
3212
        return self._send_xml_command(cmd)
3213
3214
    def get_info(self, info_id: str, info_type: InfoType) -> Any:
3215
        """Request a single secinfo
3216
3217
        Arguments:
3218
            info_id: UUID of an existing secinfo
3219
            info_type: Type must be either CERT_BUND_ADV, CPE, CVE,
3220
                DFN_CERT_ADV, OVALDEF, NVT or ALLINFO
3221
3222
        Returns:
3223
            The response. See :py:meth:`send_command` for details.
3224
        """
3225
        cmd = XmlCommand("get_info")
3226
3227
        if not info_type:
3228
            raise RequiredArgument(
3229
                function=self.get_info.__name__, argument='info_type'
3230
            )
3231
3232
        if not isinstance(info_type, InfoType):
3233
            raise InvalidArgumentType(
3234
                function=self.get_info.__name__,
3235
                argument='info_type',
3236
                arg_type=InfoType.__name__,
3237
            )
3238
3239
        if not info_id:
3240
            raise RequiredArgument(
3241
                function=self.get_info.__name__, argument='info_id'
3242
            )
3243
3244
        cmd.set_attribute("info_id", info_id)
3245
3246
        cmd.set_attribute("type", info_type.value)
3247
3248
        # for single entity always request all details
3249
        cmd.set_attribute("details", "1")
3250
3251
        return self._send_xml_command(cmd)
3252