@@ -1037,7 +1037,7 @@ def receive_push_promise_in_band(self,
1037
1037
events = self .state_machine .process_input (
1038
1038
StreamInputs .RECV_PUSH_PROMISE ,
1039
1039
)
1040
- push_event = cast (PushedStreamReceived , events [0 ])
1040
+ push_event = cast (" PushedStreamReceived" , events [0 ])
1041
1041
push_event .pushed_stream_id = promised_stream_id
1042
1042
1043
1043
hdr_validation_flags = self ._build_hdr_validation_flags (events )
@@ -1076,7 +1076,7 @@ def receive_headers(self,
1076
1076
1077
1077
events = self .state_machine .process_input (input_ )
1078
1078
headers_event = cast (
1079
- Union [RequestReceived , ResponseReceived , TrailersReceived , InformationalResponseReceived ],
1079
+ " Union[RequestReceived, ResponseReceived, TrailersReceived, InformationalResponseReceived]" ,
1080
1080
events [0 ],
1081
1081
)
1082
1082
@@ -1086,9 +1086,9 @@ def receive_headers(self,
1086
1086
)
1087
1087
# We ensured it's not an information response at the beginning of the method.
1088
1088
cast (
1089
- Union [RequestReceived , ResponseReceived , TrailersReceived ],
1089
+ " Union[RequestReceived, ResponseReceived, TrailersReceived]" ,
1090
1090
headers_event ,
1091
- ).stream_ended = cast (StreamEnded , es_events [0 ])
1091
+ ).stream_ended = cast (" StreamEnded" , es_events [0 ])
1092
1092
events += es_events
1093
1093
1094
1094
self ._initialize_content_length (headers )
@@ -1112,15 +1112,15 @@ def receive_data(self, data: bytes, end_stream: bool, flow_control_len: int) ->
1112
1112
"set to %d" , self , end_stream , flow_control_len ,
1113
1113
)
1114
1114
events = self .state_machine .process_input (StreamInputs .RECV_DATA )
1115
- data_event = cast (DataReceived , events [0 ])
1115
+ data_event = cast (" DataReceived" , events [0 ])
1116
1116
self ._inbound_window_manager .window_consumed (flow_control_len )
1117
1117
self ._track_content_length (len (data ), end_stream )
1118
1118
1119
1119
if end_stream :
1120
1120
es_events = self .state_machine .process_input (
1121
1121
StreamInputs .RECV_END_STREAM ,
1122
1122
)
1123
- data_event .stream_ended = cast (StreamEnded , es_events [0 ])
1123
+ data_event .stream_ended = cast (" StreamEnded" , es_events [0 ])
1124
1124
events .extend (es_events )
1125
1125
1126
1126
data_event .data = data
@@ -1144,7 +1144,7 @@ def receive_window_update(self, increment: int) -> tuple[list[Frame], list[Event
1144
1144
# this should be treated as a *stream* error, not a *connection* error.
1145
1145
# That means we need to catch the error and forcibly close the stream.
1146
1146
if events :
1147
- cast (WindowUpdated , events [0 ]).delta = increment
1147
+ cast (" WindowUpdated" , events [0 ]).delta = increment
1148
1148
try :
1149
1149
self .outbound_flow_control_window = guard_increment_window (
1150
1150
self .outbound_flow_control_window ,
@@ -1228,7 +1228,7 @@ def stream_reset(self, frame: RstStreamFrame) -> tuple[list[Frame], list[Event]]
1228
1228
1229
1229
if events :
1230
1230
# We don't fire an event if this stream is already closed.
1231
- cast (StreamReset , events [0 ]).error_code = _error_code_from_int (frame .error_code )
1231
+ cast (" StreamReset" , events [0 ]).error_code = _error_code_from_int (frame .error_code )
1232
1232
1233
1233
return [], events
1234
1234
0 commit comments