hiddenlayer-sdk 1.2.2__py3-none-any.whl → 2.0.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. hiddenlayer/__init__.py +0 -10
  2. hiddenlayer/sdk/exceptions.py +1 -1
  3. hiddenlayer/sdk/models.py +2 -3
  4. hiddenlayer/sdk/rest/__init__.py +16 -11
  5. hiddenlayer/sdk/rest/api/__init__.py +0 -1
  6. hiddenlayer/sdk/rest/api/model_supply_chain_api.py +1706 -571
  7. hiddenlayer/sdk/rest/api/sensor_api.py +214 -1320
  8. hiddenlayer/sdk/rest/models/__init__.py +16 -10
  9. hiddenlayer/sdk/rest/models/{scan_model_request.py → begin_multi_file_upload200_response.py} +9 -9
  10. hiddenlayer/sdk/rest/models/{get_multipart_upload_response.py → begin_multipart_file_upload200_response.py} +9 -9
  11. hiddenlayer/sdk/rest/models/{multipart_upload_part.py → begin_multipart_file_upload200_response_parts_inner.py} +11 -10
  12. hiddenlayer/sdk/rest/models/errors_inner.py +91 -0
  13. hiddenlayer/sdk/rest/models/file_details_v3.py +8 -2
  14. hiddenlayer/sdk/rest/models/{scan_results_v2.py → file_result_v3.py} +21 -32
  15. hiddenlayer/sdk/rest/models/{model_scan_api_v3_scan_query200_response.py → get_condensed_model_scan_reports200_response.py} +4 -4
  16. hiddenlayer/sdk/rest/models/inventory_v3.py +97 -0
  17. hiddenlayer/sdk/rest/models/model_inventory_info.py +1 -1
  18. hiddenlayer/sdk/rest/models/{detections.py → multi_file_upload_request_v3.py} +14 -22
  19. hiddenlayer/sdk/rest/models/{model_scan_api_v3_scan_model_version_id_patch200_response.py → notify_model_scan_completed200_response.py} +4 -4
  20. hiddenlayer/sdk/rest/models/pagination_v3.py +95 -0
  21. hiddenlayer/sdk/rest/models/problem_details.py +103 -0
  22. hiddenlayer/sdk/rest/models/scan_detection_v31.py +155 -0
  23. hiddenlayer/sdk/rest/models/scan_model_details_v3.py +1 -1
  24. hiddenlayer/sdk/rest/models/scan_results_map_v3.py +105 -0
  25. hiddenlayer/sdk/rest/models/scan_results_v3.py +120 -0
  26. hiddenlayer/sdk/rest/models/{model.py → sensor.py} +4 -4
  27. hiddenlayer/sdk/rest/models/{model_query_response.py → sensor_query_response.py} +7 -7
  28. hiddenlayer/sdk/services/aidr_predictive.py +57 -3
  29. hiddenlayer/sdk/services/model_scan.py +94 -132
  30. hiddenlayer/sdk/version.py +1 -1
  31. {hiddenlayer_sdk-1.2.2.dist-info → hiddenlayer_sdk-2.0.1.dist-info}/METADATA +12 -2
  32. {hiddenlayer_sdk-1.2.2.dist-info → hiddenlayer_sdk-2.0.1.dist-info}/RECORD +35 -31
  33. hiddenlayer/sdk/rest/api/model_scan_api.py +0 -591
  34. hiddenlayer/sdk/rest/models/scan_results.py +0 -118
  35. hiddenlayer/sdk/services/model.py +0 -149
  36. {hiddenlayer_sdk-1.2.2.dist-info → hiddenlayer_sdk-2.0.1.dist-info}/LICENSE +0 -0
  37. {hiddenlayer_sdk-1.2.2.dist-info → hiddenlayer_sdk-2.0.1.dist-info}/WHEEL +0 -0
  38. {hiddenlayer_sdk-1.2.2.dist-info → hiddenlayer_sdk-2.0.1.dist-info}/top_level.txt +0 -0
