1616# pylint: disable=protected-access,cyclic-import
1717import typing as _typing
1818import cloudevents .http as _ce
19- import util as _util
19+ import firebase_functions . private . util as _util
2020from firebase_functions .alerts import FirebaseAlertData
2121
2222from functions_framework import logging as _logging
@@ -110,6 +110,7 @@ def regression_alert_payload_from_ce_payload(payload: dict):
110110
111111def trending_issue_details_from_ce_payload (payload : dict ):
112112 from firebase_functions .alerts .crashlytics_fn import TrendingIssueDetails
113+
113114 return TrendingIssueDetails (
114115 type = payload ["type" ],
115116 issue = issue_from_ce_payload (payload ["issue" ]),
@@ -120,16 +121,19 @@ def trending_issue_details_from_ce_payload(payload: dict):
120121
121122def stability_digest_payload_from_ce_payload (payload : dict ):
122123 from firebase_functions .alerts .crashlytics_fn import StabilityDigestPayload
124+
123125 return StabilityDigestPayload (
124126 digest_date = _util .timestamp_conversion (payload ["digestDate" ]),
125127 trending_issues = [
126128 trending_issue_details_from_ce_payload (issue )
127129 for issue in payload ["trendingIssues" ]
128- ])
130+ ],
131+ )
129132
130133
131134def velocity_alert_payload_from_ce_payload (payload : dict ):
132135 from firebase_functions .alerts .crashlytics_fn import VelocityAlertPayload
136+
133137 return VelocityAlertPayload (
134138 issue = issue_from_ce_payload (payload ["issue" ]),
135139 create_time = _util .timestamp_conversion (payload ["createTime" ]),
@@ -141,11 +145,13 @@ def velocity_alert_payload_from_ce_payload(payload: dict):
141145
142146def new_anr_issue_payload_from_ce_payload (payload : dict ):
143147 from firebase_functions .alerts .crashlytics_fn import NewAnrIssuePayload
148+
144149 return NewAnrIssuePayload (issue = issue_from_ce_payload (payload ["issue" ]))
145150
146151
147152def firebase_alert_data_from_ce (event_dict : dict ,) -> FirebaseAlertData :
148153 from firebase_functions .options import AlertType
154+
149155 alert_type : str = event_dict ["alerttype" ]
150156 alert_payload = event_dict ["payload" ]
151157 if alert_type == AlertType .CRASHLYTICS_NEW_FATAL_ISSUE .value :
@@ -205,24 +211,29 @@ def event_from_ce_helper(raw: _ce.CloudEvent, cls, app_id=True):
205211
206212def billing_event_from_ce (raw : _ce .CloudEvent ):
207213 from firebase_functions .alerts .billing_fn import BillingEvent
214+
208215 return event_from_ce_helper (raw , BillingEvent , app_id = False )
209216
210217
211218def performance_event_from_ce (raw : _ce .CloudEvent ):
212219 from firebase_functions .alerts .performance_fn import PerformanceEvent
220+
213221 return event_from_ce_helper (raw , PerformanceEvent )
214222
215223
216224def app_distribution_event_from_ce (raw : _ce .CloudEvent ):
217225 from firebase_functions .alerts .app_distribution_fn import AppDistributionEvent
226+
218227 return event_from_ce_helper (raw , AppDistributionEvent )
219228
220229
221230def crashlytics_event_from_ce (raw : _ce .CloudEvent ):
222231 from firebase_functions .alerts .crashlytics_fn import CrashlyticsEvent
232+
223233 return event_from_ce_helper (raw , CrashlyticsEvent )
224234
225235
226236def alerts_event_from_ce (raw : _ce .CloudEvent ):
227237 from firebase_functions .alerts_fn import AlertEvent
238+
228239 return event_from_ce_helper (raw , AlertEvent )
0 commit comments