| 164 | |
| 165 | |
| 166 | class StreamEventCaptureTracker(PreStartStreamHook, PostStreamItemHook, PostEndStreamHook): |
| 167 | def post_end_stream( |
| 168 | self, |
| 169 | *, |
| 170 | action: str, |
| 171 | sequence_id: int, |
| 172 | app_id: str, |
| 173 | partition_key: Optional[str], |
| 174 | **future_kwargs: Any, |
| 175 | ): |
| 176 | self.post_end_stream_calls.append((action, locals())) |
| 177 | |
| 178 | def __init__(self): |
| 179 | self.pre_start_stream_calls = [] |
| 180 | self.post_stream_item_calls = [] |
| 181 | self.post_end_stream_calls = [] |
| 182 | |
| 183 | def pre_start_stream( |
| 184 | self, |
| 185 | *, |
| 186 | action: str, |
| 187 | sequence_id: int, |
| 188 | app_id: str, |
| 189 | partition_key: Optional[str], |
| 190 | **future_kwargs: Any, |
| 191 | ): |
| 192 | self.pre_start_stream_calls.append((action, locals())) |
| 193 | |
| 194 | def post_stream_item( |
| 195 | self, |
| 196 | *, |
| 197 | item: Any, |
| 198 | item_index: int, |
| 199 | stream_initialize_time: datetime.datetime, |
| 200 | first_stream_item_start_time: datetime.datetime, |
| 201 | action: str, |
| 202 | sequence_id: int, |
| 203 | app_id: str, |
| 204 | partition_key: Optional[str], |
| 205 | **future_kwargs: Any, |
| 206 | ): |
| 207 | self.post_stream_item_calls.append((action, locals())) |
| 208 | |
| 209 | |
| 210 | class StreamEventCaptureTrackerAsync( |
no outgoing calls