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,251 +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, StrictBool, StrictStr, field_validator
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing_extensions import Annotated
23
- from hiddenlayer.sdk.rest.models.artifact_location import ArtifactLocation
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.reporting_descriptor import ReportingDescriptor
27
- from hiddenlayer.sdk.rest.models.tool_component_reference import ToolComponentReference
28
- from hiddenlayer.sdk.rest.models.translation_metadata import TranslationMetadata
29
- from typing import Optional, Set
30
- from typing_extensions import Self
31
-
32
- class ToolComponent(BaseModel):
33
- """
34
- A component, such as a plug-in or the driver, of the analysis tool that was run.
35
- """ # noqa: E501
36
- guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A unique identifier for the tool component in the form of a GUID.")
37
- name: StrictStr = Field(description="The name of the tool component.")
38
- organization: Optional[StrictStr] = Field(default=None, description="The organization or company that produced the tool component.")
39
- product: Optional[StrictStr] = Field(default=None, description="A product suite to which the tool component belongs.")
40
- product_suite: Optional[StrictStr] = Field(default=None, description="A localizable string containing the name of the suite of products to which the tool component belongs.", alias="productSuite")
41
- short_description: Optional[MultiformatMessageString] = Field(default=None, alias="shortDescription")
42
- full_description: Optional[MultiformatMessageString] = Field(default=None, alias="fullDescription")
43
- full_name: Optional[StrictStr] = Field(default=None, description="The name of the tool component along with its version and any other useful identifying information, such as its locale.", alias="fullName")
44
- version: Optional[StrictStr] = Field(default=None, description="The tool component version, in whatever format the component natively provides.")
45
- semantic_version: Optional[StrictStr] = Field(default=None, description="The tool component version in the format specified by Semantic Versioning 2.0.", alias="semanticVersion")
46
- dotted_quad_file_version: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The binary version of the tool component's primary executable file expressed as four non-negative integers separated by a period (for operating systems that express file versions in this way).", alias="dottedQuadFileVersion")
47
- release_date_utc: Optional[StrictStr] = Field(default=None, description="A string specifying the UTC date (and optionally, the time) of the component's release.", alias="releaseDateUtc")
48
- download_uri: Optional[StrictStr] = Field(default=None, description="The absolute URI from which the tool component can be downloaded.", alias="downloadUri")
49
- information_uri: Optional[StrictStr] = Field(default=None, description="The absolute URI at which information about this version of the tool component can be found.", alias="informationUri")
50
- global_message_strings: Optional[Dict[str, MultiformatMessageString]] = Field(default=None, description="A dictionary, each of whose keys is a resource identifier and each of whose values is a multiformatMessageString object, which holds message strings in plain text and (optionally) Markdown format. The strings can include placeholders, which can be used to construct a message in combination with an arbitrary number of additional string arguments.", alias="globalMessageStrings")
51
- notifications: Optional[Annotated[List[ReportingDescriptor], Field(min_length=0)]] = Field(default=None, description="An array of reportingDescriptor objects relevant to the notifications related to the configuration and runtime execution of the tool component.")
52
- rules: Optional[Annotated[List[ReportingDescriptor], Field(min_length=0)]] = Field(default=None, description="An array of reportingDescriptor objects relevant to the analysis performed by the tool component.")
53
- taxa: Optional[Annotated[List[ReportingDescriptor], Field(min_length=0)]] = Field(default=None, description="An array of reportingDescriptor objects relevant to the definitions of both standalone and tool-defined taxonomies.")
54
- locations: Optional[Annotated[List[ArtifactLocation], Field(min_length=0)]] = Field(default=None, description="An array of the artifactLocation objects associated with the tool component.")
55
- language: Optional[Annotated[str, Field(strict=True)]] = Field(default='en-US', description="The language of the messages emitted into the log file during this run (expressed as an ISO 639-1 two-letter lowercase language code) and an optional region (expressed as an ISO 3166-1 two-letter uppercase subculture code associated with a country or region). The casing is recommended but not required (in order for this data to conform to RFC5646).")
56
- contents: Optional[List[StrictStr]] = Field(default=None, description="The kinds of data contained in this object.")
57
- is_comprehensive: Optional[StrictBool] = Field(default=False, description="Specifies whether this object contains a complete definition of the localizable and/or non-localizable data for this component, as opposed to including only data that is relevant to the results persisted to this log file.", alias="isComprehensive")
58
- localized_data_semantic_version: Optional[StrictStr] = Field(default=None, description="The semantic version of the localized strings defined in this component; maintained by components that provide translations.", alias="localizedDataSemanticVersion")
59
- minimum_required_localized_data_semantic_version: Optional[StrictStr] = Field(default=None, description="The minimum value of localizedDataSemanticVersion required in translations consumed by this component; used by components that consume translations.", alias="minimumRequiredLocalizedDataSemanticVersion")
60
- associated_component: Optional[ToolComponentReference] = Field(default=None, alias="associatedComponent")
61
- translation_metadata: Optional[TranslationMetadata] = Field(default=None, alias="translationMetadata")
62
- supported_taxonomies: Optional[Annotated[List[ToolComponentReference], Field(min_length=0)]] = Field(default=None, description="An array of toolComponentReference objects to declare the taxonomies supported by the tool component.", alias="supportedTaxonomies")
63
- properties: Optional[PropertyBag] = None
64
- __properties: ClassVar[List[str]] = ["guid", "name", "organization", "product", "productSuite", "shortDescription", "fullDescription", "fullName", "version", "semanticVersion", "dottedQuadFileVersion", "releaseDateUtc", "downloadUri", "informationUri", "globalMessageStrings", "notifications", "rules", "taxa", "locations", "language", "contents", "isComprehensive", "localizedDataSemanticVersion", "minimumRequiredLocalizedDataSemanticVersion", "associatedComponent", "translationMetadata", "supportedTaxonomies", "properties"]
65
-
66
- @field_validator('guid')
67
- def guid_validate_regular_expression(cls, value):
68
- """Validates the regular expression"""
69
- if value is None:
70
- return value
71
-
72
- 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):
73
- 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}$/")
74
- return value
75
-
76
- @field_validator('dotted_quad_file_version')
77
- def dotted_quad_file_version_validate_regular_expression(cls, value):
78
- """Validates the regular expression"""
79
- if value is None:
80
- return value
81
-
82
- if not re.match(r"[0-9]+(\.[0-9]+){3}", value):
83
- raise ValueError(r"must validate the regular expression /[0-9]+(\.[0-9]+){3}/")
84
- return value
85
-
86
- @field_validator('language')
87
- def language_validate_regular_expression(cls, value):
88
- """Validates the regular expression"""
89
- if value is None:
90
- return value
91
-
92
- if not re.match(r"^[a-zA-Z]{2}|^[a-zA-Z]{2}-[a-zA-Z]{2}?$", value):
93
- raise ValueError(r"must validate the regular expression /^[a-zA-Z]{2}|^[a-zA-Z]{2}-[a-zA-Z]{2}?$/")
94
- return value
95
-
96
- @field_validator('contents')
97
- def contents_validate_enum(cls, value):
98
- """Validates the enum"""
99
- if value is None:
100
- return value
101
-
102
- for i in value:
103
- if i not in set(['localizedData', 'nonLocalizedData']):
104
- raise ValueError("each list item must be one of ('localizedData', 'nonLocalizedData')")
105
- return value
106
-
107
- model_config = ConfigDict(
108
- populate_by_name=True,
109
- validate_assignment=True,
110
- protected_namespaces=(),
111
- )
112
-
113
-
114
- def to_str(self) -> str:
115
- """Returns the string representation of the model using alias"""
116
- return pprint.pformat(self.model_dump(by_alias=True))
117
-
118
- def to_json(self) -> str:
119
- """Returns the JSON representation of the model using alias"""
120
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
121
- return json.dumps(self.to_dict())
122
-
123
- @classmethod
124
- def from_json(cls, json_str: str) -> Optional[Self]:
125
- """Create an instance of ToolComponent from a JSON string"""
126
- return cls.from_dict(json.loads(json_str))
127
-
128
- def to_dict(self) -> Dict[str, Any]:
129
- """Return the dictionary representation of the model using alias.
130
-
131
- This has the following differences from calling pydantic's
132
- `self.model_dump(by_alias=True)`:
133
-
134
- * `None` is only added to the output dict for nullable fields that
135
- were set at model initialization. Other fields with value `None`
136
- are ignored.
137
- """
138
- excluded_fields: Set[str] = set([
139
- ])
140
-
141
- _dict = self.model_dump(
142
- by_alias=True,
143
- exclude=excluded_fields,
144
- exclude_none=True,
145
- )
146
- # override the default output from pydantic by calling `to_dict()` of short_description
147
- if self.short_description:
148
- _dict['shortDescription'] = self.short_description.to_dict()
149
- # override the default output from pydantic by calling `to_dict()` of full_description
150
- if self.full_description:
151
- _dict['fullDescription'] = self.full_description.to_dict()
152
- # override the default output from pydantic by calling `to_dict()` of each value in global_message_strings (dict)
153
- _field_dict = {}
154
- if self.global_message_strings:
155
- for _key in self.global_message_strings:
156
- if self.global_message_strings[_key]:
157
- _field_dict[_key] = self.global_message_strings[_key].to_dict()
158
- _dict['globalMessageStrings'] = _field_dict
159
- # override the default output from pydantic by calling `to_dict()` of each item in notifications (list)
160
- _items = []
161
- if self.notifications:
162
- for _item in self.notifications:
163
- if _item:
164
- _items.append(_item.to_dict())
165
- _dict['notifications'] = _items
166
- # override the default output from pydantic by calling `to_dict()` of each item in rules (list)
167
- _items = []
168
- if self.rules:
169
- for _item in self.rules:
170
- if _item:
171
- _items.append(_item.to_dict())
172
- _dict['rules'] = _items
173
- # override the default output from pydantic by calling `to_dict()` of each item in taxa (list)
174
- _items = []
175
- if self.taxa:
176
- for _item in self.taxa:
177
- if _item:
178
- _items.append(_item.to_dict())
179
- _dict['taxa'] = _items
180
- # override the default output from pydantic by calling `to_dict()` of each item in locations (list)
181
- _items = []
182
- if self.locations:
183
- for _item in self.locations:
184
- if _item:
185
- _items.append(_item.to_dict())
186
- _dict['locations'] = _items
187
- # override the default output from pydantic by calling `to_dict()` of associated_component
188
- if self.associated_component:
189
- _dict['associatedComponent'] = self.associated_component.to_dict()
190
- # override the default output from pydantic by calling `to_dict()` of translation_metadata
191
- if self.translation_metadata:
192
- _dict['translationMetadata'] = self.translation_metadata.to_dict()
193
- # override the default output from pydantic by calling `to_dict()` of each item in supported_taxonomies (list)
194
- _items = []
195
- if self.supported_taxonomies:
196
- for _item in self.supported_taxonomies:
197
- if _item:
198
- _items.append(_item.to_dict())
199
- _dict['supportedTaxonomies'] = _items
200
- # override the default output from pydantic by calling `to_dict()` of properties
201
- if self.properties:
202
- _dict['properties'] = self.properties.to_dict()
203
- return _dict
204
-
205
- @classmethod
206
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
207
- """Create an instance of ToolComponent from a dict"""
208
- if obj is None:
209
- return None
210
-
211
- if not isinstance(obj, dict):
212
- return cls.model_validate(obj)
213
-
214
- _obj = cls.model_validate({
215
- "guid": obj.get("guid"),
216
- "name": obj.get("name"),
217
- "organization": obj.get("organization"),
218
- "product": obj.get("product"),
219
- "productSuite": obj.get("productSuite"),
220
- "shortDescription": MultiformatMessageString.from_dict(obj["shortDescription"]) if obj.get("shortDescription") is not None else None,
221
- "fullDescription": MultiformatMessageString.from_dict(obj["fullDescription"]) if obj.get("fullDescription") is not None else None,
222
- "fullName": obj.get("fullName"),
223
- "version": obj.get("version"),
224
- "semanticVersion": obj.get("semanticVersion"),
225
- "dottedQuadFileVersion": obj.get("dottedQuadFileVersion"),
226
- "releaseDateUtc": obj.get("releaseDateUtc"),
227
- "downloadUri": obj.get("downloadUri"),
228
- "informationUri": obj.get("informationUri"),
229
- "globalMessageStrings": dict(
230
- (_k, MultiformatMessageString.from_dict(_v))
231
- for _k, _v in obj["globalMessageStrings"].items()
232
- )
233
- if obj.get("globalMessageStrings") is not None
234
- else None,
235
- "notifications": [ReportingDescriptor.from_dict(_item) for _item in obj["notifications"]] if obj.get("notifications") is not None else None,
236
- "rules": [ReportingDescriptor.from_dict(_item) for _item in obj["rules"]] if obj.get("rules") is not None else None,
237
- "taxa": [ReportingDescriptor.from_dict(_item) for _item in obj["taxa"]] if obj.get("taxa") is not None else None,
238
- "locations": [ArtifactLocation.from_dict(_item) for _item in obj["locations"]] if obj.get("locations") is not None else None,
239
- "language": obj.get("language") if obj.get("language") is not None else 'en-US',
240
- "contents": obj.get("contents"),
241
- "isComprehensive": obj.get("isComprehensive") if obj.get("isComprehensive") is not None else False,
242
- "localizedDataSemanticVersion": obj.get("localizedDataSemanticVersion"),
243
- "minimumRequiredLocalizedDataSemanticVersion": obj.get("minimumRequiredLocalizedDataSemanticVersion"),
244
- "associatedComponent": ToolComponentReference.from_dict(obj["associatedComponent"]) if obj.get("associatedComponent") is not None else None,
245
- "translationMetadata": TranslationMetadata.from_dict(obj["translationMetadata"]) if obj.get("translationMetadata") is not None else None,
246
- "supportedTaxonomies": [ToolComponentReference.from_dict(_item) for _item in obj["supportedTaxonomies"]] if obj.get("supportedTaxonomies") is not None else None,
247
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
248
- })
249
- return _obj
250
-
251
-
@@ -1,108 +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.property_bag import PropertyBag
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class ToolComponentReference(BaseModel):
28
- """
29
- Identifies a particular toolComponent object, either the driver or an extension.
30
- """ # noqa: E501
31
- name: Optional[StrictStr] = Field(default=None, description="The 'name' property of the referenced toolComponent.")
32
- index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="An index into the referenced toolComponent in tool.extensions.")
33
- guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The 'guid' property of the referenced toolComponent.")
34
- properties: Optional[PropertyBag] = None
35
- __properties: ClassVar[List[str]] = ["name", "index", "guid", "properties"]
36
-
37
- @field_validator('guid')
38
- def guid_validate_regular_expression(cls, value):
39
- """Validates the regular expression"""
40
- if value is None:
41
- return value
42
-
43
- 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):
44
- 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}$/")
45
- return value
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 ToolComponentReference 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 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 ToolComponentReference 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
- "name": obj.get("name"),
102
- "index": obj.get("index") if obj.get("index") is not None else -1,
103
- "guid": obj.get("guid"),
104
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
105
- })
106
- return _obj
107
-
108
-
@@ -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, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from hiddenlayer.sdk.rest.models.multiformat_message_string import MultiformatMessageString
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 TranslationMetadata(BaseModel):
28
- """
29
- Provides additional metadata related to translation.
30
- """ # noqa: E501
31
- name: StrictStr = Field(description="The name associated with the translation metadata.")
32
- full_name: Optional[StrictStr] = Field(default=None, description="The full name associated with the translation metadata.", alias="fullName")
33
- short_description: Optional[MultiformatMessageString] = Field(default=None, alias="shortDescription")
34
- full_description: Optional[MultiformatMessageString] = Field(default=None, alias="fullDescription")
35
- download_uri: Optional[StrictStr] = Field(default=None, description="The absolute URI from which the translation metadata can be downloaded.", alias="downloadUri")
36
- information_uri: Optional[StrictStr] = Field(default=None, description="The absolute URI from which information related to the translation metadata can be downloaded.", alias="informationUri")
37
- properties: Optional[PropertyBag] = None
38
- __properties: ClassVar[List[str]] = ["name", "fullName", "shortDescription", "fullDescription", "downloadUri", "informationUri", "properties"]
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 TranslationMetadata 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
- # override the default output from pydantic by calling `to_dict()` of short_description
80
- if self.short_description:
81
- _dict['shortDescription'] = self.short_description.to_dict()
82
- # override the default output from pydantic by calling `to_dict()` of full_description
83
- if self.full_description:
84
- _dict['fullDescription'] = self.full_description.to_dict()
85
- # override the default output from pydantic by calling `to_dict()` of properties
86
- if self.properties:
87
- _dict['properties'] = self.properties.to_dict()
88
- return _dict
89
-
90
- @classmethod
91
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
- """Create an instance of TranslationMetadata 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
- "name": obj.get("name"),
101
- "fullName": obj.get("fullName"),
102
- "shortDescription": MultiformatMessageString.from_dict(obj["shortDescription"]) if obj.get("shortDescription") is not None else None,
103
- "fullDescription": MultiformatMessageString.from_dict(obj["fullDescription"]) if obj.get("fullDescription") is not None else None,
104
- "downloadUri": obj.get("downloadUri"),
105
- "informationUri": obj.get("informationUri"),
106
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
107
- })
108
- return _obj
109
-
110
-
@@ -1,99 +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, StrictStr
21
- from typing import Any, ClassVar, Dict, List
22
- from hiddenlayer.sdk.rest.models.location_inner import LocationInner
23
- from typing import Optional, Set
24
- from typing_extensions import Self
25
-
26
- class ValidationErrorModel(BaseModel):
27
- """
28
- ValidationErrorModel
29
- """ # noqa: E501
30
- loc: List[LocationInner]
31
- msg: StrictStr
32
- type: StrictStr
33
- __properties: ClassVar[List[str]] = ["loc", "msg", "type"]
34
-
35
- model_config = ConfigDict(
36
- populate_by_name=True,
37
- validate_assignment=True,
38
- protected_namespaces=(),
39
- )
40
-
41
-
42
- def to_str(self) -> str:
43
- """Returns the string representation of the model using alias"""
44
- return pprint.pformat(self.model_dump(by_alias=True))
45
-
46
- def to_json(self) -> str:
47
- """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
-
51
- @classmethod
52
- def from_json(cls, json_str: str) -> Optional[Self]:
53
- """Create an instance of ValidationErrorModel from a JSON string"""
54
- return cls.from_dict(json.loads(json_str))
55
-
56
- def to_dict(self) -> Dict[str, Any]:
57
- """Return the dictionary representation of the model using alias.
58
-
59
- This has the following differences from calling pydantic's
60
- `self.model_dump(by_alias=True)`:
61
-
62
- * `None` is only added to the output dict for nullable fields that
63
- were set at model initialization. Other fields with value `None`
64
- are ignored.
65
- """
66
- excluded_fields: Set[str] = set([
67
- ])
68
-
69
- _dict = self.model_dump(
70
- by_alias=True,
71
- exclude=excluded_fields,
72
- exclude_none=True,
73
- )
74
- # override the default output from pydantic by calling `to_dict()` of each item in loc (list)
75
- _items = []
76
- if self.loc:
77
- for _item in self.loc:
78
- if _item:
79
- _items.append(_item.to_dict())
80
- _dict['loc'] = _items
81
- return _dict
82
-
83
- @classmethod
84
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
- """Create an instance of ValidationErrorModel from a dict"""
86
- if obj is None:
87
- return None
88
-
89
- if not isinstance(obj, dict):
90
- return cls.model_validate(obj)
91
-
92
- _obj = cls.model_validate({
93
- "loc": [LocationInner.from_dict(_item) for _item in obj["loc"]] if obj.get("loc") is not None else None,
94
- "msg": obj.get("msg"),
95
- "type": obj.get("type")
96
- })
97
- return _obj
98
-
99
-