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

Potentially problematic release.


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

@@ -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
-