@@ -1,591 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer ModelScan V2
5
-
6
- HiddenLayer ModelScan API for scanning of models
7
-
8
- The version of the OpenAPI document: 1
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
- import warnings
15
- from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
- from typing import Any, Dict, List, Optional, Tuple, Union
17
- from typing_extensions import Annotated
18
-
19
- from pydantic import Field, StrictStr
20
- from typing import Optional
21
- from typing_extensions import Annotated
22
- from hiddenlayer.sdk.rest.models.scan_model_request import ScanModelRequest
23
- from hiddenlayer.sdk.rest.models.scan_results_v2 import ScanResultsV2
24
-
25
- from hiddenlayer.sdk.rest.api_client import ApiClient, RequestSerialized
26
- from hiddenlayer.sdk.rest.api_response import ApiResponse
27
- from hiddenlayer.sdk.rest.rest import RESTResponseType
28
-
29
-
30
- class ModelScanApi:
31
- """NOTE: This class is auto generated by OpenAPI Generator
32
- Ref: https://openapi-generator.tech
33
-
34
- Do not edit the class manually.
35
- """
36
-
37
- def __init__(self, api_client=None) -> None:
38
- if api_client is None:
39
- api_client = ApiClient.get_default()
40
- self.api_client = api_client
41
-
42
-
43
- @validate_call
44
- def scan_model(
45
- self,
46
- sensor_id: StrictStr,
47
- scan_model_request: Annotated[Optional[ScanModelRequest], Field(description="Request body for create")] = None,
48
- _request_timeout: Union[
49
- None,
50
- Annotated[StrictFloat, Field(gt=0)],
51
- Tuple[
52
- Annotated[StrictFloat, Field(gt=0)],
53
- Annotated[StrictFloat, Field(gt=0)]
54
- ]
55
- ] = None,
56
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
57
- _content_type: Optional[StrictStr] = None,
58
- _headers: Optional[Dict[StrictStr, Any]] = None,
59
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
60
- ) -> None:
61
- """Scan a model
62
-
63
-
64
- :param sensor_id: (required)
65
- :type sensor_id: str
66
- :param scan_model_request: Request body for create
67
- :type scan_model_request: ScanModelRequest
68
- :param _request_timeout: timeout setting for this request. If one
69
- number provided, it will be total request
70
- timeout. It can also be a pair (tuple) of
71
- (connection, read) timeouts.
72
- :type _request_timeout: int, tuple(int, int), optional
73
- :param _request_auth: set to override the auth_settings for an a single
74
- request; this effectively ignores the
75
- authentication in the spec for a single request.
76
- :type _request_auth: dict, optional
77
- :param _content_type: force content-type for the request.
78
- :type _content_type: str, Optional
79
- :param _headers: set to override the headers for a single
80
- request; this effectively ignores the headers
81
- in the spec for a single request.
82
- :type _headers: dict, optional
83
- :param _host_index: set to override the host_index for a single
84
- request; this effectively ignores the host_index
85
- in the spec for a single request.
86
- :type _host_index: int, optional
87
- :return: Returns the result object.
88
- """ # noqa: E501
89
-
90
- _param = self._scan_model_serialize(
91
- sensor_id=sensor_id,
92
- scan_model_request=scan_model_request,
93
- _request_auth=_request_auth,
94
- _content_type=_content_type,
95
- _headers=_headers,
96
- _host_index=_host_index
97
- )
98
-
99
- _response_types_map: Dict[str, Optional[str]] = {
100
- '201': None,
101
- '400': None,
102
- '422': "ValidationErrorModel",
103
- }
104
- response_data = self.api_client.call_api(
105
- *_param,
106
- _request_timeout=_request_timeout
107
- )
108
- response_data.read()
109
- return self.api_client.response_deserialize(
110
- response_data=response_data,
111
- response_types_map=_response_types_map,
112
- ).data
113
-
114
-
115
- @validate_call
116
- def scan_model_with_http_info(
117
- self,
118
- sensor_id: StrictStr,
119
- scan_model_request: Annotated[Optional[ScanModelRequest], Field(description="Request body for create")] = None,
120
- _request_timeout: Union[
121
- None,
122
- Annotated[StrictFloat, Field(gt=0)],
123
- Tuple[
124
- Annotated[StrictFloat, Field(gt=0)],
125
- Annotated[StrictFloat, Field(gt=0)]
126
- ]
127
- ] = None,
128
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
129
- _content_type: Optional[StrictStr] = None,
130
- _headers: Optional[Dict[StrictStr, Any]] = None,
131
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
132
- ) -> ApiResponse[None]:
133
- """Scan a model
134
-
135
-
136
- :param sensor_id: (required)
137
- :type sensor_id: str
138
- :param scan_model_request: Request body for create
139
- :type scan_model_request: ScanModelRequest
140
- :param _request_timeout: timeout setting for this request. If one
141
- number provided, it will be total request
142
- timeout. It can also be a pair (tuple) of
143
- (connection, read) timeouts.
144
- :type _request_timeout: int, tuple(int, int), optional
145
- :param _request_auth: set to override the auth_settings for an a single
146
- request; this effectively ignores the
147
- authentication in the spec for a single request.
148
- :type _request_auth: dict, optional
149
- :param _content_type: force content-type for the request.
150
- :type _content_type: str, Optional
151
- :param _headers: set to override the headers for a single
152
- request; this effectively ignores the headers
153
- in the spec for a single request.
154
- :type _headers: dict, optional
155
- :param _host_index: set to override the host_index for a single
156
- request; this effectively ignores the host_index
157
- in the spec for a single request.
158
- :type _host_index: int, optional
159
- :return: Returns the result object.
160
- """ # noqa: E501
161
-
162
- _param = self._scan_model_serialize(
163
- sensor_id=sensor_id,
164
- scan_model_request=scan_model_request,
165
- _request_auth=_request_auth,
166
- _content_type=_content_type,
167
- _headers=_headers,
168
- _host_index=_host_index
169
- )
170
-
171
- _response_types_map: Dict[str, Optional[str]] = {
172
- '201': None,
173
- '400': None,
174
- '422': "ValidationErrorModel",
175
- }
176
- response_data = self.api_client.call_api(
177
- *_param,
178
- _request_timeout=_request_timeout
179
- )
180
- response_data.read()
181
- return self.api_client.response_deserialize(
182
- response_data=response_data,
183
- response_types_map=_response_types_map,
184
- )
185
-
186
-
187
- @validate_call
188
- def scan_model_without_preload_content(
189
- self,
190
- sensor_id: StrictStr,
191
- scan_model_request: Annotated[Optional[ScanModelRequest], Field(description="Request body for create")] = None,
192
- _request_timeout: Union[
193
- None,
194
- Annotated[StrictFloat, Field(gt=0)],
195
- Tuple[
196
- Annotated[StrictFloat, Field(gt=0)],
197
- Annotated[StrictFloat, Field(gt=0)]
198
- ]
199
- ] = None,
200
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
201
- _content_type: Optional[StrictStr] = None,
202
- _headers: Optional[Dict[StrictStr, Any]] = None,
203
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
204
- ) -> RESTResponseType:
205
- """Scan a model
206
-
207
-
208
- :param sensor_id: (required)
209
- :type sensor_id: str
210
- :param scan_model_request: Request body for create
211
- :type scan_model_request: ScanModelRequest
212
- :param _request_timeout: timeout setting for this request. If one
213
- number provided, it will be total request
214
- timeout. It can also be a pair (tuple) of
215
- (connection, read) timeouts.
216
- :type _request_timeout: int, tuple(int, int), optional
217
- :param _request_auth: set to override the auth_settings for an a single
218
- request; this effectively ignores the
219
- authentication in the spec for a single request.
220
- :type _request_auth: dict, optional
221
- :param _content_type: force content-type for the request.
222
- :type _content_type: str, Optional
223
- :param _headers: set to override the headers for a single
224
- request; this effectively ignores the headers
225
- in the spec for a single request.
226
- :type _headers: dict, optional
227
- :param _host_index: set to override the host_index for a single
228
- request; this effectively ignores the host_index
229
- in the spec for a single request.
230
- :type _host_index: int, optional
231
- :return: Returns the result object.
232
- """ # noqa: E501
233
-
234
- _param = self._scan_model_serialize(
235
- sensor_id=sensor_id,
236
- scan_model_request=scan_model_request,
237
- _request_auth=_request_auth,
238
- _content_type=_content_type,
239
- _headers=_headers,
240
- _host_index=_host_index
241
- )
242
-
243
- _response_types_map: Dict[str, Optional[str]] = {
244
- '201': None,
245
- '400': None,
246
- '422': "ValidationErrorModel",
247
- }
248
- response_data = self.api_client.call_api(
249
- *_param,
250
- _request_timeout=_request_timeout
251
- )
252
- return response_data.response
253
-
254
-
255
- def _scan_model_serialize(
256
- self,
257
- sensor_id,
258
- scan_model_request,
259
- _request_auth,
260
- _content_type,
261
- _headers,
262
- _host_index,
263
- ) -> RequestSerialized:
264
-
265
- _host = None
266
-
267
- _collection_formats: Dict[str, str] = {
268
- }
269
-
270
- _path_params: Dict[str, str] = {}
271
- _query_params: List[Tuple[str, str]] = []
272
- _header_params: Dict[str, Optional[str]] = _headers or {}
273
- _form_params: List[Tuple[str, str]] = []
274
- _files: Dict[str, Union[str, bytes]] = {}
275
- _body_params: Optional[bytes] = None
276
-
277
- # process the path parameters
278
- if sensor_id is not None:
279
- _path_params['sensor_id'] = sensor_id
280
- # process the query parameters
281
- # process the header parameters
282
- # process the form parameters
283
- # process the body parameter
284
- if scan_model_request is not None:
285
- _body_params = scan_model_request
286
-
287
-
288
- # set the HTTP header `Accept`
289
- _header_params['Accept'] = self.api_client.select_header_accept(
290
- [
291
- 'application/json'
292
- ]
293
- )
294
-
295
- # set the HTTP header `Content-Type`
296
- if _content_type:
297
- _header_params['Content-Type'] = _content_type
298
- else:
299
- _default_content_type = (
300
- self.api_client.select_header_content_type(
301
- [
302
- 'application/json',
303
- 'application/octet-stream'
304
- ]
305
- )
306
- )
307
- if _default_content_type is not None:
308
- _header_params['Content-Type'] = _default_content_type
309
-
310
- # authentication setting
311
- _auth_settings: List[str] = [
312
- 'BearerAuth'
313
- ]
314
-
315
- return self.api_client.param_serialize(
316
- method='POST',
317
- resource_path='/api/v2/submit/sensors/{sensor_id}/scan',
318
- path_params=_path_params,
319
- query_params=_query_params,
320
- header_params=_header_params,
321
- body=_body_params,
322
- post_params=_form_params,
323
- files=_files,
324
- auth_settings=_auth_settings,
325
- collection_formats=_collection_formats,
326
- _host=_host,
327
- _request_auth=_request_auth
328
- )
329
-
330
-
331
-
332
-
333
- @validate_call
334
- def scan_status(
335
- self,
336
- sensor_id: StrictStr,
337
- _request_timeout: Union[
338
- None,
339
- Annotated[StrictFloat, Field(gt=0)],
340
- Tuple[
341
- Annotated[StrictFloat, Field(gt=0)],
342
- Annotated[StrictFloat, Field(gt=0)]
343
- ]
344
- ] = None,
345
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
346
- _content_type: Optional[StrictStr] = None,
347
- _headers: Optional[Dict[StrictStr, Any]] = None,
348
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
349
- ) -> ScanResultsV2:
350
- """Get Status or Result of a Scan
351
-
352
-
353
- :param sensor_id: (required)
354
- :type sensor_id: str
355
- :param _request_timeout: timeout setting for this request. If one
356
- number provided, it will be total request
357
- timeout. It can also be a pair (tuple) of
358
- (connection, read) timeouts.
359
- :type _request_timeout: int, tuple(int, int), optional
360
- :param _request_auth: set to override the auth_settings for an a single
361
- request; this effectively ignores the
362
- authentication in the spec for a single request.
363
- :type _request_auth: dict, optional
364
- :param _content_type: force content-type for the request.
365
- :type _content_type: str, Optional
366
- :param _headers: set to override the headers for a single
367
- request; this effectively ignores the headers
368
- in the spec for a single request.
369
- :type _headers: dict, optional
370
- :param _host_index: set to override the host_index for a single
371
- request; this effectively ignores the host_index
372
- in the spec for a single request.
373
- :type _host_index: int, optional
374
- :return: Returns the result object.
375
- """ # noqa: E501
376
-
377
- _param = self._scan_status_serialize(
378
- sensor_id=sensor_id,
379
- _request_auth=_request_auth,
380
- _content_type=_content_type,
381
- _headers=_headers,
382
- _host_index=_host_index
383
- )
384
-
385
- _response_types_map: Dict[str, Optional[str]] = {
386
- '200': "ScanResultsV2",
387
- '400': None,
388
- '404': None,
389
- }
390
- response_data = self.api_client.call_api(
391
- *_param,
392
- _request_timeout=_request_timeout
393
- )
394
- response_data.read()
395
- return self.api_client.response_deserialize(
396
- response_data=response_data,
397
- response_types_map=_response_types_map,
398
- ).data
399
-
400
-
401
- @validate_call
402
- def scan_status_with_http_info(
403
- self,
404
- sensor_id: StrictStr,
405
- _request_timeout: Union[
406
- None,
407
- Annotated[StrictFloat, Field(gt=0)],
408
- Tuple[
409
- Annotated[StrictFloat, Field(gt=0)],
410
- Annotated[StrictFloat, Field(gt=0)]
411
- ]
412
- ] = None,
413
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
414
- _content_type: Optional[StrictStr] = None,
415
- _headers: Optional[Dict[StrictStr, Any]] = None,
416
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
417
- ) -> ApiResponse[ScanResultsV2]:
418
- """Get Status or Result of a Scan
419
-
420
-
421
- :param sensor_id: (required)
422
- :type sensor_id: str
423
- :param _request_timeout: timeout setting for this request. If one
424
- number provided, it will be total request
425
- timeout. It can also be a pair (tuple) of
426
- (connection, read) timeouts.
427
- :type _request_timeout: int, tuple(int, int), optional
428
- :param _request_auth: set to override the auth_settings for an a single
429
- request; this effectively ignores the
430
- authentication in the spec for a single request.
431
- :type _request_auth: dict, optional
432
- :param _content_type: force content-type for the request.
433
- :type _content_type: str, Optional
434
- :param _headers: set to override the headers for a single
435
- request; this effectively ignores the headers
436
- in the spec for a single request.
437
- :type _headers: dict, optional
438
- :param _host_index: set to override the host_index for a single
439
- request; this effectively ignores the host_index
440
- in the spec for a single request.
441
- :type _host_index: int, optional
442
- :return: Returns the result object.
443
- """ # noqa: E501
444
-
445
- _param = self._scan_status_serialize(
446
- sensor_id=sensor_id,
447
- _request_auth=_request_auth,
448
- _content_type=_content_type,
449
- _headers=_headers,
450
- _host_index=_host_index
451
- )
452
-
453
- _response_types_map: Dict[str, Optional[str]] = {
454
- '200': "ScanResultsV2",
455
- '400': None,
456
- '404': None,
457
- }
458
- response_data = self.api_client.call_api(
459
- *_param,
460
- _request_timeout=_request_timeout
461
- )
462
- response_data.read()
463
- return self.api_client.response_deserialize(
464
- response_data=response_data,
465
- response_types_map=_response_types_map,
466
- )
467
-
468
-
469
- @validate_call
470
- def scan_status_without_preload_content(
471
- self,
472
- sensor_id: StrictStr,
473
- _request_timeout: Union[
474
- None,
475
- Annotated[StrictFloat, Field(gt=0)],
476
- Tuple[
477
- Annotated[StrictFloat, Field(gt=0)],
478
- Annotated[StrictFloat, Field(gt=0)]
479
- ]
480
- ] = None,
481
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
482
- _content_type: Optional[StrictStr] = None,
483
- _headers: Optional[Dict[StrictStr, Any]] = None,
484
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
485
- ) -> RESTResponseType:
486
- """Get Status or Result of a Scan
487
-
488
-
489
- :param sensor_id: (required)
490
- :type sensor_id: str
491
- :param _request_timeout: timeout setting for this request. If one
492
- number provided, it will be total request
493
- timeout. It can also be a pair (tuple) of
494
- (connection, read) timeouts.
495
- :type _request_timeout: int, tuple(int, int), optional
496
- :param _request_auth: set to override the auth_settings for an a single
497
- request; this effectively ignores the
498
- authentication in the spec for a single request.
499
- :type _request_auth: dict, optional
500
- :param _content_type: force content-type for the request.
501
- :type _content_type: str, Optional
502
- :param _headers: set to override the headers for a single
503
- request; this effectively ignores the headers
504
- in the spec for a single request.
505
- :type _headers: dict, optional
506
- :param _host_index: set to override the host_index for a single
507
- request; this effectively ignores the host_index
508
- in the spec for a single request.
509
- :type _host_index: int, optional
510
- :return: Returns the result object.
511
- """ # noqa: E501
512
-
513
- _param = self._scan_status_serialize(
514
- sensor_id=sensor_id,
515
- _request_auth=_request_auth,
516
- _content_type=_content_type,
517
- _headers=_headers,
518
- _host_index=_host_index
519
- )
520
-
521
- _response_types_map: Dict[str, Optional[str]] = {
522
- '200': "ScanResultsV2",
523
- '400': None,
524
- '404': None,
525
- }
526
- response_data = self.api_client.call_api(
527
- *_param,
528
- _request_timeout=_request_timeout
529
- )
530
- return response_data.response
531
-
532
-
533
- def _scan_status_serialize(
534
- self,
535
- sensor_id,
536
- _request_auth,
537
- _content_type,
538
- _headers,
539
- _host_index,
540
- ) -> RequestSerialized:
541
-
542
- _host = None
543
-
544
- _collection_formats: Dict[str, str] = {
545
- }
546
-
547
- _path_params: Dict[str, str] = {}
548
- _query_params: List[Tuple[str, str]] = []
549
- _header_params: Dict[str, Optional[str]] = _headers or {}
550
- _form_params: List[Tuple[str, str]] = []
551
- _files: Dict[str, Union[str, bytes]] = {}
552
- _body_params: Optional[bytes] = None
553
-
554
- # process the path parameters
555
- if sensor_id is not None:
556
- _path_params['sensor_id'] = sensor_id
557
- # process the query parameters
558
- # process the header parameters
559
- # process the form parameters
560
- # process the body parameter
561
-
562
-
563
- # set the HTTP header `Accept`
564
- _header_params['Accept'] = self.api_client.select_header_accept(
565
- [
566
- 'application/json'
567
- ]
568
- )
569
-
570
-
571
- # authentication setting
572
- _auth_settings: List[str] = [
573
- 'BearerAuth'
574
- ]
575
-
576
- return self.api_client.param_serialize(
577
- method='GET',
578
- resource_path='/api/v2/scan/status/{sensor_id}',
579
- path_params=_path_params,
580
- query_params=_query_params,
581
- header_params=_header_params,
582
- body=_body_params,
583
- post_params=_form_params,
584
- files=_files,
585
- auth_settings=_auth_settings,
586
- collection_formats=_collection_formats,
587
- _host=_host,
588
- _request_auth=_request_auth
589
- )
590
-
591
-
@@ -1,118 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer ModelScan V2
5
-
6
- HiddenLayer ModelScan API for scanning of models
7
-
8
- The version of the OpenAPI document: 1
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing import Optional, Set
23
- from typing_extensions import Self
24
-
25
- class ScanResults(BaseModel):
26
- """
27
- ScanResults
28
- """ # noqa: E501
29
- md5: Optional[StrictStr] = None
30
- rds_encoding: Optional[StrictStr] = None
31
- rds_min_reader_version: Optional[StrictStr] = None
32
- rds_version: Optional[StrictStr] = None
33
- rds_writer_version: Optional[StrictStr] = None
34
- sha256: Optional[StrictStr] = None
35
- type: Optional[StrictStr] = None
36
- subtype: Optional[List[StrictStr]] = None
37
- tlsh: Optional[StrictStr] = None
38
- pickle_modules: Optional[List[StrictStr]] = None
39
- additional_properties: Dict[str, Any] = {}
40
- __properties: ClassVar[List[str]] = ["md5", "rds_encoding", "rds_min_reader_version", "rds_version", "rds_writer_version", "sha256", "type", "subtype", "tlsh", "pickle_modules"]
41
-
42
- model_config = ConfigDict(
43
- populate_by_name=True,
44
- validate_assignment=True,
45
- protected_namespaces=(),
46
- )
47
-
48
-
49
- def to_str(self) -> str:
50
- """Returns the string representation of the model using alias"""
51
- return pprint.pformat(self.model_dump(by_alias=True))
52
-
53
- def to_json(self) -> str:
54
- """Returns the JSON representation of the model using alias"""
55
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
- return json.dumps(self.to_dict())
57
-
58
- @classmethod
59
- def from_json(cls, json_str: str) -> Optional[Self]:
60
- """Create an instance of ScanResults from a JSON string"""
61
- return cls.from_dict(json.loads(json_str))
62
-
63
- def to_dict(self) -> Dict[str, Any]:
64
- """Return the dictionary representation of the model using alias.
65
-
66
- This has the following differences from calling pydantic's
67
- `self.model_dump(by_alias=True)`:
68
-
69
- * `None` is only added to the output dict for nullable fields that
70
- were set at model initialization. Other fields with value `None`
71
- are ignored.
72
- * Fields in `self.additional_properties` are added to the output dict.
73
- """
74
- excluded_fields: Set[str] = set([
75
- "additional_properties",
76
- ])
77
-
78
- _dict = self.model_dump(
79
- by_alias=True,
80
- exclude=excluded_fields,
81
- exclude_none=True,
82
- )
83
- # puts key-value pairs in additional_properties in the top level
84
- if self.additional_properties is not None:
85
- for _key, _value in self.additional_properties.items():
86
- _dict[_key] = _value
87
-
88
- return _dict
89
-
90
- @classmethod
91
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
- """Create an instance of ScanResults from a dict"""
93
- if obj is None:
94
- return None
95
-
96
- if not isinstance(obj, dict):
97
- return cls.model_validate(obj)
98
-
99
- _obj = cls.model_validate({
100
- "md5": obj.get("md5"),
101
- "rds_encoding": obj.get("rds_encoding"),
102
- "rds_min_reader_version": obj.get("rds_min_reader_version"),
103
- "rds_version": obj.get("rds_version"),
104
- "rds_writer_version": obj.get("rds_writer_version"),
105
- "sha256": obj.get("sha256"),
106
- "type": obj.get("type"),
107
- "subtype": obj.get("subtype"),
108
- "tlsh": obj.get("tlsh"),
109
- "pickle_modules": obj.get("pickle_modules")
110
- })
111
- # store additional fields in additional_properties
112
- for _key in obj.keys():
113
- if _key not in cls.__properties:
114
- _obj.additional_properties[_key] = obj.get(_key)
115
-
116
- return _obj
117
-
118
-