@@ -1037,7 +1037,7 @@ def receive_push_promise_in_band(self,
10371037 events = self .state_machine .process_input (
10381038 StreamInputs .RECV_PUSH_PROMISE ,
10391039 )
1040- push_event = cast (PushedStreamReceived , events [0 ])
1040+ push_event = cast (" PushedStreamReceived" , events [0 ])
10411041 push_event .pushed_stream_id = promised_stream_id
10421042
10431043 hdr_validation_flags = self ._build_hdr_validation_flags (events )
@@ -1076,7 +1076,7 @@ def receive_headers(self,
10761076
10771077 events = self .state_machine .process_input (input_ )
10781078 headers_event = cast (
1079- Union [RequestReceived , ResponseReceived , TrailersReceived , InformationalResponseReceived ],
1079+ " Union[RequestReceived, ResponseReceived, TrailersReceived, InformationalResponseReceived]" ,
10801080 events [0 ],
10811081 )
10821082
@@ -1086,9 +1086,9 @@ def receive_headers(self,
10861086 )
10871087 # We ensured it's not an information response at the beginning of the method.
10881088 cast (
1089- Union [RequestReceived , ResponseReceived , TrailersReceived ],
1089+ " Union[RequestReceived, ResponseReceived, TrailersReceived]" ,
10901090 headers_event ,
1091- ).stream_ended = cast (StreamEnded , es_events [0 ])
1091+ ).stream_ended = cast (" StreamEnded" , es_events [0 ])
10921092 events += es_events
10931093
10941094 self ._initialize_content_length (headers )
@@ -1112,15 +1112,15 @@ def receive_data(self, data: bytes, end_stream: bool, flow_control_len: int) ->
11121112 "set to %d" , self , end_stream , flow_control_len ,
11131113 )
11141114 events = self .state_machine .process_input (StreamInputs .RECV_DATA )
1115- data_event = cast (DataReceived , events [0 ])
1115+ data_event = cast (" DataReceived" , events [0 ])
11161116 self ._inbound_window_manager .window_consumed (flow_control_len )
11171117 self ._track_content_length (len (data ), end_stream )
11181118
11191119 if end_stream :
11201120 es_events = self .state_machine .process_input (
11211121 StreamInputs .RECV_END_STREAM ,
11221122 )
1123- data_event .stream_ended = cast (StreamEnded , es_events [0 ])
1123+ data_event .stream_ended = cast (" StreamEnded" , es_events [0 ])
11241124 events .extend (es_events )
11251125
11261126 data_event .data = data
@@ -1144,7 +1144,7 @@ def receive_window_update(self, increment: int) -> tuple[list[Frame], list[Event
11441144 # this should be treated as a *stream* error, not a *connection* error.
11451145 # That means we need to catch the error and forcibly close the stream.
11461146 if events :
1147- cast (WindowUpdated , events [0 ]).delta = increment
1147+ cast (" WindowUpdated" , events [0 ]).delta = increment
11481148 try :
11491149 self .outbound_flow_control_window = guard_increment_window (
11501150 self .outbound_flow_control_window ,
@@ -1228,7 +1228,7 @@ def stream_reset(self, frame: RstStreamFrame) -> tuple[list[Frame], list[Event]]
12281228
12291229 if events :
12301230 # 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 )
12321232
12331233 return [], events
12341234
0 commit comments