hiddenlayer-sdk 2.0.9__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 -105
  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.9.dist-info → hiddenlayer_sdk-3.0.0.dist-info}/WHEEL +1 -2
  81. {hiddenlayer_sdk-2.0.9.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.9.dist-info/METADATA +0 -368
  202. hiddenlayer_sdk-2.0.9.dist-info/RECORD +0 -126
  203. hiddenlayer_sdk-2.0.9.dist-info/top_level.txt +0 -1
  204. /hiddenlayer/{sdk/__init__.py → py.typed} +0 -0
@@ -1,133 +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, field_validator
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing_extensions import Annotated
23
- from hiddenlayer.sdk.rest.models.location import Location
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 Suppression(BaseModel):
29
- """
30
- A suppression that is relevant to a result.
31
- """ # noqa: E501
32
- guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A stable, unique identifier for the suppression in the form of a GUID.")
33
- kind: StrictStr = Field(description="A string that indicates where the suppression is persisted.")
34
- status: Optional[StrictStr] = Field(default=None, description="A string that indicates the review status of the suppression.")
35
- justification: Optional[StrictStr] = Field(default=None, description="A string representing the justification for the suppression.")
36
- location: Optional[Location] = None
37
- properties: Optional[PropertyBag] = None
38
- __properties: ClassVar[List[str]] = ["guid", "kind", "status", "justification", "location", "properties"]
39
-
40
- @field_validator('guid')
41
- def guid_validate_regular_expression(cls, value):
42
- """Validates the regular expression"""
43
- if value is None:
44
- return value
45
-
46
- if not re.match(r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$", value):
47
- raise ValueError(r"must validate the regular expression /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/")
48
- return value
49
-
50
- @field_validator('kind')
51
- def kind_validate_enum(cls, value):
52
- """Validates the enum"""
53
- if value not in set(['inSource', 'external']):
54
- raise ValueError("must be one of enum values ('inSource', 'external')")
55
- return value
56
-
57
- @field_validator('status')
58
- def status_validate_enum(cls, value):
59
- """Validates the enum"""
60
- if value is None:
61
- return value
62
-
63
- if value not in set(['accepted', 'underReview', 'rejected']):
64
- raise ValueError("must be one of enum values ('accepted', 'underReview', 'rejected')")
65
- return value
66
-
67
- model_config = ConfigDict(
68
- populate_by_name=True,
69
- validate_assignment=True,
70
- protected_namespaces=(),
71
- )
72
-
73
-
74
- def to_str(self) -> str:
75
- """Returns the string representation of the model using alias"""
76
- return pprint.pformat(self.model_dump(by_alias=True))
77
-
78
- def to_json(self) -> str:
79
- """Returns the JSON representation of the model using alias"""
80
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
81
- return json.dumps(self.to_dict())
82
-
83
- @classmethod
84
- def from_json(cls, json_str: str) -> Optional[Self]:
85
- """Create an instance of Suppression from a JSON string"""
86
- return cls.from_dict(json.loads(json_str))
87
-
88
- def to_dict(self) -> Dict[str, Any]:
89
- """Return the dictionary representation of the model using alias.
90
-
91
- This has the following differences from calling pydantic's
92
- `self.model_dump(by_alias=True)`:
93
-
94
- * `None` is only added to the output dict for nullable fields that
95
- were set at model initialization. Other fields with value `None`
96
- are ignored.
97
- """
98
- excluded_fields: Set[str] = set([
99
- ])
100
-
101
- _dict = self.model_dump(
102
- by_alias=True,
103
- exclude=excluded_fields,
104
- exclude_none=True,
105
- )
106
- # override the default output from pydantic by calling `to_dict()` of location
107
- if self.location:
108
- _dict['location'] = self.location.to_dict()
109
- # override the default output from pydantic by calling `to_dict()` of properties
110
- if self.properties:
111
- _dict['properties'] = self.properties.to_dict()
112
- return _dict
113
-
114
- @classmethod
115
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
116
- """Create an instance of Suppression from a dict"""
117
- if obj is None:
118
- return None
119
-
120
- if not isinstance(obj, dict):
121
- return cls.model_validate(obj)
122
-
123
- _obj = cls.model_validate({
124
- "guid": obj.get("guid"),
125
- "kind": obj.get("kind"),
126
- "status": obj.get("status"),
127
- "justification": obj.get("justification"),
128
- "location": Location.from_dict(obj["location"]) if obj.get("location") is not None else None,
129
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
130
- })
131
- return _obj
132
-
133
-
@@ -1,144 +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.multiformat_message_string import MultiformatMessageString
25
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
26
- from hiddenlayer.sdk.rest.models.thread_flow_location import ThreadFlowLocation
27
- from typing import Optional, Set
28
- from typing_extensions import Self
29
-
30
- class ThreadFlow(BaseModel):
31
- """
32
- Describes a sequence of code locations that specify a path through a single thread of execution such as an operating system or fiber.
33
- """ # noqa: E501
34
- id: Optional[StrictStr] = Field(default=None, description="An string that uniquely identifies the threadFlow within the codeFlow in which it occurs.")
35
- message: Optional[Message] = None
36
- initial_state: Optional[Dict[str, MultiformatMessageString]] = Field(default=None, description="Values of relevant expressions at the start of the thread flow that may change during thread flow execution.", alias="initialState")
37
- immutable_state: Optional[Dict[str, MultiformatMessageString]] = Field(default=None, description="Values of relevant expressions at the start of the thread flow that remain constant.", alias="immutableState")
38
- locations: Annotated[List[ThreadFlowLocation], Field(min_length=1)] = Field(description="A temporally ordered array of 'threadFlowLocation' objects, each of which describes a location visited by the tool while producing the result.")
39
- properties: Optional[PropertyBag] = None
40
- __properties: ClassVar[List[str]] = ["id", "message", "initialState", "immutableState", "locations", "properties"]
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 ThreadFlow 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
- """
73
- excluded_fields: Set[str] = set([
74
- ])
75
-
76
- _dict = self.model_dump(
77
- by_alias=True,
78
- exclude=excluded_fields,
79
- exclude_none=True,
80
- )
81
- # override the default output from pydantic by calling `to_dict()` of message
82
- if self.message:
83
- _dict['message'] = self.message.to_dict()
84
- # override the default output from pydantic by calling `to_dict()` of each value in initial_state (dict)
85
- _field_dict = {}
86
- if self.initial_state:
87
- for _key in self.initial_state:
88
- if self.initial_state[_key]:
89
- _field_dict[_key] = self.initial_state[_key].to_dict()
90
- _dict['initialState'] = _field_dict
91
- # override the default output from pydantic by calling `to_dict()` of each value in immutable_state (dict)
92
- _field_dict = {}
93
- if self.immutable_state:
94
- for _key in self.immutable_state:
95
- if self.immutable_state[_key]:
96
- _field_dict[_key] = self.immutable_state[_key].to_dict()
97
- _dict['immutableState'] = _field_dict
98
- # override the default output from pydantic by calling `to_dict()` of each item in locations (list)
99
- _items = []
100
- if self.locations:
101
- for _item in self.locations:
102
- if _item:
103
- _items.append(_item.to_dict())
104
- _dict['locations'] = _items
105
- # override the default output from pydantic by calling `to_dict()` of properties
106
- if self.properties:
107
- _dict['properties'] = self.properties.to_dict()
108
- # set to None if message (nullable) is None
109
- # and model_fields_set contains the field
110
- if self.message is None and "message" in self.model_fields_set:
111
- _dict['message'] = None
112
-
113
- return _dict
114
-
115
- @classmethod
116
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
117
- """Create an instance of ThreadFlow from a dict"""
118
- if obj is None:
119
- return None
120
-
121
- if not isinstance(obj, dict):
122
- return cls.model_validate(obj)
123
-
124
- _obj = cls.model_validate({
125
- "id": obj.get("id"),
126
- "message": Message.from_dict(obj["message"]) if obj.get("message") is not None else None,
127
- "initialState": dict(
128
- (_k, MultiformatMessageString.from_dict(_v))
129
- for _k, _v in obj["initialState"].items()
130
- )
131
- if obj.get("initialState") is not None
132
- else None,
133
- "immutableState": dict(
134
- (_k, MultiformatMessageString.from_dict(_v))
135
- for _k, _v in obj["immutableState"].items()
136
- )
137
- if obj.get("immutableState") is not None
138
- else None,
139
- "locations": [ThreadFlowLocation.from_dict(_item) for _item in obj["locations"]] if obj.get("locations") is not None else None,
140
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
141
- })
142
- return _obj
143
-
144
-
@@ -1,166 +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, StrictStr, field_validator
22
- from typing import Any, ClassVar, Dict, List, Optional
23
- from typing_extensions import Annotated
24
- from hiddenlayer.sdk.rest.models.location import Location
25
- from hiddenlayer.sdk.rest.models.multiformat_message_string import MultiformatMessageString
26
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
27
- from hiddenlayer.sdk.rest.models.reporting_descriptor_reference import ReportingDescriptorReference
28
- from hiddenlayer.sdk.rest.models.stack import Stack
29
- from hiddenlayer.sdk.rest.models.web_request import WebRequest
30
- from hiddenlayer.sdk.rest.models.web_response import WebResponse
31
- from typing import Optional, Set
32
- from typing_extensions import Self
33
-
34
- class ThreadFlowLocation(BaseModel):
35
- """
36
- A location visited by an analysis tool while simulating or monitoring the execution of a program.
37
- """ # noqa: E501
38
- index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The index within the run threadFlowLocations array.")
39
- location: Optional[Location] = None
40
- stack: Optional[Stack] = None
41
- kinds: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = Field(default=None, description="A set of distinct strings that categorize the thread flow location. Well-known kinds include 'acquire', 'release', 'enter', 'exit', 'call', 'return', 'branch', 'implicit', 'false', 'true', 'caution', 'danger', 'unknown', 'unreachable', 'taint', 'function', 'handler', 'lock', 'memory', 'resource', 'scope' and 'value'.")
42
- taxa: Optional[Annotated[List[Optional[ReportingDescriptorReference]], Field(min_length=0)]] = Field(default=None, description="An array of references to rule or taxonomy reporting descriptors that are applicable to the thread flow location.")
43
- module: Optional[StrictStr] = Field(default=None, description="The name of the module that contains the code that is executing.")
44
- state: Optional[Dict[str, MultiformatMessageString]] = Field(default=None, description="A dictionary, each of whose keys specifies a variable or expression, the associated value of which represents the variable or expression value. For an annotation of kind 'continuation', for example, this dictionary might hold the current assumed values of a set of global variables.")
45
- nesting_level: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="An integer representing a containment hierarchy within the thread flow.", alias="nestingLevel")
46
- execution_order: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="An integer representing the temporal order in which execution reached this location.", alias="executionOrder")
47
- execution_time_utc: Optional[datetime] = Field(default=None, description="The Coordinated Universal Time (UTC) date and time at which this location was executed.", alias="executionTimeUtc")
48
- importance: Optional[StrictStr] = Field(default='important', description="Specifies the importance of this location in understanding the code flow in which it occurs. The order from most to least important is \"essential\", \"important\", \"unimportant\". Default: \"important\".")
49
- web_request: Optional[WebRequest] = Field(default=None, alias="webRequest")
50
- web_response: Optional[WebResponse] = Field(default=None, alias="webResponse")
51
- properties: Optional[PropertyBag] = None
52
- __properties: ClassVar[List[str]] = ["index", "location", "stack", "kinds", "taxa", "module", "state", "nestingLevel", "executionOrder", "executionTimeUtc", "importance", "webRequest", "webResponse", "properties"]
53
-
54
- @field_validator('importance')
55
- def importance_validate_enum(cls, value):
56
- """Validates the enum"""
57
- if value is None:
58
- return value
59
-
60
- if value not in set(['important', 'essential', 'unimportant']):
61
- raise ValueError("must be one of enum values ('important', 'essential', 'unimportant')")
62
- return value
63
-
64
- model_config = ConfigDict(
65
- populate_by_name=True,
66
- validate_assignment=True,
67
- protected_namespaces=(),
68
- )
69
-
70
-
71
- def to_str(self) -> str:
72
- """Returns the string representation of the model using alias"""
73
- return pprint.pformat(self.model_dump(by_alias=True))
74
-
75
- def to_json(self) -> str:
76
- """Returns the JSON representation of the model using alias"""
77
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
78
- return json.dumps(self.to_dict())
79
-
80
- @classmethod
81
- def from_json(cls, json_str: str) -> Optional[Self]:
82
- """Create an instance of ThreadFlowLocation from a JSON string"""
83
- return cls.from_dict(json.loads(json_str))
84
-
85
- def to_dict(self) -> Dict[str, Any]:
86
- """Return the dictionary representation of the model using alias.
87
-
88
- This has the following differences from calling pydantic's
89
- `self.model_dump(by_alias=True)`:
90
-
91
- * `None` is only added to the output dict for nullable fields that
92
- were set at model initialization. Other fields with value `None`
93
- are ignored.
94
- """
95
- excluded_fields: Set[str] = set([
96
- ])
97
-
98
- _dict = self.model_dump(
99
- by_alias=True,
100
- exclude=excluded_fields,
101
- exclude_none=True,
102
- )
103
- # override the default output from pydantic by calling `to_dict()` of location
104
- if self.location:
105
- _dict['location'] = self.location.to_dict()
106
- # override the default output from pydantic by calling `to_dict()` of stack
107
- if self.stack:
108
- _dict['stack'] = self.stack.to_dict()
109
- # override the default output from pydantic by calling `to_dict()` of each item in taxa (list)
110
- _items = []
111
- if self.taxa:
112
- for _item in self.taxa:
113
- if _item:
114
- _items.append(_item.to_dict())
115
- _dict['taxa'] = _items
116
- # override the default output from pydantic by calling `to_dict()` of each value in state (dict)
117
- _field_dict = {}
118
- if self.state:
119
- for _key in self.state:
120
- if self.state[_key]:
121
- _field_dict[_key] = self.state[_key].to_dict()
122
- _dict['state'] = _field_dict
123
- # override the default output from pydantic by calling `to_dict()` of web_request
124
- if self.web_request:
125
- _dict['webRequest'] = self.web_request.to_dict()
126
- # override the default output from pydantic by calling `to_dict()` of web_response
127
- if self.web_response:
128
- _dict['webResponse'] = self.web_response.to_dict()
129
- # override the default output from pydantic by calling `to_dict()` of properties
130
- if self.properties:
131
- _dict['properties'] = self.properties.to_dict()
132
- return _dict
133
-
134
- @classmethod
135
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
136
- """Create an instance of ThreadFlowLocation from a dict"""
137
- if obj is None:
138
- return None
139
-
140
- if not isinstance(obj, dict):
141
- return cls.model_validate(obj)
142
-
143
- _obj = cls.model_validate({
144
- "index": obj.get("index") if obj.get("index") is not None else -1,
145
- "location": Location.from_dict(obj["location"]) if obj.get("location") is not None else None,
146
- "stack": Stack.from_dict(obj["stack"]) if obj.get("stack") is not None else None,
147
- "kinds": obj.get("kinds"),
148
- "taxa": [ReportingDescriptorReference.from_dict(_item) for _item in obj["taxa"]] if obj.get("taxa") is not None else None,
149
- "module": obj.get("module"),
150
- "state": dict(
151
- (_k, MultiformatMessageString.from_dict(_v))
152
- for _k, _v in obj["state"].items()
153
- )
154
- if obj.get("state") is not None
155
- else None,
156
- "nestingLevel": obj.get("nestingLevel"),
157
- "executionOrder": obj.get("executionOrder") if obj.get("executionOrder") is not None else -1,
158
- "executionTimeUtc": obj.get("executionTimeUtc"),
159
- "importance": obj.get("importance") if obj.get("importance") is not None else 'important',
160
- "webRequest": WebRequest.from_dict(obj["webRequest"]) if obj.get("webRequest") is not None else None,
161
- "webResponse": WebResponse.from_dict(obj["webResponse"]) if obj.get("webResponse") is not None else None,
162
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
163
- })
164
- return _obj
165
-
166
-
@@ -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
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing_extensions import Annotated
23
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
24
- from hiddenlayer.sdk.rest.models.tool_component import ToolComponent
25
- from typing import Optional, Set
26
- from typing_extensions import Self
27
-
28
- class Tool(BaseModel):
29
- """
30
- The analysis tool that was run.
31
- """ # noqa: E501
32
- driver: ToolComponent
33
- extensions: Optional[Annotated[List[ToolComponent], Field(min_length=0)]] = Field(default=None, description="Tool extensions that contributed to or reconfigured the analysis tool that was run.")
34
- properties: Optional[PropertyBag] = None
35
- __properties: ClassVar[List[str]] = ["driver", "extensions", "properties"]
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 Tool 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 driver
77
- if self.driver:
78
- _dict['driver'] = self.driver.to_dict()
79
- # override the default output from pydantic by calling `to_dict()` of each item in extensions (list)
80
- _items = []
81
- if self.extensions:
82
- for _item in self.extensions:
83
- if _item:
84
- _items.append(_item.to_dict())
85
- _dict['extensions'] = _items
86
- # override the default output from pydantic by calling `to_dict()` of properties
87
- if self.properties:
88
- _dict['properties'] = self.properties.to_dict()
89
- return _dict
90
-
91
- @classmethod
92
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
- """Create an instance of Tool 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
- "driver": ToolComponent.from_dict(obj["driver"]) if obj.get("driver") is not None else None,
102
- "extensions": [ToolComponent.from_dict(_item) for _item in obj["extensions"]] if obj.get("extensions") 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
-