Code Duplication    Length = 36-36 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

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

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 3175-3210 (lines=36) @@
3172
3173
        return self._send_xml_command(cmd)
3174
3175
    def get_info(self, info_id: str, info_type: InfoType) -> Any:
3176
        """Request a single secinfo
3177
3178
        Arguments:
3179
            info_id: UUID of an existing secinfo
3180
            info_type: Type must be either CERT_BUND_ADV, CPE, CVE,
3181
                DFN_CERT_ADV, OVALDEF, NVT or ALLINFO
3182
3183
        Returns:
3184
            The response. See :py:meth:`send_command` for details.
3185
        """
3186
        if not info_type:
3187
            raise RequiredArgument(
3188
                function=self.get_info.__name__, argument='info_type'
3189
            )
3190
3191
        if not isinstance(info_type, InfoType):
3192
            raise InvalidArgumentType(
3193
                function=self.get_info.__name__,
3194
                argument='info_type',
3195
                arg_type=InfoType.__name__,
3196
            )
3197
3198
        if not info_id:
3199
            raise RequiredArgument(
3200
                function=self.get_info.__name__, argument='info_id'
3201
            )
3202
3203
        cmd = XmlCommand("get_info")
3204
        cmd.set_attribute("info_id", info_id)
3205
3206
        cmd.set_attribute("type", info_type.value)
3207
3208
        # for single entity always request all details
3209
        cmd.set_attribute("details", "1")
3210
        return self._send_xml_command(cmd)
3211
3212
    def get_notes(
3213
        self,