revengai 2.1.0__py3-none-any.whl → 2.8.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.

Files changed (31) hide show
  1. revengai/__init__.py +1 -37
  2. revengai/api/__init__.py +0 -1
  3. revengai/api/analyses_core_api.py +0 -294
  4. revengai/api/functions_core_api.py +2 -369
  5. revengai/api_client.py +1 -1
  6. revengai/configuration.py +2 -2
  7. revengai/models/__init__.py +0 -17
  8. revengai/models/elf_relocation.py +1 -1
  9. revengai/models/functions_detail_response.py +4 -2
  10. {revengai-2.1.0.dist-info → revengai-2.8.0.dist-info}/METADATA +1 -24
  11. {revengai-2.1.0.dist-info → revengai-2.8.0.dist-info}/RECORD +13 -31
  12. revengai/api/confidence_api.py +0 -1152
  13. revengai/models/ann_function.py +0 -122
  14. revengai/models/base_response_box_plot_confidence.py +0 -125
  15. revengai/models/base_response_list_function_box_plot_confidence.py +0 -129
  16. revengai/models/base_response_list_similar_functions_response.py +0 -129
  17. revengai/models/base_response_list_tag_origin_box_plot_confidence.py +0 -129
  18. revengai/models/base_response_nearest_neighbor_analysis.py +0 -135
  19. revengai/models/box_plot_confidence.py +0 -98
  20. revengai/models/function_box_plot_confidence.py +0 -92
  21. revengai/models/function_name_confidence_body.py +0 -97
  22. revengai/models/function_name_input.py +0 -88
  23. revengai/models/nearest_neighbor.py +0 -105
  24. revengai/models/origin.py +0 -42
  25. revengai/models/similar_functions_response.py +0 -100
  26. revengai/models/tag_confidence_body.py +0 -95
  27. revengai/models/tag_origin_box_plot_confidence.py +0 -96
  28. revengai/models/tags.py +0 -89
  29. revengai/models/threat_score_function_body.py +0 -87
  30. {revengai-2.1.0.dist-info → revengai-2.8.0.dist-info}/WHEEL +0 -0
  31. {revengai-2.1.0.dist-info → revengai-2.8.0.dist-info}/licenses/LICENSE.md +0 -0
