revengai 1.96.1__py3-none-any.whl → 1.98.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.

Potentially problematic release.


This version of revengai might be problematic. Click here for more details.

revengai/__init__.py CHANGED
@@ -13,7 +13,7 @@
13
13
  """ # noqa: E501
14
14
 
15
15
 
16
- __version__ = "v1.96.1"
16
+ __version__ = "v1.98.1"
17
17
 
18
18
  # Define package exports
19
19
  __all__ = [
@@ -307,8 +307,6 @@ __all__ = [
307
307
  "SBOMPackage",
308
308
  "SandboxOptions",
309
309
  "ScrapeThirdPartyConfig",
310
- "SearchBinaryIds",
311
- "SearchFunctionIds",
312
310
  "SectionModel",
313
311
  "SecurityChecksResponse",
314
312
  "SecurityChecksResult",
@@ -649,8 +647,6 @@ from revengai.models.sbom import SBOM as SBOM
649
647
  from revengai.models.sbom_package import SBOMPackage as SBOMPackage
650
648
  from revengai.models.sandbox_options import SandboxOptions as SandboxOptions
651
649
  from revengai.models.scrape_third_party_config import ScrapeThirdPartyConfig as ScrapeThirdPartyConfig
652
- from revengai.models.search_binary_ids import SearchBinaryIds as SearchBinaryIds
653
- from revengai.models.search_function_ids import SearchFunctionIds as SearchFunctionIds
654
650
  from revengai.models.section_model import SectionModel as SectionModel
655
651
  from revengai.models.security_checks_response import SecurityChecksResponse as SecurityChecksResponse
656
652
  from revengai.models.security_checks_result import SecurityChecksResult as SecurityChecksResult
revengai/api_client.py CHANGED
@@ -90,7 +90,7 @@ class ApiClient:
90
90
  self.default_headers[header_name] = header_value
91
91
  self.cookie = cookie
92
92
  # Set default User-Agent.
93
- self.user_agent = 'OpenAPI-Generator/v1.96.1/python'
93
+ self.user_agent = 'OpenAPI-Generator/v1.98.1/python'
94
94
  self.client_side_validation = configuration.client_side_validation
95
95
 
96
96
  def __enter__(self):
revengai/configuration.py CHANGED
@@ -529,8 +529,8 @@ conf = revengai.Configuration(
529
529
  return "Python SDK Debug Report:\n"\
530
530
  "OS: {env}\n"\
531
531
  "Python Version: {pyversion}\n"\
532
- "Version of the API: v1.96.1\n"\
533
- "SDK Package Version: v1.96.1".\
532
+ "Version of the API: v1.98.1\n"\
533
+ "SDK Package Version: v1.98.1".\
534
534
  format(env=sys.platform, pyversion=sys.version)
535
535
 
536
536
  def get_host_settings(self) -> List[HostSetting]:
@@ -274,8 +274,6 @@ from revengai.models.sbom import SBOM
274
274
  from revengai.models.sbom_package import SBOMPackage
275
275
  from revengai.models.sandbox_options import SandboxOptions
276
276
  from revengai.models.scrape_third_party_config import ScrapeThirdPartyConfig
277
- from revengai.models.search_binary_ids import SearchBinaryIds
278
- from revengai.models.search_function_ids import SearchFunctionIds
279
277
  from revengai.models.section_model import SectionModel
280
278
  from revengai.models.security_checks_response import SecurityChecksResponse
281
279
  from revengai.models.security_checks_result import SecurityChecksResult
@@ -19,8 +19,6 @@ import json
19
19
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt
20
20
  from typing import Any, ClassVar, Dict, List, Optional, Union
21
21
  from typing_extensions import Annotated
22
- from revengai.models.search_binary_ids import SearchBinaryIds
23
- from revengai.models.search_function_ids import SearchFunctionIds
24
22
  from typing import Optional, Set
25
23
  from typing_extensions import Self
26
24
 
@@ -32,8 +30,8 @@ class AppApiRestV2SimilaritySchemaANNFunction(BaseModel):
32
30
  distance: Optional[Union[StrictFloat, StrictInt]] = Field(default=0.1, description="The distance between two neighbours")
33
31
  analysis_search_ids: Optional[List[Optional[StrictInt]]] = Field(default=None, description="Perform a search on functions within a list of analyses")
34
32
  collection_search_ids: Optional[Annotated[List[Optional[StrictInt]], Field(max_length=5)]] = Field(default=None, description="Search only within these collections")
35
- search_binary_ids: Optional[SearchBinaryIds] = None
36
- search_function_ids: Optional[SearchFunctionIds] = None
33
+ search_binary_ids: Optional[List[StrictInt]] = None
34
+ search_function_ids: Optional[List[StrictInt]] = None
37
35
  debug_only: Optional[StrictBool] = Field(default=False, description="Searches for only functions which are debug")
38
36
  additional_properties: Dict[str, Any] = {}
39
37
  __properties: ClassVar[List[str]] = ["limit", "distance", "analysis_search_ids", "collection_search_ids", "search_binary_ids", "search_function_ids", "debug_only"]
@@ -79,17 +77,21 @@ class AppApiRestV2SimilaritySchemaANNFunction(BaseModel):
79
77
  exclude=excluded_fields,
80
78
  exclude_none=True,
81
79
  )
82
- # override the default output from pydantic by calling `to_dict()` of search_binary_ids
83
- if self.search_binary_ids:
84
- _dict['search_binary_ids'] = self.search_binary_ids.to_dict()
85
- # override the default output from pydantic by calling `to_dict()` of search_function_ids
86
- if self.search_function_ids:
87
- _dict['search_function_ids'] = self.search_function_ids.to_dict()
88
80
  # puts key-value pairs in additional_properties in the top level
89
81
  if self.additional_properties is not None:
90
82
  for _key, _value in self.additional_properties.items():
91
83
  _dict[_key] = _value
92
84
 
85
+ # set to None if search_binary_ids (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.search_binary_ids is None and "search_binary_ids" in self.model_fields_set:
88
+ _dict['search_binary_ids'] = None
89
+
90
+ # set to None if search_function_ids (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.search_function_ids is None and "search_function_ids" in self.model_fields_set:
93
+ _dict['search_function_ids'] = None
94
+
93
95
  return _dict
94
96
 
95
97
  @classmethod
@@ -106,8 +108,8 @@ class AppApiRestV2SimilaritySchemaANNFunction(BaseModel):
106
108
  "distance": obj.get("distance") if obj.get("distance") is not None else 0.1,
107
109
  "analysis_search_ids": obj.get("analysis_search_ids"),
108
110
  "collection_search_ids": obj.get("collection_search_ids"),
109
- "search_binary_ids": SearchBinaryIds.from_dict(obj["search_binary_ids"]) if obj.get("search_binary_ids") is not None else None,
110
- "search_function_ids": SearchFunctionIds.from_dict(obj["search_function_ids"]) if obj.get("search_function_ids") is not None else None,
111
+ "search_binary_ids": obj.get("search_binary_ids"),
112
+ "search_function_ids": obj.get("search_function_ids"),
111
113
  "debug_only": obj.get("debug_only") if obj.get("debug_only") is not None else False
112
114
  })
113
115
  # store additional fields in additional_properties
@@ -17,7 +17,7 @@ import re # noqa: F401
17
17
  import json
18
18
 
19
19
  from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
20
- from typing import Any, ClassVar, Dict, List
20
+ from typing import Any, ClassVar, Dict, List, Optional
21
21
  from typing import Optional, Set
22
22
  from typing_extensions import Self
23
23
 
@@ -27,8 +27,9 @@ class MatchedFunctionSuggestion(BaseModel):
27
27
  """ # noqa: E501
