Repository navigation
Expand file tree
/
Copy pathfinancial_statement_analysis_response.py
More file actions
210 lines (166 loc) · 6.36 KB
/
Copy pathfinancial_statement_analysis_response.py
File metadata and controls
210 lines (166 loc) · 6.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
from __future__ import annotations
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, TypeVar, cast
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
if TYPE_CHECKING:
from ..models.analytical_statement_fact_row import AnalyticalStatementFactRow
from ..models.graph_freshness import GraphFreshness
from ..models.resolved_report_info import ResolvedReportInfo
T = TypeVar("T", bound="FinancialStatementAnalysisResponse")
@_attrs_define
class FinancialStatementAnalysisResponse:
"""Results of the financial-statement-analysis view op.
Attributes:
graph_id (str):
statement_type (str):
facts (list[AnalyticalStatementFactRow]):
fact_count (int):
ticker (None | str | Unset):
report_id (None | str | Unset):
resolved_report (None | ResolvedReportInfo | Unset):
graph_freshness (GraphFreshness | None | Unset): On a ledger's graph, whether the graph is current with the
books; null on shared repositories, which are not rebuilt from a ledger.
"""
graph_id: str
statement_type: str
facts: list[AnalyticalStatementFactRow]
fact_count: int
ticker: None | str | Unset = UNSET
report_id: None | str | Unset = UNSET
resolved_report: None | ResolvedReportInfo | Unset = UNSET
graph_freshness: GraphFreshness | None | Unset = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
from ..models.graph_freshness import GraphFreshness
from ..models.resolved_report_info import ResolvedReportInfo
graph_id = self.graph_id
statement_type = self.statement_type
facts = []
for facts_item_data in self.facts:
facts_item = facts_item_data.to_dict()
facts.append(facts_item)
fact_count = self.fact_count
ticker: None | str | Unset
if isinstance(self.ticker, Unset):
ticker = UNSET
else:
ticker = self.ticker
report_id: None | str | Unset
if isinstance(self.report_id, Unset):
report_id = UNSET
else:
report_id = self.report_id
resolved_report: dict[str, Any] | None | Unset
if isinstance(self.resolved_report, Unset):
resolved_report = UNSET
elif isinstance(self.resolved_report, ResolvedReportInfo):
resolved_report = self.resolved_report.to_dict()
else:
resolved_report = self.resolved_report
graph_freshness: dict[str, Any] | None | Unset
if isinstance(self.graph_freshness, Unset):
graph_freshness = UNSET
elif isinstance(self.graph_freshness, GraphFreshness):
graph_freshness = self.graph_freshness.to_dict()
else:
graph_freshness = self.graph_freshness
field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"graph_id": graph_id,
"statement_type": statement_type,
"facts": facts,
"fact_count": fact_count,
}
)
if ticker is not UNSET:
field_dict["ticker"] = ticker
if report_id is not UNSET:
field_dict["report_id"] = report_id
if resolved_report is not UNSET:
field_dict["resolved_report"] = resolved_report
if graph_freshness is not UNSET:
field_dict["graph_freshness"] = graph_freshness
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
from ..models.analytical_statement_fact_row import AnalyticalStatementFactRow
from ..models.graph_freshness import GraphFreshness
from ..models.resolved_report_info import ResolvedReportInfo
d = dict(src_dict)
graph_id = d.pop("graph_id")
statement_type = d.pop("statement_type")
facts = []
_facts = d.pop("facts")
for facts_item_data in _facts:
facts_item = AnalyticalStatementFactRow.from_dict(facts_item_data)
facts.append(facts_item)
fact_count = d.pop("fact_count")
def _parse_ticker(data: object) -> None | str | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(None | str | Unset, data)
ticker = _parse_ticker(d.pop("ticker", UNSET))
def _parse_report_id(data: object) -> None | str | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(None | str | Unset, data)
report_id = _parse_report_id(d.pop("report_id", UNSET))
def _parse_resolved_report(data: object) -> None | ResolvedReportInfo | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
try:
if not isinstance(data, dict):
raise TypeError()
resolved_report_type_0 = ResolvedReportInfo.from_dict(data)
return resolved_report_type_0
except (TypeError, ValueError, AttributeError, KeyError):
pass
return cast(None | ResolvedReportInfo | Unset, data)
resolved_report = _parse_resolved_report(d.pop("resolved_report", UNSET))
def _parse_graph_freshness(data: object) -> GraphFreshness | None | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
try:
if not isinstance(data, dict):
raise TypeError()
graph_freshness_type_0 = GraphFreshness.from_dict(data)
return graph_freshness_type_0
except (TypeError, ValueError, AttributeError, KeyError):
pass
return cast(GraphFreshness | None | Unset, data)
graph_freshness = _parse_graph_freshness(d.pop("graph_freshness", UNSET))
financial_statement_analysis_response = cls(
graph_id=graph_id,
statement_type=statement_type,
facts=facts,
fact_count=fact_count,
ticker=ticker,
report_id=report_id,
resolved_report=resolved_report,
graph_freshness=graph_freshness,
)
financial_statement_analysis_response.additional_properties = d
return financial_statement_analysis_response
@property
def additional_keys(self) -> list[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties