hiddenlayer-sdk 2.0.10__py3-none-any.whl → 3.0.1__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.1.dist-info/METADATA +521 -0
  79. hiddenlayer_sdk-3.0.1.dist-info/RECORD +82 -0
  80. {hiddenlayer_sdk-2.0.10.dist-info → hiddenlayer_sdk-3.0.1.dist-info}/WHEEL +1 -2
  81. {hiddenlayer_sdk-2.0.10.dist-info → hiddenlayer_sdk-3.0.1.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,199 +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 datetime import datetime
21
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
22
- from typing import Any, ClassVar, Dict, List, Optional
23
- from typing_extensions import Annotated
24
- from hiddenlayer.sdk.rest.models.artifact_location import ArtifactLocation
25
- from hiddenlayer.sdk.rest.models.configuration_override import ConfigurationOverride
26
- from hiddenlayer.sdk.rest.models.notification import Notification
27
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
28
- from typing import Optional, Set
29
- from typing_extensions import Self
30
-
31
- class Invocation(BaseModel):
32
- """
33
- The runtime environment of the analysis tool run.
34
- """ # noqa: E501
35
- command_line: Optional[StrictStr] = Field(default=None, description="The command line used to invoke the tool.", alias="commandLine")
36
- arguments: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = Field(default=None, description="An array of strings, containing in order the command line arguments passed to the tool from the operating system.")
37
- response_files: Optional[Annotated[List[ArtifactLocation], Field(min_length=0)]] = Field(default=None, description="The locations of any response files specified on the tool's command line.", alias="responseFiles")
38
- start_time_utc: Optional[datetime] = Field(default=None, description="The Coordinated Universal Time (UTC) date and time at which the invocation started. See \"Date/time properties\" in the SARIF spec for the required format.", alias="startTimeUtc")
39
- end_time_utc: Optional[datetime] = Field(default=None, description="The Coordinated Universal Time (UTC) date and time at which the invocation ended. See \"Date/time properties\" in the SARIF spec for the required format.", alias="endTimeUtc")
40
- exit_code: Optional[StrictInt] = Field(default=None, description="The process exit code.", alias="exitCode")
41
- rule_configuration_overrides: Optional[Annotated[List[ConfigurationOverride], Field(min_length=0)]] = Field(default=None, description="An array of configurationOverride objects that describe rules related runtime overrides.", alias="ruleConfigurationOverrides")
42
- notification_configuration_overrides: Optional[Annotated[List[ConfigurationOverride], Field(min_length=0)]] = Field(default=None, description="An array of configurationOverride objects that describe notifications related runtime overrides.", alias="notificationConfigurationOverrides")
43
- tool_execution_notifications: Optional[Annotated[List[Notification], Field(min_length=0)]] = Field(default=None, description="A list of runtime conditions detected by the tool during the analysis.", alias="toolExecutionNotifications")
44
- tool_configuration_notifications: Optional[Annotated[List[Notification], Field(min_length=0)]] = Field(default=None, description="A list of conditions detected by the tool that are relevant to the tool's configuration.", alias="toolConfigurationNotifications")
45
- exit_code_description: Optional[StrictStr] = Field(default=None, description="The reason for the process exit.", alias="exitCodeDescription")
46
- exit_signal_name: Optional[StrictStr] = Field(default=None, description="The name of the signal that caused the process to exit.", alias="exitSignalName")
47
- exit_signal_number: Optional[StrictInt] = Field(default=None, description="The numeric value of the signal that caused the process to exit.", alias="exitSignalNumber")
48
- process_start_failure_message: Optional[StrictStr] = Field(default=None, description="The reason given by the operating system that the process failed to start.", alias="processStartFailureMessage")
49
- execution_successful: StrictBool = Field(description="Specifies whether the tool's execution completed successfully.", alias="executionSuccessful")
50
- machine: Optional[StrictStr] = Field(default=None, description="The machine on which the invocation occurred.")
51
- account: Optional[StrictStr] = Field(default=None, description="The account under which the invocation occurred.")
52
- process_id: Optional[StrictInt] = Field(default=None, description="The id of the process in which the invocation occurred.", alias="processId")
53
- executable_location: Optional[ArtifactLocation] = Field(default=None, alias="executableLocation")
54
- working_directory: Optional[ArtifactLocation] = Field(default=None, alias="workingDirectory")
55
- environment_variables: Optional[Dict[str, StrictStr]] = Field(default=None, description="The environment variables associated with the analysis tool process, expressed as key/value pairs.", alias="environmentVariables")
56
- stdin: Optional[ArtifactLocation] = None
57
- stdout: Optional[ArtifactLocation] = None
58
- stderr: Optional[ArtifactLocation] = None
59
- stdout_stderr: Optional[ArtifactLocation] = Field(default=None, alias="stdoutStderr")
60
- properties: Optional[PropertyBag] = None
61
- __properties: ClassVar[List[str]] = ["commandLine", "arguments", "responseFiles", "startTimeUtc", "endTimeUtc", "exitCode", "ruleConfigurationOverrides", "notificationConfigurationOverrides", "toolExecutionNotifications", "toolConfigurationNotifications", "exitCodeDescription", "exitSignalName", "exitSignalNumber", "processStartFailureMessage", "executionSuccessful", "machine", "account", "processId", "executableLocation", "workingDirectory", "environmentVariables", "stdin", "stdout", "stderr", "stdoutStderr", "properties"]
62
-
63
- model_config = ConfigDict(
64
- populate_by_name=True,
65
- validate_assignment=True,
66
- protected_namespaces=(),
67
- )
68
-
69
-
70
- def to_str(self) -> str:
71
- """Returns the string representation of the model using alias"""
72
- return pprint.pformat(self.model_dump(by_alias=True))
73
-
74
- def to_json(self) -> str:
75
- """Returns the JSON representation of the model using alias"""
76
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
77
- return json.dumps(self.to_dict())
78
-
79
- @classmethod
80
- def from_json(cls, json_str: str) -> Optional[Self]:
81
- """Create an instance of Invocation from a JSON string"""
82
- return cls.from_dict(json.loads(json_str))
83
-
84
- def to_dict(self) -> Dict[str, Any]:
85
- """Return the dictionary representation of the model using alias.
86
-
87
- This has the following differences from calling pydantic's
88
- `self.model_dump(by_alias=True)`:
89
-
90
- * `None` is only added to the output dict for nullable fields that
91
- were set at model initialization. Other fields with value `None`
92
- are ignored.
93
- """
94
- excluded_fields: Set[str] = set([
95
- ])
96
-
97
- _dict = self.model_dump(
98
- by_alias=True,
99
- exclude=excluded_fields,
100
- exclude_none=True,
101
- )
102
- # override the default output from pydantic by calling `to_dict()` of each item in response_files (list)
103
- _items = []
104
- if self.response_files:
105
- for _item in self.response_files:
106
- if _item:
107
- _items.append(_item.to_dict())
108
- _dict['responseFiles'] = _items
109
- # override the default output from pydantic by calling `to_dict()` of each item in rule_configuration_overrides (list)
110
- _items = []
111
- if self.rule_configuration_overrides:
112
- for _item in self.rule_configuration_overrides:
113
- if _item:
114
- _items.append(_item.to_dict())
115
- _dict['ruleConfigurationOverrides'] = _items
116
- # override the default output from pydantic by calling `to_dict()` of each item in notification_configuration_overrides (list)
117
- _items = []
118
- if self.notification_configuration_overrides:
119
- for _item in self.notification_configuration_overrides:
120
- if _item:
121
- _items.append(_item.to_dict())
122
- _dict['notificationConfigurationOverrides'] = _items
123
- # override the default output from pydantic by calling `to_dict()` of each item in tool_execution_notifications (list)
124
- _items = []
125
- if self.tool_execution_notifications:
126
- for _item in self.tool_execution_notifications:
127
- if _item:
128
- _items.append(_item.to_dict())
129
- _dict['toolExecutionNotifications'] = _items
130
- # override the default output from pydantic by calling `to_dict()` of each item in tool_configuration_notifications (list)
131
- _items = []
132
- if self.tool_configuration_notifications:
133
- for _item in self.tool_configuration_notifications:
134
- if _item:
135
- _items.append(_item.to_dict())
136
- _dict['toolConfigurationNotifications'] = _items
137
- # override the default output from pydantic by calling `to_dict()` of executable_location
138
- if self.executable_location:
139
- _dict['executableLocation'] = self.executable_location.to_dict()
140
- # override the default output from pydantic by calling `to_dict()` of working_directory
141
- if self.working_directory:
142
- _dict['workingDirectory'] = self.working_directory.to_dict()
143
- # override the default output from pydantic by calling `to_dict()` of stdin
144
- if self.stdin:
145
- _dict['stdin'] = self.stdin.to_dict()
146
- # override the default output from pydantic by calling `to_dict()` of stdout
147
- if self.stdout:
148
- _dict['stdout'] = self.stdout.to_dict()
149
- # override the default output from pydantic by calling `to_dict()` of stderr
150
- if self.stderr:
151
- _dict['stderr'] = self.stderr.to_dict()
152
- # override the default output from pydantic by calling `to_dict()` of stdout_stderr
153
- if self.stdout_stderr:
154
- _dict['stdoutStderr'] = self.stdout_stderr.to_dict()
155
- # override the default output from pydantic by calling `to_dict()` of properties
156
- if self.properties:
157
- _dict['properties'] = self.properties.to_dict()
158
- return _dict
159
-
160
- @classmethod
161
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
162
- """Create an instance of Invocation from a dict"""
163
- if obj is None:
164
- return None
165
-
166
- if not isinstance(obj, dict):
167
- return cls.model_validate(obj)
168
-
169
- _obj = cls.model_validate({
170
- "commandLine": obj.get("commandLine"),
171
- "arguments": obj.get("arguments"),
172
- "responseFiles": [ArtifactLocation.from_dict(_item) for _item in obj["responseFiles"]] if obj.get("responseFiles") is not None else None,
173
- "startTimeUtc": obj.get("startTimeUtc"),
174
- "endTimeUtc": obj.get("endTimeUtc"),
175
- "exitCode": obj.get("exitCode"),
176
- "ruleConfigurationOverrides": [ConfigurationOverride.from_dict(_item) for _item in obj["ruleConfigurationOverrides"]] if obj.get("ruleConfigurationOverrides") is not None else None,
177
- "notificationConfigurationOverrides": [ConfigurationOverride.from_dict(_item) for _item in obj["notificationConfigurationOverrides"]] if obj.get("notificationConfigurationOverrides") is not None else None,
178
- "toolExecutionNotifications": [Notification.from_dict(_item) for _item in obj["toolExecutionNotifications"]] if obj.get("toolExecutionNotifications") is not None else None,
179
- "toolConfigurationNotifications": [Notification.from_dict(_item) for _item in obj["toolConfigurationNotifications"]] if obj.get("toolConfigurationNotifications") is not None else None,
180
- "exitCodeDescription": obj.get("exitCodeDescription"),
181
- "exitSignalName": obj.get("exitSignalName"),
182
- "exitSignalNumber": obj.get("exitSignalNumber"),
183
- "processStartFailureMessage": obj.get("processStartFailureMessage"),
184
- "executionSuccessful": obj.get("executionSuccessful"),
185
- "machine": obj.get("machine"),
186
- "account": obj.get("account"),
187
- "processId": obj.get("processId"),
188
- "executableLocation": ArtifactLocation.from_dict(obj["executableLocation"]) if obj.get("executableLocation") is not None else None,
189
- "workingDirectory": ArtifactLocation.from_dict(obj["workingDirectory"]) if obj.get("workingDirectory") is not None else None,
190
- "environmentVariables": obj.get("environmentVariables"),
191
- "stdin": ArtifactLocation.from_dict(obj["stdin"]) if obj.get("stdin") is not None else None,
192
- "stdout": ArtifactLocation.from_dict(obj["stdout"]) if obj.get("stdout") is not None else None,
193
- "stderr": ArtifactLocation.from_dict(obj["stderr"]) if obj.get("stderr") is not None else None,
194
- "stdoutStderr": ArtifactLocation.from_dict(obj["stdoutStderr"]) if obj.get("stdoutStderr") is not None else None,
195
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
196
- })
197
- return _obj
198
-
199
-
@@ -1,146 +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 typing_extensions import Annotated
23
- from hiddenlayer.sdk.rest.models.location_relationship import LocationRelationship
24
- from hiddenlayer.sdk.rest.models.logical_location import LogicalLocation
25
- from hiddenlayer.sdk.rest.models.message import Message
26
- from hiddenlayer.sdk.rest.models.physical_location import PhysicalLocation
27
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
28
- from hiddenlayer.sdk.rest.models.region import Region
29
- from typing import Optional, Set
30
- from typing_extensions import Self
31
-
32
- class Location(BaseModel):
33
- """
34
- A location within a programming artifact.
35
- """ # noqa: E501
36
- id: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="Value that distinguishes this location from all other locations within a single result object.")
37
- physical_location: Optional[PhysicalLocation] = Field(default=None, alias="physicalLocation")
38
- logical_locations: Optional[Annotated[List[LogicalLocation], Field(min_length=0)]] = Field(default=None, description="The logical locations associated with the result.", alias="logicalLocations")
39
- message: Optional[Message] = None
40
- annotations: Optional[Annotated[List[Region], Field(min_length=0)]] = Field(default=None, description="A set of regions relevant to the location.")
41
- relationships: Optional[Annotated[List[LocationRelationship], Field(min_length=0)]] = Field(default=None, description="An array of objects that describe relationships between this location and others.")
42
- properties: Optional[PropertyBag] = None
43
- __properties: ClassVar[List[str]] = ["id", "physicalLocation", "logicalLocations", "message", "annotations", "relationships", "properties"]
44
-
45
- model_config = ConfigDict(
46
- populate_by_name=True,
47
- validate_assignment=True,
48
- protected_namespaces=(),
49
- )
50
-
51
-
52
- def to_str(self) -> str:
53
- """Returns the string representation of the model using alias"""
54
- return pprint.pformat(self.model_dump(by_alias=True))
55
-
56
- def to_json(self) -> str:
57
- """Returns the JSON representation of the model using alias"""
58
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
- return json.dumps(self.to_dict())
60
-
61
- @classmethod
62
- def from_json(cls, json_str: str) -> Optional[Self]:
63
- """Create an instance of Location from a JSON string"""
64
- return cls.from_dict(json.loads(json_str))
65
-
66
- def to_dict(self) -> Dict[str, Any]:
67
- """Return the dictionary representation of the model using alias.
68
-
69
- This has the following differences from calling pydantic's
70
- `self.model_dump(by_alias=True)`:
71
-
72
- * `None` is only added to the output dict for nullable fields that
73
- were set at model initialization. Other fields with value `None`
74
- are ignored.
75
- """
76
- excluded_fields: Set[str] = set([
77
- ])
78
-
79
- _dict = self.model_dump(
80
- by_alias=True,
81
- exclude=excluded_fields,
82
- exclude_none=True,
83
- )
84
- # override the default output from pydantic by calling `to_dict()` of physical_location
85
- if self.physical_location:
86
- _dict['physicalLocation'] = self.physical_location.to_dict()
87
- # override the default output from pydantic by calling `to_dict()` of each item in logical_locations (list)
88
- _items = []
89
- if self.logical_locations:
90
- for _item in self.logical_locations:
91
- if _item:
92
- _items.append(_item.to_dict())
93
- _dict['logicalLocations'] = _items
94
- # override the default output from pydantic by calling `to_dict()` of message
95
- if self.message:
96
- _dict['message'] = self.message.to_dict()
97
- # override the default output from pydantic by calling `to_dict()` of each item in annotations (list)
98
- _items = []
99
- if self.annotations:
100
- for _item in self.annotations:
101
- if _item:
102
- _items.append(_item.to_dict())
103
- _dict['annotations'] = _items
104
- # override the default output from pydantic by calling `to_dict()` of each item in relationships (list)
105
- _items = []
106
- if self.relationships:
107
- for _item in self.relationships:
108
- if _item:
109
- _items.append(_item.to_dict())
110
- _dict['relationships'] = _items
111
- # override the default output from pydantic by calling `to_dict()` of properties
112
- if self.properties:
113
- _dict['properties'] = self.properties.to_dict()
114
- # set to None if physical_location (nullable) is None
115
- # and model_fields_set contains the field
116
- if self.physical_location is None and "physical_location" in self.model_fields_set:
117
- _dict['physicalLocation'] = None
118
-
119
- # set to None if message (nullable) is None
120
- # and model_fields_set contains the field
121
- if self.message is None and "message" in self.model_fields_set:
122
- _dict['message'] = None
123
-
124
- return _dict
125
-
126
- @classmethod
127
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
128
- """Create an instance of Location from a dict"""
129
- if obj is None:
130
- return None
131
-
132
- if not isinstance(obj, dict):
133
- return cls.model_validate(obj)
134
-
135
- _obj = cls.model_validate({
136
- "id": obj.get("id") if obj.get("id") is not None else -1,
137
- "physicalLocation": PhysicalLocation.from_dict(obj["physicalLocation"]) if obj.get("physicalLocation") is not None else None,
138
- "logicalLocations": [LogicalLocation.from_dict(_item) for _item in obj["logicalLocations"]] if obj.get("logicalLocations") is not None else None,
139
- "message": Message.from_dict(obj["message"]) if obj.get("message") is not None else None,
140
- "annotations": [Region.from_dict(_item) for _item in obj["annotations"]] if obj.get("annotations") is not None else None,
141
- "relationships": [LocationRelationship.from_dict(_item) for _item in obj["relationships"]] if obj.get("relationships") is not None else None,
142
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
143
- })
144
- return _obj
145
-
146
-
@@ -1,138 +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
- from inspect import getfullargspec
17
- import json
18
- import pprint
19
- import re # noqa: F401
20
- from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator
21
- from typing import Optional
22
- from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
23
- from typing_extensions import Literal, Self
24
- from pydantic import Field
25
-
26
- LOCATIONINNER_ANY_OF_SCHEMAS = ["int", "str"]
27
-
28
- class LocationInner(BaseModel):
29
- """
30
- LocationInner
31
- """
32
-
33
- # data type: str
34
- anyof_schema_1_validator: Optional[StrictStr] = None
35
- # data type: int
36
- anyof_schema_2_validator: Optional[StrictInt] = None
37
- if TYPE_CHECKING:
38
- actual_instance: Optional[Union[int, str]] = None
39
- else:
40
- actual_instance: Any = None
41
- any_of_schemas: Set[str] = { "int", "str" }
42
-
43
- model_config = {
44
- "validate_assignment": True,
45
- "protected_namespaces": (),
46
- }
47
-
48
- def __init__(self, *args, **kwargs) -> None:
49
- if args:
50
- if len(args) > 1:
51
- raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
52
- if kwargs:
53
- raise ValueError("If a position argument is used, keyword arguments cannot be used.")
54
- super().__init__(actual_instance=args[0])
55
- else:
56
- super().__init__(**kwargs)
57
-
58
- @field_validator('actual_instance')
59
- def actual_instance_must_validate_anyof(cls, v):
60
- instance = LocationInner.model_construct()
61
- error_messages = []
62
- # validate data type: str
63
- try:
64
- instance.anyof_schema_1_validator = v
65
- return v
66
- except (ValidationError, ValueError) as e:
67
- error_messages.append(str(e))
68
- # validate data type: int
69
- try:
70
- instance.anyof_schema_2_validator = v
71
- return v
72
- except (ValidationError, ValueError) as e:
73
- error_messages.append(str(e))
74
- if error_messages:
75
- # no match
76
- raise ValueError("No match found when setting the actual_instance in LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
77
- else:
78
- return v
79
-
80
- @classmethod
81
- def from_dict(cls, obj: Dict[str, Any]) -> Self:
82
- return cls.from_json(json.dumps(obj))
83
-
84
- @classmethod
85
- def from_json(cls, json_str: str) -> Self:
86
- """Returns the object represented by the json string"""
87
- instance = cls.model_construct()
88
- error_messages = []
89
- # deserialize data into str
90
- try:
91
- # validation
92
- instance.anyof_schema_1_validator = json.loads(json_str)
93
- # assign value to actual_instance
94
- instance.actual_instance = instance.anyof_schema_1_validator
95
- return instance
96
- except (ValidationError, ValueError) as e:
97
- error_messages.append(str(e))
98
- # deserialize data into int
99
- try:
100
- # validation
101
- instance.anyof_schema_2_validator = json.loads(json_str)
102
- # assign value to actual_instance
103
- instance.actual_instance = instance.anyof_schema_2_validator
104
- return instance
105
- except (ValidationError, ValueError) as e:
106
- error_messages.append(str(e))
107
-
108
- if error_messages:
109
- # no match
110
- raise ValueError("No match found when deserializing the JSON string into LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
111
- else:
112
- return instance
113
-
114
- def to_json(self) -> str:
115
- """Returns the JSON representation of the actual instance"""
116
- if self.actual_instance is None:
117
- return "null"
118
-
119
- if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
120
- return self.actual_instance.to_json()
121
- else:
122
- return json.dumps(self.actual_instance)
123
-
124
- def to_dict(self) -> Optional[Union[Dict[str, Any], int, str]]:
125
- """Returns the dict representation of the actual instance"""
126
- if self.actual_instance is None:
127
- return None
128
-
129
- if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
130
- return self.actual_instance.to_dict()
131
- else:
132
- return self.actual_instance
133
-
134
- def to_str(self) -> str:
135
- """Returns the string representation of the actual instance"""
136
- return pprint.pformat(self.model_dump())
137
-
138
-
@@ -1,107 +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.message import Message
24
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
25
- from typing import Optional, Set
26
- from typing_extensions import Self
27
-
28
- class LocationRelationship(BaseModel):
29
- """
30
- Information about the relation of one location to another.
31
- """ # noqa: E501
32
- target: Annotated[int, Field(strict=True, ge=0)] = Field(description="A reference to the related location.")
33
- kinds: Optional[List[StrictStr]] = Field(default=None, description="A set of distinct strings that categorize the relationship. Well-known kinds include 'includes', 'isIncludedBy' and 'relevant'.")
34
- description: Optional[Message] = None
35
- properties: Optional[PropertyBag] = None
36
- __properties: ClassVar[List[str]] = ["target", "kinds", "description", "properties"]
37
-
38
- model_config = ConfigDict(
39
- populate_by_name=True,
40
- validate_assignment=True,
41
- protected_namespaces=(),
42
- )
43
-
44
-
45
- def to_str(self) -> str:
46
- """Returns the string representation of the model using alias"""
47
- return pprint.pformat(self.model_dump(by_alias=True))
48
-
49
- def to_json(self) -> str:
50
- """Returns the JSON representation of the model using alias"""
51
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
- return json.dumps(self.to_dict())
53
-
54
- @classmethod
55
- def from_json(cls, json_str: str) -> Optional[Self]:
56
- """Create an instance of LocationRelationship from a JSON string"""
57
- return cls.from_dict(json.loads(json_str))
58
-
59
- def to_dict(self) -> Dict[str, Any]:
60
- """Return the dictionary representation of the model using alias.
61
-
62
- This has the following differences from calling pydantic's
63
- `self.model_dump(by_alias=True)`:
64
-
65
- * `None` is only added to the output dict for nullable fields that
66
- were set at model initialization. Other fields with value `None`
67
- are ignored.
68
- """
69
- excluded_fields: Set[str] = set([
70
- ])
71
-
72
- _dict = self.model_dump(
73
- by_alias=True,
74
- exclude=excluded_fields,
75
- exclude_none=True,
76
- )
77
- # override the default output from pydantic by calling `to_dict()` of description
78
- if self.description:
79
- _dict['description'] = self.description.to_dict()
80
- # override the default output from pydantic by calling `to_dict()` of properties
81
- if self.properties:
82
- _dict['properties'] = self.properties.to_dict()
83
- # set to None if description (nullable) is None
84
- # and model_fields_set contains the field
85
- if self.description is None and "description" in self.model_fields_set:
86
- _dict['description'] = None
87
-
88
- return _dict
89
-
90
- @classmethod
91
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
- """Create an instance of LocationRelationship 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
- "target": obj.get("target"),
101
- "kinds": obj.get("kinds"),
102
- "description": Message.from_dict(obj["description"]) if obj.get("description") is not None else None,
103
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
104
- })
105
- return _obj
106
-
107
-