28
28
  function_id: StrictInt = Field(description="Unique identifier of the matched function")
29
29
  function_vaddr: StrictInt = Field(description="Virtual address of the matched function")
30
- suggested_name: StrictStr = Field(description="Name of the function group that contains the matched functions")
31
- __properties: ClassVar[List[str]] = ["function_id", "function_vaddr", "suggested_name"]
30
+ suggested_name: Optional[StrictStr] = None
31
+ suggested_demangled_name: StrictStr = Field(description="De-mangled name of the function group that contains the matched functions")
32
+ __properties: ClassVar[List[str]] = ["function_id", "function_vaddr", "suggested_name", "suggested_demangled_name"]
32
33
 
33
34
  model_config = ConfigDict(
34
35
  populate_by_name=True,
@@ -69,6 +70,11 @@ class MatchedFunctionSuggestion(BaseModel):
69
70
  exclude=excluded_fields,
70
71
  exclude_none=True,
71
72
  )
73
+ # set to None if suggested_name (nullable) is None
74
+ # and model_fields_set contains the field
75
+ if self.suggested_name is None and "suggested_name" in self.model_fields_set:
76
+ _dict['suggested_name'] = None
77
+
72
78
  return _dict
73
79
 
74
80
  @classmethod
@@ -83,7 +89,8 @@ class MatchedFunctionSuggestion(BaseModel):
83
89
  _obj = cls.model_validate({
84
90
  "function_id": obj.get("function_id"),
85
91
  "function_vaddr": obj.get("function_vaddr"),
86
- "suggested_name": obj.get("suggested_name")
92
+ "suggested_name": obj.get("suggested_name"),
93
+ "suggested_demangled_name": obj.get("suggested_demangled_name")
87
94
  })
