MCPcopy
hub / github.com/encode/uvicorn / get_connected_protocol

Function get_connected_protocol

tests/benchmarks/http.py:164–174  ·  view source on GitHub ↗
(
    config: Config,
    http_protocol_cls: type[HTTPProtocol],
)

Source from the content-addressed store, hash-verified

162
163
164def get_connected_protocol(
165 config: Config,
166 http_protocol_cls: type[HTTPProtocol],
167) -> MockProtocol:
168 loop = MockLoop()
169 transport = MockTransport()
170 lifespan = LifespanOff(config)
171 server_state = ServerState()
172 protocol = http_protocol_cls(config=config, server_state=server_state, app_state=lifespan.state, _loop=loop) # type: ignore
173 protocol.connection_made(transport) # type: ignore[arg-type]
174 return protocol # type: ignore[return-value]

Callers 10

test_bench_simple_getFunction · 0.90
test_bench_simple_postFunction · 0.90
test_bench_large_postFunction · 0.90
test_bench_http10Function · 0.90

Calls 6

LifespanOffClass · 0.90
ServerStateClass · 0.90
http_protocol_clsFunction · 0.85
MockLoopClass · 0.70
MockTransportClass · 0.70
connection_madeMethod · 0.45

Tested by 10

test_bench_simple_getFunction · 0.72
test_bench_simple_postFunction · 0.72
test_bench_large_postFunction · 0.72
test_bench_http10Function · 0.72