Code Duplication    Length = 30-33 lines in 4 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 850-882 (lines=33) @@
847
848
        return self._send_xml_command(cmd)
849
850
    def get_tls_certificates(
851
        self,
852
        *,
853
        filter: Optional[str] = None,
854
        filter_id: Optional[str] = None,
855
        include_certificate_data: Optional[bool] = None,
856
        details: Optional[bool] = None,
857
    ) -> Any:
858
        """Request a list of TLS certificates
859
860
        Arguments:
861
            filter: Filter term to use for the query
862
            filter_id: UUID of an existing filter to use for the query
863
            include_certificate_data: Whether to include the certificate data in
864
                the response
865
866
        Returns:
867
            The response. See :py:meth:`send_command` for details.
868
        """
869
870
        cmd = XmlCommand("get_tls_certificates")
871
872
        add_filter(cmd, filter, filter_id)
873
874
        if details is not None:
875
            cmd.set_attribute("details", to_bool(details))
876
877
        if include_certificate_data is not None:
878
            cmd.set_attribute(
879
                "include_certificate_data", to_bool(include_certificate_data)
880
            )
881
882
        return self._send_xml_command(cmd)
883
884
    def get_tls_certificate(self, tls_certificate_id: str) -> Any:
885
        """Request a single TLS certificate
@@ 4208-4238 (lines=31) @@
4205
        cmd.set_attribute("role_id", role_id)
4206
        return self._send_xml_command(cmd)
4207
4208
    def get_scanners(
4209
        self,
4210
        *,
4211
        filter: Optional[str] = None,
4212
        filter_id: Optional[str] = None,
4213
        trash: Optional[bool] = None,
4214
        details: Optional[bool] = None,
4215
    ) -> Any:
4216
        """Request a list of scanners
4217
4218
        Arguments:
4219
            filter: Filter term to use for the query
4220
            filter_id: UUID of an existing filter to use for the query
4221
            trash: Whether to get the trashcan scanners instead
4222
            details:  Whether to include extra details like tasks using this
4223
                scanner
4224
4225
        Returns:
4226
            The response. See :py:meth:`send_command` for details.
4227
        """
4228
        cmd = XmlCommand("get_scanners")
4229
4230
        add_filter(cmd, filter, filter_id)
4231
4232
        if trash is not None:
4233
            cmd.set_attribute("trash", to_bool(trash))
4234
4235
        if details is not None:
4236
            cmd.set_attribute("details", to_bool(details))
4237
4238
        return self._send_xml_command(cmd)
4239
4240
    def get_scanner(self, scanner_id: str) -> Any:
4241
        """Request a single scanner

gvm/protocols/gmpv208/entities/overrides.py 1 location

@@ 162-191 (lines=30) @@
159
160
        return self._send_xml_command(cmd)
161
162
    def get_overrides(
163
        self,
164
        *,
165
        filter: Optional[str] = None,
166
        filter_id: Optional[str] = None,
167
        details: Optional[bool] = None,
168
        result: Optional[bool] = None,
169
    ) -> Any:
170
        """Request a list of overrides
171
172
        Arguments:
173
            filter: Filter term to use for the query
174
            filter_id: UUID of an existing filter to use for the query
175
            details: Whether to include full details
176
            result: Whether to include results using the override
177
178
        Returns:
179
            The response. See :py:meth:`send_command` for details.
180
        """
181
        cmd = XmlCommand("get_overrides")
182
183
        add_filter(cmd, filter, filter_id)
184
185
        if details is not None:
186
            cmd.set_attribute("details", to_bool(details))
187
188
        if result is not None:
189
            cmd.set_attribute("result", to_bool(result))
190
191
        return self._send_xml_command(cmd)
192
193
    def get_override(self, override_id: str) -> Any:
194
        """Request a single override

gvm/protocols/gmpv208/entities/notes.py 1 location

@@ 144-173 (lines=30) @@
141
142
        return self._send_xml_command(cmd)
143
144
    def get_notes(
145
        self,
146
        *,
147
        filter: Optional[str] = None,
148
        filter_id: Optional[str] = None,
149
        details: Optional[bool] = None,
150
        result: Optional[bool] = None,
151
    ) -> Any:
152
        """Request a list of notes
153
154
        Arguments:
155
            filter: Filter term to use for the query
156
            filter_id: UUID of an existing filter to use for the query
157
            details: Add info about connected results and tasks
158
            result: Return the details of possible connected results.
159
160
        Returns:
161
            The response. See :py:meth:`send_command` for details.
162
        """
163
        cmd = XmlCommand("get_notes")
164
165
        add_filter(cmd, filter, filter_id)
166
167
        if details is not None:
168
            cmd.set_attribute("details", to_bool(details))
169
170
        if result is not None:
171
            cmd.set_attribute("result", to_bool(result))
172
173
        return self._send_xml_command(cmd)
174
175
    def get_note(self, note_id: str) -> Any:
176
        """Request a single note