88
95
  return _obj
89
96
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: revengai
3
- Version: 1.96.1
3
+ Version: 1.98.1
4
4
  Summary: RevEng.AI API
5
5
  Project-URL: Repository, https://github.com/RevEngAI/sdk-python
6
6
  License-Expression: MIT
@@ -437,8 +437,6 @@ Class | Method | HTTP request | Description
437
437
  - [SBOMPackage](docs/SBOMPackage.md)
438
438
  - [SandboxOptions](docs/SandboxOptions.md)
439
439
  - [ScrapeThirdPartyConfig](docs/ScrapeThirdPartyConfig.md)
440
- - [SearchBinaryIds](docs/SearchBinaryIds.md)
441
- - [SearchFunctionIds](docs/SearchFunctionIds.md)
442
440
  - [SectionModel](docs/SectionModel.md)
443
441
  - [SecurityChecksResponse](docs/SecurityChecksResponse.md)
444
442
  - [SecurityChecksResult](docs/SecurityChecksResult.md)
@@ -1,7 +1,7 @@
1
- revengai/__init__.py,sha256=UdWpRejtchp93a_3xsC9_x_M5ABlwLHrNi4TpV9uQgw,43030
2
- revengai/api_client.py,sha256=Xe4mlx0nDAoOIl_EUYmXgyClI8242F2A7Fl3Fq0Gsx0,27670
1
+ revengai/__init__.py,sha256=OaP7mF59vanZLYcO21Uz8_WhpJznwcDgzrnjj2REepk,42814
2
+ revengai/api_client.py,sha256=Rng7ZIhmzR0IZ3s4Rv3llKulGJfmqXEGQ41QdGIbUrE,27670
3
3
  revengai/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
4
- revengai/configuration.py,sha256=OcCQgXmySYM3_xPvJd_yr1zTDnlDGVio2RLxhKs0ENQ,18749
4
+ revengai/configuration.py,sha256=XitrnH1SvZRyYl_lVbjouzF9BnHCthOWW9bApTCu2Nw,18749
5
5
  revengai/exceptions.py,sha256=IvdI9ZIZ9b2lSSKtIKMQDlG-5UPAedrjm3U4xfmGkso,6385
6
6
  revengai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  revengai/rest.py,sha256=T6Q2dcazhntqm288H33BKC1hf8NVdvmQWgaymlJo158,9376
@@ -25,7 +25,7 @@ revengai/api/functions_decompilation_api.py,sha256=93tId0XHIUo8zPdCwoFShyvZPbptn
25
25
  revengai/api/functions_renaming_history_api.py,sha256=2VuhjQliFO0rDcwmnl4s5BA36xgEtps2_qZdsqQI6hw,44111
26
26
  revengai/api/models_api.py,sha256=jZ1wY48GT0JsxY-DgcwkxF5uyQTqygUYOuF8De0BQnw,10402
27
27
  revengai/api/search_api.py,sha256=WQslQMX-fExlxONkJVy4MMfQ0VnDxqzJumYc9dbcRp0,63402
