Add parameters to generics in `_client.py` (#2266)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Ramazan Elsunakev · committed by GitHub · parent 36f1623 · Browse files · 1 file·+12 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: Tom Christie <tom@tomchristie.com>
- Co-authored-by: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>
Diff stats
1 file+12 added−9 removed
- other:+12 added−9 removed
Provenance
- Commit
71ee50b- Tree
06eb4a1- Author
Ramazan Elsunakev <35545693+relsunkaev@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
36f1623
1 file changed+12 added−9 removed
modified:httpx/_client.py+12 added-9 removed
151 unmodified lines152 self._response.elapsed = datetime.timedelta(seconds=seconds)153 await self._stream.aclose()154 155 156+EventHook = typing.Callable[..., typing.Any]157+158+159 class BaseClient:160 def __init__(161 self,162 *,4 unmodified lines167 timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,168 follow_redirects: bool = False,169 max_redirects: int = DEFAULT_MAX_REDIRECTS,170 event_hooks: typing.Optional[168- typing.Mapping[str, typing.List[typing.Callable]]171+ typing.Mapping[str, typing.List[EventHook]]172 ] = None,173 base_url: URLTypes = "",174 trust_env: bool = True,175 default_encoding: typing.Union[str, typing.Callable[[bytes], str]] = "utf-8",62 unmodified lines238 def timeout(self, timeout: TimeoutTypes) -> None:239 self._timeout = Timeout(timeout)240 241 @property239- def event_hooks(self) -> typing.Dict[str, typing.List[typing.Callable]]:242+ def event_hooks(self) -> typing.Dict[str, typing.List[EventHook]]:243 return self._event_hooks244 245 @event_hooks.setter246 def event_hooks(244- self, event_hooks: typing.Dict[str, typing.List[typing.Callable]]247+ self, event_hooks: typing.Dict[str, typing.List[EventHook]]248 ) -> None:249 self._event_hooks = {250 "request": list(event_hooks.get("request", [])),251 "response": list(event_hooks.get("response", [])),389 unmodified lines641 follow_redirects: bool = False,642 limits: Limits = DEFAULT_LIMITS,643 max_redirects: int = DEFAULT_MAX_REDIRECTS,644 event_hooks: typing.Optional[642- typing.Mapping[str, typing.List[typing.Callable]]645+ typing.Mapping[str, typing.List[EventHook]]646 ] = None,647 base_url: URLTypes = "",648 transport: typing.Optional[BaseTransport] = None,646- app: typing.Optional[typing.Callable] = None,649+ app: typing.Optional[typing.Callable[..., typing.Any]] = None,650 trust_env: bool = True,651 default_encoding: typing.Union[str, typing.Callable[[bytes], str]] = "utf-8",652 ):653 super().__init__(60 unmodified lines714 http1: bool = True,715 http2: bool = False,716 limits: Limits = DEFAULT_LIMITS,717 transport: typing.Optional[BaseTransport] = None,715- app: typing.Optional[typing.Callable] = None,718+ app: typing.Optional[typing.Callable[..., typing.Any]] = None,719 trust_env: bool = True,720 ) -> BaseTransport:721 if transport is not None:722 return transport639 unmodified lines1362 follow_redirects: bool = False,1363 limits: Limits = DEFAULT_LIMITS,1364 max_redirects: int = DEFAULT_MAX_REDIRECTS,1365 event_hooks: typing.Optional[1363- typing.Mapping[str, typing.List[typing.Callable]]1366+ typing.Mapping[str, typing.List[typing.Callable[..., typing.Any]]]1367 ] = None,1368 base_url: URLTypes = "",1369 transport: typing.Optional[AsyncBaseTransport] = None,1367- app: typing.Optional[typing.Callable] = None,1370+ app: typing.Optional[typing.Callable[..., typing.Any]] = None,1371 trust_env: bool = True,1372 default_encoding: typing.Union[str, typing.Callable[[bytes], str]] = "utf-8",1373 ):1374 super().__init__(60 unmodified lines1435 http1: bool = True,1436 http2: bool = False,1437 limits: Limits = DEFAULT_LIMITS,1438 transport: typing.Optional[AsyncBaseTransport] = None,1436- app: typing.Optional[typing.Callable] = None,1439+ app: typing.Optional[typing.Callable[..., typing.Any]] = None,1440 trust_env: bool = True,1441 ) -> AsyncBaseTransport:1442 if transport is not None:1443 return transport563 unmodified lines