MCPcopy Index your code
hub / github.com/microsoft/playwright-python / _inner_send

Method _inner_send

playwright/_impl/_connection.py:109–144  ·  view source on GitHub ↗
(
        self,
        method: str,
        timeout_calculator: TimeoutCalculator,
        params: Optional[Dict],
        return_as_dict: bool,
    )

Source from the content-addressed store, hash-verified

107 )
108
109 async def _inner_send(
110 self,
111 method: str,
112 timeout_calculator: TimeoutCalculator,
113 params: Optional[Dict],
114 return_as_dict: bool,
115 ) -> Any:
116 if self._connection._error:
117 error = self._connection._error
118 self._connection._error = None
119 raise error
120 callback = self._connection._send_message_to_server(
121 self._object, method, _augment_params(params, timeout_calculator)
122 )
123 done, _ = await asyncio.wait(
124 {
125 self._connection._transport.on_error_future,
126 callback.future,
127 },
128 return_when=asyncio.FIRST_COMPLETED,
129 )
130 if not callback.future.done():
131 callback.future.cancel()
132 result = next(iter(done)).result()
133 # Protocol now has named return values, assume result is one level deeper unless
134 # there is explicit ambiguity.
135 if not result:
136 return None
137 assert isinstance(result, dict)
138 if return_as_dict:
139 return result
140 if len(result) == 0:
141 return None
142 assert len(result) == 1
143 key = next(iter(result))
144 return result[key]
145
146
147class ChannelOwner(AsyncIOEventEmitter):

Callers 2

sendMethod · 0.95
send_return_as_dictMethod · 0.95

Calls 4

_augment_paramsFunction · 0.85
resultMethod · 0.80
cancelMethod · 0.45

Tested by

no test coverage detected