28
- revengai/models/__init__.py,sha256=VbAbhW_IfAT9hJ5G1j3wcVNqZutdLPts9QHsZg7ndvY,23237
28
+ revengai/models/__init__.py,sha256=asYS-jImJkrcosJVM8iH_uOCEoqrLI0Sdb3RYuGISI8,23109
29
29
  revengai/models/addr.py,sha256=-2N-UQsOiZ0eyEAQ7ssk0of8W2fBrXeYdTZXuVt3SZs,4787
30
30
  revengai/models/ai_decompilation_rating.py,sha256=gyay27QJwToUNtK9NARyw731Sg8GFRTufGGUABVYyfo,722
31
31
  revengai/models/ai_unstrip_request.py,sha256=loSXNdHATJmY5yttiUCE-lLEOkuE63qVDTz8U0eCAIc,2596
@@ -51,7 +51,7 @@ revengai/models/app_api_rest_v2_analyses_responses_tag_item.py,sha256=Clh9pPBQKq
51
51
  revengai/models/app_api_rest_v2_collections_enums_order_by.py,sha256=IVV9Auj0-HwTYYI0ZvJv-P3ciLOkq0l7MOyy0A5s92I,846
52
52
  revengai/models/app_api_rest_v2_functions_responses_function.py,sha256=tZrWMSf_1tfRg-3P0x5VI-H2njrIMyYazLSIwjzlsoQ,2627
53
53
  revengai/models/app_api_rest_v2_functions_types_function.py,sha256=_5c3oqbCqBO7ubRdycgt6yyxrHCKneibiWlNyoG1Uvc,3869
54
- revengai/models/app_api_rest_v2_similarity_schema_ann_function.py,sha256=atfQz2txuf_4MdDNFsnZabN_vMOGMnoyDjElT4VeAwY,5258
54
+ revengai/models/app_api_rest_v2_similarity_schema_ann_function.py,sha256=VNlSiXWxEv3LsjbuN-n4DU5zjXN_B7ve3V_492T52fk,5062
55
55
  revengai/models/app_services_binary_ann_schema_tag_item.py,sha256=m25sIz8KEsPES0XGjmOZFhmLNLmB-jsakfRUpRfiMks,2977
56
56
  revengai/models/app_services_dynamic_execution_schemas_dynamic_execution_status.py,sha256=9e3LDnw0iNCbowQPFTkNyIqkzsCQyJLZrx6tqRska6o,2562
57
57
  revengai/models/argument.py,sha256=QmWpJiohyzTVC1GLHg1IlgM5QyONnBF6FGK_mOYQL_Y,3148
@@ -255,7 +255,7 @@ revengai/models/login_request.py,sha256=48uYtkWFL_Q-hN64P1f15ExGJvbab9XLymBtDduQ
255
255
  revengai/models/login_response.py,sha256=O35cqntoQ68IdYCBtHTYhPXlDqw8CIlnK-bNjf6QMO0,2461
256
256
  revengai/models/logs.py,sha256=cV_V-xN6q-yTd7eL-X89ugqz5ifWPsFPo6qYFgpS_Pw,2419
257
257
  revengai/models/matched_function.py,sha256=UTMIoMa0xUSffexqQ5bjjSsehwFtjZ3-NDemz56Q1fM,4151
258
- revengai/models/matched_function_suggestion.py,sha256=eNMKuAyJ94joT5It020lSujrporie50-ii_OCOk3KhY,2900
258
+ revengai/models/matched_function_suggestion.py,sha256=UK5Yrw2xlJ0dcOKIga_Syi0Ly_rWjvio6KPzPNbuDDg,3322
259
259
  revengai/models/meta_model.py,sha256=GbyFJZ9kwvK1Gqg8QnJ1GHpaMs8cMht6j-MY1k0YSt0,2943
260
260
  revengai/models/model_name.py,sha256=lVKok5pWyLcN1rhq1IYccC7uQQrPdyz1oohYRUMRrmw,1271
261
261
  revengai/models/models_response.py,sha256=Ooo2HYuSI4llHg1wUMmyOsisPAXkPhR1y5BSiKh9ckg,2472
