hiddenlayer-sdk 2.0.10__py3-none-any.whl → 3.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. hiddenlayer/__init__.py +109 -114
  2. hiddenlayer/_base_client.py +1995 -0
  3. hiddenlayer/_client.py +761 -0
  4. hiddenlayer/_compat.py +219 -0
  5. hiddenlayer/_constants.py +14 -0
  6. hiddenlayer/_exceptions.py +108 -0
  7. hiddenlayer/_files.py +123 -0
  8. hiddenlayer/_models.py +835 -0
  9. hiddenlayer/_oauth2.py +118 -0
  10. hiddenlayer/_qs.py +150 -0
  11. hiddenlayer/_resource.py +43 -0
  12. hiddenlayer/_response.py +832 -0
  13. hiddenlayer/_streaming.py +333 -0
  14. hiddenlayer/_types.py +260 -0
  15. hiddenlayer/_utils/__init__.py +64 -0
  16. hiddenlayer/_utils/_compat.py +45 -0
  17. hiddenlayer/_utils/_datetime_parse.py +136 -0
  18. hiddenlayer/_utils/_logs.py +25 -0
  19. hiddenlayer/_utils/_proxy.py +65 -0
  20. hiddenlayer/_utils/_reflection.py +42 -0
  21. hiddenlayer/_utils/_resources_proxy.py +24 -0
  22. hiddenlayer/_utils/_streams.py +12 -0
  23. hiddenlayer/_utils/_sync.py +86 -0
  24. hiddenlayer/_utils/_transform.py +457 -0
  25. hiddenlayer/_utils/_typing.py +156 -0
  26. hiddenlayer/_utils/_utils.py +421 -0
  27. hiddenlayer/_version.py +4 -0
  28. hiddenlayer/lib/.keep +4 -0
  29. hiddenlayer/lib/__init__.py +6 -0
  30. hiddenlayer/lib/community_scan.py +174 -0
  31. hiddenlayer/lib/model_scan.py +752 -0
  32. hiddenlayer/lib/scan_utils.py +142 -0
  33. hiddenlayer/pagination.py +127 -0
  34. hiddenlayer/resources/__init__.py +75 -0
  35. hiddenlayer/resources/interactions.py +205 -0
  36. hiddenlayer/resources/models/__init__.py +33 -0
  37. hiddenlayer/resources/models/cards.py +259 -0
  38. hiddenlayer/resources/models/models.py +284 -0
  39. hiddenlayer/resources/prompt_analyzer.py +207 -0
  40. hiddenlayer/resources/scans/__init__.py +61 -0
  41. hiddenlayer/resources/scans/jobs.py +499 -0
  42. hiddenlayer/resources/scans/results.py +169 -0
  43. hiddenlayer/resources/scans/scans.py +166 -0
  44. hiddenlayer/resources/scans/upload/__init__.py +33 -0
  45. hiddenlayer/resources/scans/upload/file.py +279 -0
  46. hiddenlayer/resources/scans/upload/upload.py +340 -0
  47. hiddenlayer/resources/sensors.py +575 -0
  48. hiddenlayer/types/__init__.py +16 -0
  49. hiddenlayer/types/interaction_analyze_params.py +62 -0
  50. hiddenlayer/types/interaction_analyze_response.py +199 -0
  51. hiddenlayer/types/model_retrieve_response.py +50 -0
  52. hiddenlayer/types/models/__init__.py +6 -0
  53. hiddenlayer/types/models/card_list_params.py +65 -0
  54. hiddenlayer/types/models/card_list_response.py +50 -0
  55. hiddenlayer/types/prompt_analyzer_create_params.py +23 -0
  56. hiddenlayer/types/prompt_analyzer_create_response.py +381 -0
  57. hiddenlayer/types/scans/__init__.py +14 -0
  58. hiddenlayer/types/scans/job_list_params.py +75 -0
  59. hiddenlayer/types/scans/job_list_response.py +22 -0
  60. hiddenlayer/types/scans/job_request_params.py +49 -0
  61. hiddenlayer/types/scans/job_retrieve_params.py +16 -0
  62. hiddenlayer/types/scans/result_sarif_response.py +7 -0
  63. hiddenlayer/types/scans/scan_job.py +46 -0
  64. hiddenlayer/types/scans/scan_report.py +367 -0
  65. hiddenlayer/types/scans/upload/__init__.py +6 -0
  66. hiddenlayer/types/scans/upload/file_add_response.py +24 -0
  67. hiddenlayer/types/scans/upload/file_complete_response.py +12 -0
  68. hiddenlayer/types/scans/upload_complete_all_response.py +12 -0
  69. hiddenlayer/types/scans/upload_start_params.py +34 -0
  70. hiddenlayer/types/scans/upload_start_response.py +12 -0
  71. hiddenlayer/types/sensor_create_params.py +24 -0
  72. hiddenlayer/types/sensor_create_response.py +33 -0
  73. hiddenlayer/types/sensor_query_params.py +39 -0
  74. hiddenlayer/types/sensor_query_response.py +43 -0
  75. hiddenlayer/types/sensor_retrieve_response.py +33 -0
  76. hiddenlayer/types/sensor_update_params.py +20 -0
  77. hiddenlayer/types/sensor_update_response.py +9 -0
  78. hiddenlayer_sdk-3.0.0.dist-info/METADATA +431 -0
  79. hiddenlayer_sdk-3.0.0.dist-info/RECORD +82 -0
  80. {hiddenlayer_sdk-2.0.10.dist-info → hiddenlayer_sdk-3.0.0.dist-info}/WHEEL +1 -2
  81. {hiddenlayer_sdk-2.0.10.dist-info → hiddenlayer_sdk-3.0.0.dist-info}/licenses/LICENSE +1 -1
  82. hiddenlayer/sdk/constants.py +0 -26
  83. hiddenlayer/sdk/exceptions.py +0 -12
  84. hiddenlayer/sdk/models.py +0 -58
  85. hiddenlayer/sdk/rest/__init__.py +0 -135
  86. hiddenlayer/sdk/rest/api/__init__.py +0 -10
  87. hiddenlayer/sdk/rest/api/aidr_predictive_api.py +0 -308
  88. hiddenlayer/sdk/rest/api/health_api.py +0 -272
  89. hiddenlayer/sdk/rest/api/model_api.py +0 -559
  90. hiddenlayer/sdk/rest/api/model_supply_chain_api.py +0 -4063
  91. hiddenlayer/sdk/rest/api/readiness_api.py +0 -272
  92. hiddenlayer/sdk/rest/api/sensor_api.py +0 -1432
  93. hiddenlayer/sdk/rest/api_client.py +0 -770
  94. hiddenlayer/sdk/rest/api_response.py +0 -21
  95. hiddenlayer/sdk/rest/configuration.py +0 -445
  96. hiddenlayer/sdk/rest/exceptions.py +0 -199
  97. hiddenlayer/sdk/rest/models/__init__.py +0 -113
  98. hiddenlayer/sdk/rest/models/address.py +0 -110
  99. hiddenlayer/sdk/rest/models/artifact.py +0 -155
  100. hiddenlayer/sdk/rest/models/artifact_change.py +0 -108
  101. hiddenlayer/sdk/rest/models/artifact_content.py +0 -101
  102. hiddenlayer/sdk/rest/models/artifact_location.py +0 -109
  103. hiddenlayer/sdk/rest/models/attachment.py +0 -129
  104. hiddenlayer/sdk/rest/models/begin_multi_file_upload200_response.py +0 -87
  105. hiddenlayer/sdk/rest/models/begin_multipart_file_upload200_response.py +0 -97
  106. hiddenlayer/sdk/rest/models/begin_multipart_file_upload200_response_parts_inner.py +0 -94
  107. hiddenlayer/sdk/rest/models/code_flow.py +0 -113
  108. hiddenlayer/sdk/rest/models/configuration_override.py +0 -108
  109. hiddenlayer/sdk/rest/models/conversion.py +0 -114
  110. hiddenlayer/sdk/rest/models/create_sensor_request.py +0 -95
  111. hiddenlayer/sdk/rest/models/edge.py +0 -108
  112. hiddenlayer/sdk/rest/models/edge_traversal.py +0 -122
  113. hiddenlayer/sdk/rest/models/errors_inner.py +0 -91
  114. hiddenlayer/sdk/rest/models/exception.py +0 -113
  115. hiddenlayer/sdk/rest/models/external_properties.py +0 -273
  116. hiddenlayer/sdk/rest/models/external_property_file_reference.py +0 -102
  117. hiddenlayer/sdk/rest/models/external_property_file_references.py +0 -240
  118. hiddenlayer/sdk/rest/models/file_details_v3.py +0 -139
  119. hiddenlayer/sdk/rest/models/file_result_v3.py +0 -117
  120. hiddenlayer/sdk/rest/models/file_scan_report_v3.py +0 -132
  121. hiddenlayer/sdk/rest/models/file_scan_reports_v3.py +0 -95
  122. hiddenlayer/sdk/rest/models/fix.py +0 -113
  123. hiddenlayer/sdk/rest/models/get_condensed_model_scan_reports200_response.py +0 -102
  124. hiddenlayer/sdk/rest/models/graph.py +0 -123
  125. hiddenlayer/sdk/rest/models/graph_traversal.py +0 -97
  126. hiddenlayer/sdk/rest/models/inventory_v3.py +0 -101
  127. hiddenlayer/sdk/rest/models/invocation.py +0 -199
  128. hiddenlayer/sdk/rest/models/location.py +0 -146
  129. hiddenlayer/sdk/rest/models/location_inner.py +0 -138
  130. hiddenlayer/sdk/rest/models/location_relationship.py +0 -107
  131. hiddenlayer/sdk/rest/models/logical_location.py +0 -104
  132. hiddenlayer/sdk/rest/models/message.py +0 -92
  133. hiddenlayer/sdk/rest/models/mitre_atlas_inner.py +0 -110
  134. hiddenlayer/sdk/rest/models/model.py +0 -103
  135. hiddenlayer/sdk/rest/models/model_inventory_info.py +0 -103
  136. hiddenlayer/sdk/rest/models/model_version.py +0 -97
  137. hiddenlayer/sdk/rest/models/multi_file_upload_request_v3.py +0 -97
  138. hiddenlayer/sdk/rest/models/multiformat_message_string.py +0 -95
  139. hiddenlayer/sdk/rest/models/node.py +0 -122
  140. hiddenlayer/sdk/rest/models/notification.py +0 -157
  141. hiddenlayer/sdk/rest/models/notify_model_scan_completed200_response.py +0 -87
  142. hiddenlayer/sdk/rest/models/paged_response_with_total.py +0 -94
  143. hiddenlayer/sdk/rest/models/pagination_v3.py +0 -95
  144. hiddenlayer/sdk/rest/models/physical_location.py +0 -94
  145. hiddenlayer/sdk/rest/models/problem_details.py +0 -103
  146. hiddenlayer/sdk/rest/models/property_bag.py +0 -101
  147. hiddenlayer/sdk/rest/models/rectangle.py +0 -110
  148. hiddenlayer/sdk/rest/models/region.py +0 -127
  149. hiddenlayer/sdk/rest/models/replacement.py +0 -103
  150. hiddenlayer/sdk/rest/models/reporting_configuration.py +0 -113
  151. hiddenlayer/sdk/rest/models/reporting_descriptor.py +0 -162
  152. hiddenlayer/sdk/rest/models/reporting_descriptor_reference.py +0 -103
  153. hiddenlayer/sdk/rest/models/reporting_descriptor_relationship.py +0 -115
  154. hiddenlayer/sdk/rest/models/result.py +0 -312
  155. hiddenlayer/sdk/rest/models/result_provenance.py +0 -133
  156. hiddenlayer/sdk/rest/models/rule_details_inner.py +0 -102
  157. hiddenlayer/sdk/rest/models/run.py +0 -318
  158. hiddenlayer/sdk/rest/models/run_automation_details.py +0 -129
  159. hiddenlayer/sdk/rest/models/sarif210.py +0 -123
  160. hiddenlayer/sdk/rest/models/scan_create_request.py +0 -87
  161. hiddenlayer/sdk/rest/models/scan_detection_v3.py +0 -159
  162. hiddenlayer/sdk/rest/models/scan_detection_v31.py +0 -158
  163. hiddenlayer/sdk/rest/models/scan_header_v3.py +0 -129
  164. hiddenlayer/sdk/rest/models/scan_job.py +0 -115
  165. hiddenlayer/sdk/rest/models/scan_job_access.py +0 -97
  166. hiddenlayer/sdk/rest/models/scan_model_details_v3.py +0 -99
  167. hiddenlayer/sdk/rest/models/scan_model_details_v31.py +0 -97
  168. hiddenlayer/sdk/rest/models/scan_model_ids_v3.py +0 -89
  169. hiddenlayer/sdk/rest/models/scan_report_v3.py +0 -139
  170. hiddenlayer/sdk/rest/models/scan_results_map_v3.py +0 -105
  171. hiddenlayer/sdk/rest/models/scan_results_v3.py +0 -120
  172. hiddenlayer/sdk/rest/models/security_posture.py +0 -89
  173. hiddenlayer/sdk/rest/models/sensor.py +0 -100
  174. hiddenlayer/sdk/rest/models/sensor_query_response.py +0 -101
  175. hiddenlayer/sdk/rest/models/sensor_sor_model_card_query_response.py +0 -101
  176. hiddenlayer/sdk/rest/models/sensor_sor_model_card_response.py +0 -127
  177. hiddenlayer/sdk/rest/models/sensor_sor_query_filter.py +0 -108
  178. hiddenlayer/sdk/rest/models/sensor_sor_query_request.py +0 -109
  179. hiddenlayer/sdk/rest/models/special_locations.py +0 -97
  180. hiddenlayer/sdk/rest/models/stack.py +0 -113
  181. hiddenlayer/sdk/rest/models/stack_frame.py +0 -104
  182. hiddenlayer/sdk/rest/models/submission_response.py +0 -95
  183. hiddenlayer/sdk/rest/models/submission_v2.py +0 -109
  184. hiddenlayer/sdk/rest/models/suppression.py +0 -133
  185. hiddenlayer/sdk/rest/models/thread_flow.py +0 -144
  186. hiddenlayer/sdk/rest/models/thread_flow_location.py +0 -166
  187. hiddenlayer/sdk/rest/models/tool.py +0 -107
  188. hiddenlayer/sdk/rest/models/tool_component.py +0 -251
  189. hiddenlayer/sdk/rest/models/tool_component_reference.py +0 -108
  190. hiddenlayer/sdk/rest/models/translation_metadata.py +0 -110
  191. hiddenlayer/sdk/rest/models/validation_error_model.py +0 -99
  192. hiddenlayer/sdk/rest/models/version_control_details.py +0 -108
  193. hiddenlayer/sdk/rest/models/web_request.py +0 -112
  194. hiddenlayer/sdk/rest/models/web_response.py +0 -112
  195. hiddenlayer/sdk/rest/rest.py +0 -257
  196. hiddenlayer/sdk/services/__init__.py +0 -0
  197. hiddenlayer/sdk/services/aidr_predictive.py +0 -130
  198. hiddenlayer/sdk/services/model_scan.py +0 -505
  199. hiddenlayer/sdk/utils.py +0 -92
  200. hiddenlayer/sdk/version.py +0 -1
  201. hiddenlayer_sdk-2.0.10.dist-info/METADATA +0 -368
  202. hiddenlayer_sdk-2.0.10.dist-info/RECORD +0 -126
  203. hiddenlayer_sdk-2.0.10.dist-info/top_level.txt +0 -1
  204. /hiddenlayer/{sdk/__init__.py → py.typed} +0 -0
