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

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