@@ -288,8 +288,6 @@ revengai/models/sandbox_options.py,sha256=jJYc06yTvztjdjkpvk2YslXhfHvT6NmdiojvOm
288
288
  revengai/models/sbom.py,sha256=inSblTx7S8VNVg9hTitCRQ5i3vbyf6I0UGypgRxDKtM,3050
289
289
  revengai/models/sbom_package.py,sha256=k22hSemxxh0Gy1zCVmMSoZLbYeVLVfzHAOhbOXPXiSc,2555
290
290
  revengai/models/scrape_third_party_config.py,sha256=eFNDHFm_VvBeKJxWt80Rh978UFUdtuWGdwrwUiT-hkE,2505
291
- revengai/models/search_binary_ids.py,sha256=pfeUIYnI83YVjkH6PgjOHwTAJmgBHnjOgL33vmA9sxY,4906
292
- revengai/models/search_function_ids.py,sha256=VygPIoqnz5PupiSaqsufz81Wt4hOJquiTbS8ydKCATI,4919
293
291
  revengai/models/section_model.py,sha256=d-d9Aoo9TGyoc6ogxlVPFDZPgqrKzRwZ279zPDcGyTg,3026
294
292
  revengai/models/security_checks_response.py,sha256=Y7-VqTZbspYzT9pq_-F3KBPqJRkXnG5x9iKe5Z-X9js,3127
295
293
  revengai/models/security_checks_result.py,sha256=hZFO1d4rpYvMcX4AbzKOadcA8eb5UFEO7vqxVDm0Q7M,3255
@@ -333,7 +331,7 @@ revengai/models/vulnerabilities.py,sha256=9t6uoZd3svWyfcZJjmj6zP731Dp47Apb25y8Qt
333
331
  revengai/models/vulnerability.py,sha256=P7rAOAYU5JLLpcRr824-YJgZba5kPb_J9ALV3tSNfLQ,3688
334
332
  revengai/models/vulnerability_type.py,sha256=SyOgfMmELYYc_H84oPkikBpjwngtG5Qw9Q_86a2TPr8,866
335
333
  revengai/models/workspace.py,sha256=chjU62GFvByEmaNd6luMNQVQLP3wlPx1zJgGJ_yyMLA,676