@@ -1,95 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer-API
5
-
6
- HiddenLayer-API
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, Field, StrictStr
21
- from typing import Any, ClassVar, Dict, List
22
- from typing import Optional, Set
23
- from typing_extensions import Self
24
-
25
- class PaginationV3(BaseModel):
26
- """
27
- PaginationV3
28
- """ # noqa: E501
29
- var_self: StrictStr = Field(alias="self")
30
- first: StrictStr
31
- prev: StrictStr
32
- next: StrictStr
33
- last: StrictStr
34
- __properties: ClassVar[List[str]] = ["self", "first", "prev", "next", "last"]
35
-
36
- model_config = ConfigDict(
37
- populate_by_name=True,
38
- validate_assignment=True,
39
- protected_namespaces=(),
40
- )
41
-
42
-
43
- def to_str(self) -> str:
44
- """Returns the string representation of the model using alias"""
45
- return pprint.pformat(self.model_dump(by_alias=True))
46
-
47
- def to_json(self) -> str:
48
- """Returns the JSON representation of the model using alias"""
49
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
- return json.dumps(self.to_dict())
51
-
52
- @classmethod
53
- def from_json(cls, json_str: str) -> Optional[Self]:
54
- """Create an instance of PaginationV3 from a JSON string"""
55
- return cls.from_dict(json.loads(json_str))
56
-
57
- def to_dict(self) -> Dict[str, Any]:
58
- """Return the dictionary representation of the model using alias.
59
-
60
- This has the following differences from calling pydantic's
61
- `self.model_dump(by_alias=True)`:
62
-
63
- * `None` is only added to the output dict for nullable fields that
64
- were set at model initialization. Other fields with value `None`
65
- are ignored.
66
- """
67
- excluded_fields: Set[str] = set([
68
- ])
69
-
70
- _dict = self.model_dump(
71
- by_alias=True,
72
- exclude=excluded_fields,
73
- exclude_none=True,
74
- )
75
- return _dict
76
-
77
- @classmethod
78
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
- """Create an instance of PaginationV3 from a dict"""
80
- if obj is None:
81
- return None
82
-
83
- if not isinstance(obj, dict):
84
- return cls.model_validate(obj)
85
-
86
- _obj = cls.model_validate({
87
- "self": obj.get("self"),
88
- "first": obj.get("first"),
89
- "prev": obj.get("prev"),
90
- "next": obj.get("next"),
91
- "last": obj.get("last")
92
- })
93
- return _obj
94
-
95
-
@@ -1,94 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer-API
5
-
6
- HiddenLayer-API
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, Field
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from hiddenlayer.sdk.rest.models.address import Address
23
- from hiddenlayer.sdk.rest.models.artifact_location import ArtifactLocation
24
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
25
- from hiddenlayer.sdk.rest.models.region import Region
26
- from typing import Optional, Set
27
- from typing_extensions import Self
28
-
29
- class PhysicalLocation(BaseModel):
30
- """
31
- A physical location relevant to a result. Specifies a reference to a programming artifact together with a range of bytes or characters within that artifact.
32
- """ # noqa: E501
33
- address: Optional[Address] = None
34
- artifact_location: Optional[ArtifactLocation] = Field(default=None, alias="artifactLocation")
35
- region: Optional[Region] = None
36
- context_region: Optional[Region] = Field(default=None, alias="contextRegion")
37
- properties: Optional[PropertyBag] = None
38
- __properties: ClassVar[List[str]] = []
39
-
40
- model_config = ConfigDict(
41
- populate_by_name=True,
42
- validate_assignment=True,
43
- protected_namespaces=(),
44
- )
45
-
46
-
47
- def to_str(self) -> str:
48
- """Returns the string representation of the model using alias"""
49
- return pprint.pformat(self.model_dump(by_alias=True))
50
-
51
- def to_json(self) -> str:
52
- """Returns the JSON representation of the model using alias"""
53
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
- return json.dumps(self.to_dict())
55
-
56
- @classmethod
57
- def from_json(cls, json_str: str) -> Optional[Self]:
58
- """Create an instance of PhysicalLocation from a JSON string"""
59
- return cls.from_dict(json.loads(json_str))
60
-
61
- def to_dict(self) -> Dict[str, Any]:
62
- """Return the dictionary representation of the model using alias.
63
-
64
- This has the following differences from calling pydantic's
65
- `self.model_dump(by_alias=True)`:
66
-
67
- * `None` is only added to the output dict for nullable fields that
68
- were set at model initialization. Other fields with value `None`
69
- are ignored.
70
- """
71
- excluded_fields: Set[str] = set([
72
- ])
73
-
74
- _dict = self.model_dump(
75
- by_alias=True,
76
- exclude=excluded_fields,
77
- exclude_none=True,
78
- )
79
- return _dict
80
-
81
- @classmethod
82
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
- """Create an instance of PhysicalLocation from a dict"""
84
- if obj is None:
85
- return None
86
-
87
- if not isinstance(obj, dict):
88
- return cls.model_validate(obj)
89
-
90
- _obj = cls.model_validate({
91
- })
92
- return _obj
93
-
94
-
@@ -1,103 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer-API
5
-
6
- HiddenLayer-API
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, Field, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from hiddenlayer.sdk.rest.models.errors_inner import ErrorsInner
23
- from typing import Optional, Set
24
- from typing_extensions import Self
25
-
26
- class ProblemDetails(BaseModel):
27
- """
28
- ProblemDetails
29
- """ # noqa: E501
30
- type: Optional[StrictStr] = Field(default=None, description="https://www.rfc-editor.org/rfc/rfc9457.html#name-type")
31
- title: Optional[StrictStr] = Field(default=None, description="https://www.rfc-editor.org/rfc/rfc9457.html#name-title")
32
- detail: Optional[StrictStr] = Field(default=None, description="https://www.rfc-editor.org/rfc/rfc9457.html#name-detail")
33
- instance: Optional[StrictStr] = Field(default=None, description="https://www.rfc-editor.org/rfc/rfc9457.html#name-instance")
34
- errors: List[ErrorsInner] = Field(description="Error details")
35
- __properties: ClassVar[List[str]] = ["type", "title", "detail", "instance", "errors"]
36
-
37
- model_config = ConfigDict(
38
- populate_by_name=True,
39
- validate_assignment=True,
40
- protected_namespaces=(),
41
- )
42
-
43
-
44
- def to_str(self) -> str:
45
- """Returns the string representation of the model using alias"""
46
- return pprint.pformat(self.model_dump(by_alias=True))
47
-
48
- def to_json(self) -> str:
49
- """Returns the JSON representation of the model using alias"""
50
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
- return json.dumps(self.to_dict())
52
-
53
- @classmethod
54
- def from_json(cls, json_str: str) -> Optional[Self]:
55
- """Create an instance of ProblemDetails from a JSON string"""
56
- return cls.from_dict(json.loads(json_str))
57
-
58
- def to_dict(self) -> Dict[str, Any]:
59
- """Return the dictionary representation of the model using alias.
60
-
61
- This has the following differences from calling pydantic's
62
- `self.model_dump(by_alias=True)`:
63
-
64
- * `None` is only added to the output dict for nullable fields that
65
- were set at model initialization. Other fields with value `None`
66
- are ignored.
67
- """
68
- excluded_fields: Set[str] = set([
69
- ])
70
-
71
- _dict = self.model_dump(
72
- by_alias=True,
73
- exclude=excluded_fields,
74
- exclude_none=True,
75
- )
76
- # override the default output from pydantic by calling `to_dict()` of each item in errors (list)
77
- _items = []
78
- if self.errors:
79
- for _item in self.errors:
80
- if _item:
81
- _items.append(_item.to_dict())
82
- _dict['errors'] = _items
83
- return _dict
84
-
85
- @classmethod
86
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
- """Create an instance of ProblemDetails from a dict"""
88
- if obj is None:
89
- return None
90
-
91
- if not isinstance(obj, dict):
92
- return cls.model_validate(obj)
93
-
94
- _obj = cls.model_validate({
95
- "type": obj.get("type"),
96
- "title": obj.get("title"),
97
- "detail": obj.get("detail"),
98
- "instance": obj.get("instance"),
99
- "errors": [ErrorsInner.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None
100
- })
101
- return _obj
102
-
103
-
@@ -1,101 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer-API
5
-
6
- HiddenLayer-API
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, Field, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing_extensions import Annotated
23
- from typing import Optional, Set
24
- from typing_extensions import Self
25
-
26
- class PropertyBag(BaseModel):
27
- """
28
- Key/value pairs that provide additional information about the object.
29
- """ # noqa: E501
30
- tags: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = Field(default=None, description="A set of distinct strings that provide additional information.")
31
- additional_properties: Dict[str, Any] = {}
32
- __properties: ClassVar[List[str]] = ["tags"]
33
-
34
- model_config = ConfigDict(
35
- populate_by_name=True,
36
- validate_assignment=True,
37
- protected_namespaces=(),
38
- )
39
-
40
-
41
- def to_str(self) -> str:
42
- """Returns the string representation of the model using alias"""
43
- return pprint.pformat(self.model_dump(by_alias=True))
44
-
45
- def to_json(self) -> str:
46
- """Returns the JSON representation of the model using alias"""
47
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
- return json.dumps(self.to_dict())
49
-
50
- @classmethod
51
- def from_json(cls, json_str: str) -> Optional[Self]:
52
- """Create an instance of PropertyBag from a JSON string"""
53
- return cls.from_dict(json.loads(json_str))
54
-
55
- def to_dict(self) -> Dict[str, Any]:
56
- """Return the dictionary representation of the model using alias.
57
-
58
- This has the following differences from calling pydantic's
59
- `self.model_dump(by_alias=True)`:
60
-
61
- * `None` is only added to the output dict for nullable fields that
62
- were set at model initialization. Other fields with value `None`
63
- are ignored.
64
- * Fields in `self.additional_properties` are added to the output dict.
65
- """
66
- excluded_fields: Set[str] = set([
67
- "additional_properties",
68
- ])
69
-
70
- _dict = self.model_dump(
71
- by_alias=True,
72
- exclude=excluded_fields,
73
- exclude_none=True,
74
- )
75
- # puts key-value pairs in additional_properties in the top level
76
- if self.additional_properties is not None:
77
- for _key, _value in self.additional_properties.items():
78
- _dict[_key] = _value
79
-
80
- return _dict
81
-
82
- @classmethod
83
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
- """Create an instance of PropertyBag from a dict"""
85
- if obj is None:
86
- return None
87
-
88
- if not isinstance(obj, dict):
89
- return cls.model_validate(obj)
90
-
91
- _obj = cls.model_validate({
92
- "tags": obj.get("tags")
93
- })
94
- # store additional fields in additional_properties
95
- for _key in obj.keys():
96
- if _key not in cls.__properties:
97
- _obj.additional_properties[_key] = obj.get(_key)
98
-
99
- return _obj
100
-
101
-
@@ -1,110 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer-API
5
-
6
- HiddenLayer-API
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, Field, StrictFloat, StrictInt
21
- from typing import Any, ClassVar, Dict, List, Optional, Union
22
- from hiddenlayer.sdk.rest.models.message import Message
23
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class Rectangle(BaseModel):
28
- """
29
- An area within an image.
30
- """ # noqa: E501
31
- top: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The Y coordinate of the top edge of the rectangle, measured in the image's natural units.")
32
- left: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The X coordinate of the left edge of the rectangle, measured in the image's natural units.")
33
- bottom: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The Y coordinate of the bottom edge of the rectangle, measured in the image's natural units.")
34
- right: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The X coordinate of the right edge of the rectangle, measured in the image's natural units.")
35
- message: Optional[Message] = None
36
- properties: Optional[PropertyBag] = None
37
- __properties: ClassVar[List[str]] = ["top", "left", "bottom", "right", "message", "properties"]
38
-
39
- model_config = ConfigDict(
40
- populate_by_name=True,
41
- validate_assignment=True,
42
- protected_namespaces=(),
43
- )
44
-
45
-
46
- def to_str(self) -> str:
47
- """Returns the string representation of the model using alias"""
48
- return pprint.pformat(self.model_dump(by_alias=True))
49
-
50
- def to_json(self) -> str:
51
- """Returns the JSON representation of the model using alias"""
52
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
- return json.dumps(self.to_dict())
54
-
55
- @classmethod
56
- def from_json(cls, json_str: str) -> Optional[Self]:
57
- """Create an instance of Rectangle from a JSON string"""
58
- return cls.from_dict(json.loads(json_str))
59
-
60
- def to_dict(self) -> Dict[str, Any]:
61
- """Return the dictionary representation of the model using alias.
62
-
63
- This has the following differences from calling pydantic's
64
- `self.model_dump(by_alias=True)`:
65
-
66
- * `None` is only added to the output dict for nullable fields that
67
- were set at model initialization. Other fields with value `None`
68
- are ignored.
69
- """
70
- excluded_fields: Set[str] = set([
71
- ])
72
-
73
- _dict = self.model_dump(
74
- by_alias=True,
75
- exclude=excluded_fields,
76
- exclude_none=True,
77
- )
78
- # override the default output from pydantic by calling `to_dict()` of message
79
- if self.message:
80
- _dict['message'] = self.message.to_dict()
81
- # override the default output from pydantic by calling `to_dict()` of properties
82
- if self.properties:
83
- _dict['properties'] = self.properties.to_dict()
84
- # set to None if message (nullable) is None
85
- # and model_fields_set contains the field
86
- if self.message is None and "message" in self.model_fields_set:
87
- _dict['message'] = None
88
-
89
- return _dict
90
-
91
- @classmethod
92
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
- """Create an instance of Rectangle from a dict"""
94
- if obj is None:
95
- return None
96
-
97
- if not isinstance(obj, dict):
98
- return cls.model_validate(obj)
99
-
100
- _obj = cls.model_validate({
101
- "top": obj.get("top"),
102
- "left": obj.get("left"),
103
- "bottom": obj.get("bottom"),
104
- "right": obj.get("right"),
105
- "message": Message.from_dict(obj["message"]) if obj.get("message") is not None else None,
106
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
107
- })
108
- return _obj
109
-
110
-
@@ -1,127 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer-API
5
-
6
- HiddenLayer-API
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, Field, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing_extensions import Annotated
23
- from hiddenlayer.sdk.rest.models.artifact_content import ArtifactContent
24
- from hiddenlayer.sdk.rest.models.message import Message
25
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
26
- from typing import Optional, Set
27
- from typing_extensions import Self
28
-
29
- class Region(BaseModel):
30
- """
31
- A region within an artifact where a result was detected.
32
- """ # noqa: E501
33
- start_line: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="The line number of the first character in the region.", alias="startLine")
34
- start_column: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="The column number of the first character in the region.", alias="startColumn")
35
- end_line: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="The line number of the last character in the region.", alias="endLine")
36
- end_column: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="The column number of the character following the end of the region.", alias="endColumn")
37
- char_offset: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The zero-based offset from the beginning of the artifact of the first character in the region.", alias="charOffset")
38
- char_length: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="The length of the region in characters.", alias="charLength")
39
- byte_offset: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The zero-based offset from the beginning of the artifact of the first byte in the region.", alias="byteOffset")
40
- byte_length: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="The length of the region in bytes.", alias="byteLength")
41
- snippet: Optional[ArtifactContent] = None
42
- message: Optional[Message] = None
43
- source_language: Optional[StrictStr] = Field(default=None, description="Specifies the source language, if any, of the portion of the artifact specified by the region object.", alias="sourceLanguage")
44
- properties: Optional[PropertyBag] = None
45
- __properties: ClassVar[List[str]] = ["startLine", "startColumn", "endLine", "endColumn", "charOffset", "charLength", "byteOffset", "byteLength", "snippet", "message", "sourceLanguage", "properties"]
46
-
47
- model_config = ConfigDict(
48
- populate_by_name=True,
49
- validate_assignment=True,
50
- protected_namespaces=(),
51
- )
52
-
53
-
54
- def to_str(self) -> str:
55
- """Returns the string representation of the model using alias"""
56
- return pprint.pformat(self.model_dump(by_alias=True))
57
-
58
- def to_json(self) -> str:
59
- """Returns the JSON representation of the model using alias"""
60
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
- return json.dumps(self.to_dict())
62
-
63
- @classmethod
64
- def from_json(cls, json_str: str) -> Optional[Self]:
65
- """Create an instance of Region from a JSON string"""
66
- return cls.from_dict(json.loads(json_str))
67
-
68
- def to_dict(self) -> Dict[str, Any]:
69
- """Return the dictionary representation of the model using alias.
70
-
71
- This has the following differences from calling pydantic's
72
- `self.model_dump(by_alias=True)`:
73
-
74
- * `None` is only added to the output dict for nullable fields that
75
- were set at model initialization. Other fields with value `None`
76
- are ignored.
77
- """
78
- excluded_fields: Set[str] = set([
79
- ])
80
-
81
- _dict = self.model_dump(
82
- by_alias=True,
83
- exclude=excluded_fields,
84
- exclude_none=True,
85
- )
86
- # override the default output from pydantic by calling `to_dict()` of snippet
87
- if self.snippet:
88
- _dict['snippet'] = self.snippet.to_dict()
89
- # override the default output from pydantic by calling `to_dict()` of message
90
- if self.message:
91
- _dict['message'] = self.message.to_dict()
92
- # override the default output from pydantic by calling `to_dict()` of properties
93
- if self.properties:
94
- _dict['properties'] = self.properties.to_dict()
95
- # set to None if message (nullable) is None
96
- # and model_fields_set contains the field
97
- if self.message is None and "message" in self.model_fields_set:
98
- _dict['message'] = None
99
-
100
- return _dict
101
-
102
- @classmethod
103
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
104
- """Create an instance of Region from a dict"""
105
- if obj is None:
106
- return None
107
-
108
- if not isinstance(obj, dict):
109
- return cls.model_validate(obj)
110
-
111
- _obj = cls.model_validate({
112
- "startLine": obj.get("startLine"),
113
- "startColumn": obj.get("startColumn"),
114
- "endLine": obj.get("endLine"),
115
- "endColumn": obj.get("endColumn"),
116
- "charOffset": obj.get("charOffset") if obj.get("charOffset") is not None else -1,
117
- "charLength": obj.get("charLength"),
118
- "byteOffset": obj.get("byteOffset") if obj.get("byteOffset") is not None else -1,
119
- "byteLength": obj.get("byteLength"),
120
- "snippet": ArtifactContent.from_dict(obj["snippet"]) if obj.get("snippet") is not None else None,
121
- "message": Message.from_dict(obj["message"]) if obj.get("message") is not None else None,
122
- "sourceLanguage": obj.get("sourceLanguage"),
123
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
124
- })
125
- return _obj
126
-
127
-