@@ -1,122 +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
- import pprint
16
- import re # noqa: F401
17
- import json
18
-
19
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt
20
- from typing import Any, ClassVar, Dict, List, Optional, Union
21
- from typing_extensions import Annotated
22
- from typing import Optional, Set
23
- from typing_extensions import Self
24
-
25
- class ANNFunction(BaseModel):
26
- """
27
- ANNFunction
28
- """ # noqa: E501
29
- limit: Optional[StrictInt] = Field(default=5, description="The amount of neighbours per function ID")
30
- distance: Optional[Union[StrictFloat, StrictInt]] = Field(default=0.1, description="The distance between two neighbours")
31
- analysis_search_ids: Optional[List[Optional[StrictInt]]] = Field(default=None, description="Perform a search on functions within a list of analyses")
32
- collection_search_ids: Optional[Annotated[List[Optional[StrictInt]], Field(max_length=5)]] = Field(default=None, description="Search only within these collections")
33
- search_binary_ids: Optional[List[StrictInt]] = None
34
- search_function_ids: Optional[List[StrictInt]] = None
35
- debug_only: Optional[StrictBool] = Field(default=False, description="Searches for only functions which are debug")
36
- additional_properties: Dict[str, Any] = {}
37
- __properties: ClassVar[List[str]] = ["limit", "distance", "analysis_search_ids", "collection_search_ids", "search_binary_ids", "search_function_ids", "debug_only"]
38
-
39
- model_config = ConfigDict(
40
- populate_by_name=True,
41
- validate_assignment=True,
42
- protected_namespaces=(),
43
- )
44
-
45
-
46
- def to_str(self) -> str:
47
- """Returns the string representation of the model using alias"""
48
- return pprint.pformat(self.model_dump(by_alias=True))
49
-
50
- def to_json(self) -> str:
51
- """Returns the JSON representation of the model using alias"""
52
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
- return json.dumps(self.to_dict())
54
-
55
- @classmethod
56
- def from_json(cls, json_str: str) -> Optional[Self]:
57
- """Create an instance of ANNFunction from a JSON string"""
58
- return cls.from_dict(json.loads(json_str))
59
-
60
- def to_dict(self) -> Dict[str, Any]:
61
- """Return the dictionary representation of the model using alias.
62
-
63
- This has the following differences from calling pydantic's
64
- `self.model_dump(by_alias=True)`:
65
-
66
- * `None` is only added to the output dict for nullable fields that
67
- were set at model initialization. Other fields with value `None`
68
- are ignored.
69
- * Fields in `self.additional_properties` are added to the output dict.
70
- """
71
- excluded_fields: Set[str] = set([
72
- "additional_properties",
73
- ])
74
-
75
- _dict = self.model_dump(
76
- by_alias=True,
77
- exclude=excluded_fields,
78
- exclude_none=True,
79
- )
80
- # puts key-value pairs in additional_properties in the top level
81
- if self.additional_properties is not None:
82
- for _key, _value in self.additional_properties.items():
83
- _dict[_key] = _value
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
-
95
- return _dict
96
-
97
- @classmethod
98
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
- """Create an instance of ANNFunction from a dict"""
100
- if obj is None:
101
- return None
102
-
103
- if not isinstance(obj, dict):
104
- return cls.model_validate(obj)
105
-
106
- _obj = cls.model_validate({
107
- "limit": obj.get("limit") if obj.get("limit") is not None else 5,
108
- "distance": obj.get("distance") if obj.get("distance") is not None else 0.1,
109
- "analysis_search_ids": obj.get("analysis_search_ids"),
110
- "collection_search_ids": obj.get("collection_search_ids"),
111
- "search_binary_ids": obj.get("search_binary_ids"),
112
- "search_function_ids": obj.get("search_function_ids"),
113
- "debug_only": obj.get("debug_only") if obj.get("debug_only") is not None else False
114
- })
115
- # store additional fields in additional_properties
116
- for _key in obj.keys():
117
- if _key not in cls.__properties:
118
- _obj.additional_properties[_key] = obj.get(_key)
119
-
120
- return _obj
121
-
122
-
@@ -1,125 +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
- import pprint
16
- import re # noqa: F401
17
- import json
18
-
19
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
20
- from typing import Any, ClassVar, Dict, List, Optional
21
- from revengai.models.box_plot_confidence import BoxPlotConfidence
22
- from revengai.models.error_model import ErrorModel
23
- from revengai.models.meta_model import MetaModel
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class BaseResponseBoxPlotConfidence(BaseModel):
28
- """
29
- BaseResponseBoxPlotConfidence
30
- """ # noqa: E501
31
- status: Optional[StrictBool] = Field(default=True, description="Response status on whether the request succeeded")
32
- data: Optional[BoxPlotConfidence] = None
33
- message: Optional[StrictStr] = None
34
- errors: Optional[List[ErrorModel]] = None
35
- meta: Optional[MetaModel] = Field(default=None, description="Metadata")
36
- __properties: ClassVar[List[str]] = ["status", "data", "message", "errors", "meta"]
37
-
38
- model_config = ConfigDict(
39
- populate_by_name=True,
40
- validate_assignment=True,
41
- protected_namespaces=(),
42
- )
43
-
44
-
45
- def to_str(self) -> str:
46
- """Returns the string representation of the model using alias"""
47
- return pprint.pformat(self.model_dump(by_alias=True))
48
-
49
- def to_json(self) -> str:
50
- """Returns the JSON representation of the model using alias"""
51
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
- return json.dumps(self.to_dict())
53
-
54
- @classmethod
55
- def from_json(cls, json_str: str) -> Optional[Self]:
56
- """Create an instance of BaseResponseBoxPlotConfidence from a JSON string"""
57
- return cls.from_dict(json.loads(json_str))
58
-
59
- def to_dict(self) -> Dict[str, Any]:
60
- """Return the dictionary representation of the model using alias.
61
-
62
- This has the following differences from calling pydantic's
63
- `self.model_dump(by_alias=True)`:
64
-
65
- * `None` is only added to the output dict for nullable fields that
66
- were set at model initialization. Other fields with value `None`
67
- are ignored.
68
- """
69
- excluded_fields: Set[str] = set([
70
- ])
71
-
72
- _dict = self.model_dump(
73
- by_alias=True,
74
- exclude=excluded_fields,
75
- exclude_none=True,
76
- )
77
- # override the default output from pydantic by calling `to_dict()` of data
78
- if self.data:
79
- _dict['data'] = self.data.to_dict()
80
- # override the default output from pydantic by calling `to_dict()` of each item in errors (list)
81
- _items = []
82
- if self.errors:
83
- for _item_errors in self.errors:
84
- if _item_errors:
85
- _items.append(_item_errors.to_dict())
86
- _dict['errors'] = _items
87
- # override the default output from pydantic by calling `to_dict()` of meta
88
- if self.meta:
89
- _dict['meta'] = self.meta.to_dict()
90
- # set to None if data (nullable) is None
91
- # and model_fields_set contains the field
92
- if self.data is None and "data" in self.model_fields_set:
93
- _dict['data'] = None
94
-
95
- # set to None if message (nullable) is None
96
- # and model_fields_set contains the field
97
- if self.message is None and "message" in self.model_fields_set:
98
- _dict['message'] = None
99
-
100
- # set to None if errors (nullable) is None
101
- # and model_fields_set contains the field
102
- if self.errors is None and "errors" in self.model_fields_set:
103
- _dict['errors'] = None
104
-
105
- return _dict
106
-
107
- @classmethod
108
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
109
- """Create an instance of BaseResponseBoxPlotConfidence from a dict"""
110
- if obj is None:
111
- return None
112
-
113
- if not isinstance(obj, dict):
114
- return cls.model_validate(obj)
115
-
116
- _obj = cls.model_validate({
117
- "status": obj.get("status") if obj.get("status") is not None else True,
118
- "data": BoxPlotConfidence.from_dict(obj["data"]) if obj.get("data") is not None else None,
119
- "message": obj.get("message"),
120
- "errors": [ErrorModel.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None,
121
- "meta": MetaModel.from_dict(obj["meta"]) if obj.get("meta") is not None else None
122
- })
123
- return _obj
124
-
125
-
@@ -1,129 +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
- import pprint
16
- import re # noqa: F401
17
- import json
18
-
19
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
20
- from typing import Any, ClassVar, Dict, List, Optional
21
- from revengai.models.error_model import ErrorModel
22
- from revengai.models.function_box_plot_confidence import FunctionBoxPlotConfidence
23
- from revengai.models.meta_model import MetaModel
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class BaseResponseListFunctionBoxPlotConfidence(BaseModel):
28
- """
29
- BaseResponseListFunctionBoxPlotConfidence
30
- """ # noqa: E501
31
- status: Optional[StrictBool] = Field(default=True, description="Response status on whether the request succeeded")
32
- data: Optional[List[FunctionBoxPlotConfidence]] = None
33
- message: Optional[StrictStr] = None
34
- errors: Optional[List[ErrorModel]] = None
35
- meta: Optional[MetaModel] = Field(default=None, description="Metadata")
36
- __properties: ClassVar[List[str]] = ["status", "data", "message", "errors", "meta"]
37
-
38
- model_config = ConfigDict(
39
- populate_by_name=True,
40
- validate_assignment=True,
41
- protected_namespaces=(),
42
- )
43
-
44
-
45
- def to_str(self) -> str:
46
- """Returns the string representation of the model using alias"""
47
- return pprint.pformat(self.model_dump(by_alias=True))
48
-
49
- def to_json(self) -> str:
50
- """Returns the JSON representation of the model using alias"""
51
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
- return json.dumps(self.to_dict())
53
-
54
- @classmethod
55
- def from_json(cls, json_str: str) -> Optional[Self]:
56
- """Create an instance of BaseResponseListFunctionBoxPlotConfidence from a JSON string"""
57
- return cls.from_dict(json.loads(json_str))
58
-
59
- def to_dict(self) -> Dict[str, Any]:
60
- """Return the dictionary representation of the model using alias.
61
-
62
- This has the following differences from calling pydantic's
63
- `self.model_dump(by_alias=True)`:
64
-
65
- * `None` is only added to the output dict for nullable fields that
66
- were set at model initialization. Other fields with value `None`
67
- are ignored.
68
- """
69
- excluded_fields: Set[str] = set([
70
- ])
71
-
72
- _dict = self.model_dump(
73
- by_alias=True,
74
- exclude=excluded_fields,
75
- exclude_none=True,
76
- )
77
- # override the default output from pydantic by calling `to_dict()` of each item in data (list)
78
- _items = []
79
- if self.data:
80
- for _item_data in self.data:
81
- if _item_data:
82
- _items.append(_item_data.to_dict())
83
- _dict['data'] = _items
84
- # override the default output from pydantic by calling `to_dict()` of each item in errors (list)
85
- _items = []
86
- if self.errors:
87
- for _item_errors in self.errors:
88
- if _item_errors:
89
- _items.append(_item_errors.to_dict())
90
- _dict['errors'] = _items
91
- # override the default output from pydantic by calling `to_dict()` of meta
92
- if self.meta:
93
- _dict['meta'] = self.meta.to_dict()
94
- # set to None if data (nullable) is None
95
- # and model_fields_set contains the field
96
- if self.data is None and "data" in self.model_fields_set:
97
- _dict['data'] = None
98
-
99
- # set to None if message (nullable) is None
100
- # and model_fields_set contains the field
101
- if self.message is None and "message" in self.model_fields_set:
102
- _dict['message'] = None
103
-
104
- # set to None if errors (nullable) is None
105
- # and model_fields_set contains the field
106
- if self.errors is None and "errors" in self.model_fields_set:
107
- _dict['errors'] = None
108
-
109
- return _dict
110
-
111
- @classmethod
112
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
113
- """Create an instance of BaseResponseListFunctionBoxPlotConfidence from a dict"""
114
- if obj is None:
115
- return None
116
-
117
- if not isinstance(obj, dict):
118
- return cls.model_validate(obj)
119
-
120
- _obj = cls.model_validate({
121
- "status": obj.get("status") if obj.get("status") is not None else True,
122
- "data": [FunctionBoxPlotConfidence.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
123
- "message": obj.get("message"),
124
- "errors": [ErrorModel.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None,
125
- "meta": MetaModel.from_dict(obj["meta"]) if obj.get("meta") is not None else None
126
- })
127
- return _obj
128
-
129
-
@@ -1,129 +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
- import pprint
16
- import re # noqa: F401
17
- import json
18
-
19
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
20
- from typing import Any, ClassVar, Dict, List, Optional
21
- from revengai.models.error_model import ErrorModel
22
- from revengai.models.meta_model import MetaModel
23
- from revengai.models.similar_functions_response import SimilarFunctionsResponse
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class BaseResponseListSimilarFunctionsResponse(BaseModel):
28
- """
29
- BaseResponseListSimilarFunctionsResponse
30
- """ # noqa: E501
31
- status: Optional[StrictBool] = Field(default=True, description="Response status on whether the request succeeded")
32
- data: Optional[List[SimilarFunctionsResponse]] = None
33
- message: Optional[StrictStr] = None
34
- errors: Optional[List[ErrorModel]] = None
35
- meta: Optional[MetaModel] = Field(default=None, description="Metadata")
36
- __properties: ClassVar[List[str]] = ["status", "data", "message", "errors", "meta"]
37
-
38
- model_config = ConfigDict(
39
- populate_by_name=True,
40
- validate_assignment=True,
41
- protected_namespaces=(),
42
- )
43
-
44
-
45
- def to_str(self) -> str:
46
- """Returns the string representation of the model using alias"""
47
- return pprint.pformat(self.model_dump(by_alias=True))
48
-
49
- def to_json(self) -> str:
50
- """Returns the JSON representation of the model using alias"""
51
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
- return json.dumps(self.to_dict())
53
-
54
- @classmethod
55
- def from_json(cls, json_str: str) -> Optional[Self]:
56
- """Create an instance of BaseResponseListSimilarFunctionsResponse from a JSON string"""
57
- return cls.from_dict(json.loads(json_str))
58
-
59
- def to_dict(self) -> Dict[str, Any]:
60
- """Return the dictionary representation of the model using alias.
61
-
62
- This has the following differences from calling pydantic's
63
- `self.model_dump(by_alias=True)`:
64
-
65
- * `None` is only added to the output dict for nullable fields that
66
- were set at model initialization. Other fields with value `None`
67
- are ignored.
68
- """
69
- excluded_fields: Set[str] = set([
70
- ])
71
-
72
- _dict = self.model_dump(
73
- by_alias=True,
74
- exclude=excluded_fields,
75
- exclude_none=True,
76
- )
77
- # override the default output from pydantic by calling `to_dict()` of each item in data (list)
78
- _items = []
79
- if self.data:
80
- for _item_data in self.data:
81
- if _item_data:
82
- _items.append(_item_data.to_dict())
83
- _dict['data'] = _items
84
- # override the default output from pydantic by calling `to_dict()` of each item in errors (list)
85
- _items = []
86
- if self.errors:
87
- for _item_errors in self.errors:
88
- if _item_errors:
89
- _items.append(_item_errors.to_dict())
90
- _dict['errors'] = _items
91
- # override the default output from pydantic by calling `to_dict()` of meta
92
- if self.meta:
93
- _dict['meta'] = self.meta.to_dict()
94
- # set to None if data (nullable) is None
95
- # and model_fields_set contains the field
96
- if self.data is None and "data" in self.model_fields_set:
97
- _dict['data'] = None
98
-
99
- # set to None if message (nullable) is None
100
- # and model_fields_set contains the field
101
- if self.message is None and "message" in self.model_fields_set:
102
- _dict['message'] = None
103
-
104
- # set to None if errors (nullable) is None
105
- # and model_fields_set contains the field
106
- if self.errors is None and "errors" in self.model_fields_set:
107
- _dict['errors'] = None
108
-
109
- return _dict
110
-
111
- @classmethod
112
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
113
- """Create an instance of BaseResponseListSimilarFunctionsResponse from a dict"""
114
- if obj is None:
115
- return None
116
-
117
- if not isinstance(obj, dict):
118
- return cls.model_validate(obj)
119
-
120
- _obj = cls.model_validate({
121
- "status": obj.get("status") if obj.get("status") is not None else True,
122
- "data": [SimilarFunctionsResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
123
- "message": obj.get("message"),
124
- "errors": [ErrorModel.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None,
125
- "meta": MetaModel.from_dict(obj["meta"]) if obj.get("meta") is not None else None
126
- })
127
- return _obj
128
-
129
-
@@ -1,129 +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
- import pprint
16
- import re # noqa: F401
17
- import json
18
-
19
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
20
- from typing import Any, ClassVar, Dict, List, Optional
21
- from revengai.models.error_model import ErrorModel
22
- from revengai.models.meta_model import MetaModel
23
- from revengai.models.tag_origin_box_plot_confidence import TagOriginBoxPlotConfidence
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class BaseResponseListTagOriginBoxPlotConfidence(BaseModel):
28
- """
29
- BaseResponseListTagOriginBoxPlotConfidence
30
- """ # noqa: E501
31
- status: Optional[StrictBool] = Field(default=True, description="Response status on whether the request succeeded")
32
- data: Optional[List[TagOriginBoxPlotConfidence]] = None
33
- message: Optional[StrictStr] = None
34
- errors: Optional[List[ErrorModel]] = None
35
- meta: Optional[MetaModel] = Field(default=None, description="Metadata")
36
- __properties: ClassVar[List[str]] = ["status", "data", "message", "errors", "meta"]
37
-
38
- model_config = ConfigDict(
39
- populate_by_name=True,
40
- validate_assignment=True,
41
- protected_namespaces=(),
42
- )
43
-
44
-
45
- def to_str(self) -> str:
46
- """Returns the string representation of the model using alias"""
47
- return pprint.pformat(self.model_dump(by_alias=True))
48
-
49
- def to_json(self) -> str:
50
- """Returns the JSON representation of the model using alias"""
51
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
- return json.dumps(self.to_dict())
53
-
54
- @classmethod
55
- def from_json(cls, json_str: str) -> Optional[Self]:
56
- """Create an instance of BaseResponseListTagOriginBoxPlotConfidence from a JSON string"""
57
- return cls.from_dict(json.loads(json_str))
58
-
59
- def to_dict(self) -> Dict[str, Any]:
60
- """Return the dictionary representation of the model using alias.
61
-
62
- This has the following differences from calling pydantic's
63
- `self.model_dump(by_alias=True)`:
64
-
65
- * `None` is only added to the output dict for nullable fields that
66
- were set at model initialization. Other fields with value `None`
67
- are ignored.
68
- """
69
- excluded_fields: Set[str] = set([
70
- ])
71
-
72
- _dict = self.model_dump(
73
- by_alias=True,
74
- exclude=excluded_fields,
75
- exclude_none=True,
76
- )
77
- # override the default output from pydantic by calling `to_dict()` of each item in data (list)
78
- _items = []
79
- if self.data:
80
- for _item_data in self.data:
81
- if _item_data:
82
- _items.append(_item_data.to_dict())
83
- _dict['data'] = _items
84
- # override the default output from pydantic by calling `to_dict()` of each item in errors (list)
85
- _items = []
86
- if self.errors:
87
- for _item_errors in self.errors:
88
- if _item_errors:
89
- _items.append(_item_errors.to_dict())
90
- _dict['errors'] = _items
91
- # override the default output from pydantic by calling `to_dict()` of meta
92
- if self.meta:
93
- _dict['meta'] = self.meta.to_dict()
94
- # set to None if data (nullable) is None
95
- # and model_fields_set contains the field
96
- if self.data is None and "data" in self.model_fields_set:
97
- _dict['data'] = None
98
-
99
- # set to None if message (nullable) is None
100
- # and model_fields_set contains the field
101
- if self.message is None and "message" in self.model_fields_set:
102
- _dict['message'] = None
103
-
104
- # set to None if errors (nullable) is None
105
- # and model_fields_set contains the field
106
- if self.errors is None and "errors" in self.model_fields_set:
107
- _dict['errors'] = None
108
-
109
- return _dict
110
-
111
- @classmethod
112
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
113
- """Create an instance of BaseResponseListTagOriginBoxPlotConfidence from a dict"""
114
- if obj is None:
115
- return None
116
-
117
- if not isinstance(obj, dict):
118
- return cls.model_validate(obj)
119
-
120
- _obj = cls.model_validate({
121
- "status": obj.get("status") if obj.get("status") is not None else True,
122
- "data": [TagOriginBoxPlotConfidence.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
123
- "message": obj.get("message"),
124
- "errors": [ErrorModel.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None,
125
- "meta": MetaModel.from_dict(obj["meta"]) if obj.get("meta") is not None else None
126
- })
127
- return _obj
128
-
129
-