336
- revengai-1.96.1.dist-info/METADATA,sha256=QmhJunSegvHMnCbeBC8_2pQBb_YuyRxQfT38Vc9x-kM,41374
337
- revengai-1.96.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
338
- revengai-1.96.1.dist-info/licenses/LICENSE.md,sha256=z1S-x9w52sZDqbFdJi0kL5-FLP5CR2aQA0kW8m6scaw,1052
339
- revengai-1.96.1.dist-info/RECORD,,
334
+ revengai-1.98.1.dist-info/METADATA,sha256=hDn6H1vRFGbBgXVGrxF-lekYGpf91NTAlrKDCnmXKEc,41278
335
+ revengai-1.98.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
336
+ revengai-1.98.1.dist-info/licenses/LICENSE.md,sha256=z1S-x9w52sZDqbFdJi0kL5-FLP5CR2aQA0kW8m6scaw,1052
337
+ revengai-1.98.1.dist-info/RECORD,,
@@ -1,137 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- RevEng.AI API
5
-
6
- RevEng.AI is Similarity Search Engine for executable binaries
7
-
8
- Generated by OpenAPI Generator (https://openapi-generator.tech)
9
-
10
- Do not edit the class manually.
11
- """ # noqa: E501
12
-
13
-
14
- from __future__ import annotations
15
- from inspect import getfullargspec
16
- import json
17
- import pprint
18
- import re # noqa: F401
19
- from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator
20
- from typing import Any, List, Optional
21
- from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
22
- from typing_extensions import Literal, Self
23
- from pydantic import Field
24
-
25
- SEARCHBINARYIDS_ANY_OF_SCHEMAS = ["List[int]", "object"]
26
-
27
- class SearchBinaryIds(BaseModel):
28
- """
29
- Optionally perform the search on matching functions from binaries in this list
30
- """
31
-
32
- # data type: List[int]
33
- anyof_schema_1_validator: Optional[List[StrictInt]] = None
34
- # data type: object
35
- anyof_schema_2_validator: Optional[Any] = None
36
- if TYPE_CHECKING:
37
- actual_instance: Optional[Union[List[int], object]] = None
38
- else:
39
- actual_instance: Any = None
40
- any_of_schemas: Set[str] = { "List[int]", "object" }
41
-
42
- model_config = {
43
- "validate_assignment": True,
44
- "protected_namespaces": (),
45
- }
46
-
47
- def __init__(self, *args, **kwargs) -> None:
48
- if args:
49
- if len(args) > 1:
50
- raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
51
- if kwargs:
52
- raise ValueError("If a position argument is used, keyword arguments cannot be used.")
53
- super().__init__(actual_instance=args[0])
54
- else:
55
- super().__init__(**kwargs)
56
-
57
- @field_validator('actual_instance')
58
- def actual_instance_must_validate_anyof(cls, v):
59
- instance = SearchBinaryIds.model_construct()
60
- error_messages = []
61
- # validate data type: List[int]
62
- try:
63
- instance.anyof_schema_1_validator = v
64
- return v
65
- except (ValidationError, ValueError) as e:
66
- error_messages.append(str(e))
67
- # validate data type: object
68
- try:
69
- instance.anyof_schema_2_validator = v
70
- return v
71
- except (ValidationError, ValueError) as e:
72
- error_messages.append(str(e))
73
- if error_messages:
74
- # no match
75
- raise ValueError("No match found when setting the actual_instance in SearchBinaryIds with anyOf schemas: List[int], object. Details: " + ", ".join(error_messages))
76
- else:
77
- return v
78
-
79
- @classmethod
80
- def from_dict(cls, obj: Dict[str, Any]) -> Self:
81
- return cls.from_json(json.dumps(obj))
82
-
83
- @classmethod
84
- def from_json(cls, json_str: str) -> Self:
85
- """Returns the object represented by the json string"""
86
- instance = cls.model_construct()
87
- error_messages = []
88
- # deserialize data into List[int]
89
- try:
90
- # validation
91
- instance.anyof_schema_1_validator = json.loads(json_str)
92
- # assign value to actual_instance
93
- instance.actual_instance = instance.anyof_schema_1_validator
94
- return instance
95
- except (ValidationError, ValueError) as e:
96
- error_messages.append(str(e))
97
- # deserialize data into object
98
- try:
99
- # validation
100
- instance.anyof_schema_2_validator = json.loads(json_str)
101
- # assign value to actual_instance
102
- instance.actual_instance = instance.anyof_schema_2_validator
103
- return instance
104
- except (ValidationError, ValueError) as e:
105
- error_messages.append(str(e))
106
-
107
- if error_messages:
108
- # no match
109
- raise ValueError("No match found when deserializing the JSON string into SearchBinaryIds with anyOf schemas: List[int], object. Details: " + ", ".join(error_messages))
110
- else:
111
- return instance
112
-
113
- def to_json(self) -> str:
114
- """Returns the JSON representation of the actual instance"""
115
- if self.actual_instance is None:
116
- return "null"
117
-
118
- if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
119
- return self.actual_instance.to_json()
120
- else:
121
- return json.dumps(self.actual_instance)
122
-
123
- def to_dict(self) -> Optional[Union[Dict[str, Any], List[int], object]]:
124
- """Returns the dict representation of the actual instance"""
125
- if self.actual_instance is None:
126
- return None
127
-
128
- if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
129
- return self.actual_instance.to_dict()
130
- else:
131
- return self.actual_instance
132
-
133
- def to_str(self) -> str:
134
- """Returns the string representation of the actual instance"""
135
- return pprint.pformat(self.model_dump())
136
-
137
-
@@ -1,137 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- RevEng.AI API
5
-
6
- RevEng.AI is Similarity Search Engine for executable binaries
7
-
8
- Generated by OpenAPI Generator (https://openapi-generator.tech)
9
-
10
- Do not edit the class manually.
11
- """ # noqa: E501
12
-
13
-
14
- from __future__ import annotations
15
- from inspect import getfullargspec
16
- import json
17
- import pprint
18
- import re # noqa: F401
19
- from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator
20
- from typing import Any, List, Optional
21
- from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
22
- from typing_extensions import Literal, Self
23
- from pydantic import Field
24
-
25
- SEARCHFUNCTIONIDS_ANY_OF_SCHEMAS = ["List[int]", "object"]
26
-
27
- class SearchFunctionIds(BaseModel):
28
- """
29
- Optionally perform the search on matching functions within this list of functions
30
- """
31
-
32
- # data type: List[int]
33
- anyof_schema_1_validator: Optional[List[StrictInt]] = None
34
- # data type: object
35
- anyof_schema_2_validator: Optional[Any] = None
36
- if TYPE_CHECKING:
37
- actual_instance: Optional[Union[List[int], object]] = None
38
- else:
39
- actual_instance: Any = None
40
- any_of_schemas: Set[str] = { "List[int]", "object" }
41
-
42
- model_config = {
43
- "validate_assignment": True,
44
- "protected_namespaces": (),
45
- }
46
-
47
- def __init__(self, *args, **kwargs) -> None:
48
- if args:
49
- if len(args) > 1:
50
- raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
51
- if kwargs:
52
- raise ValueError("If a position argument is used, keyword arguments cannot be used.")
53
- super().__init__(actual_instance=args[0])
54
- else:
55
- super().__init__(**kwargs)
56
-
57
- @field_validator('actual_instance')
58
- def actual_instance_must_validate_anyof(cls, v):
59
- instance = SearchFunctionIds.model_construct()
60
- error_messages = []
61
- # validate data type: List[int]
62
- try:
63
- instance.anyof_schema_1_validator = v
64
- return v
65
- except (ValidationError, ValueError) as e:
66
- error_messages.append(str(e))
67
- # validate data type: object
68
- try:
69
- instance.anyof_schema_2_validator = v
70
- return v
71
- except (ValidationError, ValueError) as e:
72
- error_messages.append(str(e))
73
- if error_messages:
74
- # no match
75
- raise ValueError("No match found when setting the actual_instance in SearchFunctionIds with anyOf schemas: List[int], object. Details: " + ", ".join(error_messages))
76
- else:
77
- return v
78
-
79
- @classmethod
80
- def from_dict(cls, obj: Dict[str, Any]) -> Self:
81
- return cls.from_json(json.dumps(obj))
82
-
83
- @classmethod
84
- def from_json(cls, json_str: str) -> Self:
85
- """Returns the object represented by the json string"""
86
- instance = cls.model_construct()
87
- error_messages = []
88
- # deserialize data into List[int]
89
- try:
90
- # validation
91
- instance.anyof_schema_1_validator = json.loads(json_str)
92
- # assign value to actual_instance
93
- instance.actual_instance = instance.anyof_schema_1_validator
94
- return instance
95
- except (ValidationError, ValueError) as e:
96
- error_messages.append(str(e))
97
- # deserialize data into object
98
- try:
99
- # validation
100
- instance.anyof_schema_2_validator = json.loads(json_str)
101
- # assign value to actual_instance
102
- instance.actual_instance = instance.anyof_schema_2_validator
103
- return instance
104
- except (ValidationError, ValueError) as e:
105
- error_messages.append(str(e))
106
-
107
- if error_messages:
108
- # no match
109
- raise ValueError("No match found when deserializing the JSON string into SearchFunctionIds with anyOf schemas: List[int], object. Details: " + ", ".join(error_messages))
110
- else:
111
- return instance
112
-
113
- def to_json(self) -> str:
114
- """Returns the JSON representation of the actual instance"""
115
- if self.actual_instance is None:
116
- return "null"
117
-
118
- if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
119
- return self.actual_instance.to_json()
120
- else:
121
- return json.dumps(self.actual_instance)
122
-
123
- def to_dict(self) -> Optional[Union[Dict[str, Any], List[int], object]]:
124
- """Returns the dict representation of the actual instance"""
125
- if self.actual_instance is None:
126
- return None
127
-
128
- if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
129
- return self.actual_instance.to_dict()
130
- else:
131
- return self.actual_instance
132
-
133
- def to_str(self) -> str:
134
- """Returns the string representation of the actual instance"""
135
- return pprint.pformat(self.model_dump())
136
-
137
-