MCPcopy Index your code
hub / github.com/nonebot/nonebot2 / _get_timeout

Method _get_timeout

nonebot/drivers/aiohttp.py:124–141  ·  view source on GitHub ↗
(self, timeout: TimeoutTypes | UnsetType)

Source from the content-addressed store, hash-verified

122 return self._client
123
124 def _get_timeout(self, timeout: TimeoutTypes | UnsetType) -> aiohttp.ClientTimeout:
125 _timeout = None
126 if isinstance(timeout, Timeout):
127 timeout_kwargs: dict[str, float | None] = exclude_unset(
128 {
129 "total": timeout.total,
130 "connect": timeout.connect,
131 "sock_read": timeout.read,
132 }
133 )
134 if timeout_kwargs:
135 _timeout = aiohttp.ClientTimeout(**timeout_kwargs) # type: ignore
136 elif timeout is not UNSET:
137 _timeout = aiohttp.ClientTimeout(connect=timeout, sock_read=timeout)
138
139 if _timeout is None:
140 return self._timeout
141 return _timeout
142
143 @override
144 async def request(self, setup: Request) -> Response:

Callers 2

requestMethod · 0.95
stream_requestMethod · 0.95

Calls 1

exclude_unsetFunction · 0.90

Tested by

no test coverage detected