From ee07115c961a66de4e015621dc978befcc361345 Mon Sep 17 00:00:00 2001 From: Philipp Hahn Date: Thu, 28 Jun 2018 05:13:46 +0200 Subject: [PATCH] urllib2.build_open() accepts instances and classes (#2284) > handlers can be either instances of BaseHandler, or subclasses of > BaseHandler (in which case it must be possible to call the constructor > without any parameters). --- stdlib/2/urllib2.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/2/urllib2.pyi b/stdlib/2/urllib2.pyi index 64ee2021a..e15289738 100644 --- a/stdlib/2/urllib2.pyi +++ b/stdlib/2/urllib2.pyi @@ -1,6 +1,6 @@ import ssl -from typing import Any, AnyStr, Dict, List, Union, Optional, Mapping, Callable, Sequence, Tuple +from typing import Any, AnyStr, Dict, List, Union, Optional, Mapping, Callable, Sequence, Tuple, Type from urllib import addinfourl from httplib import HTTPResponse @@ -53,7 +53,7 @@ def urlopen(url: Union[Request, _string], data: Optional[_string] = ..., timeout cafile: Optional[_string] = ..., capath: Optional[_string] = ..., cadefault: bool = ..., context: Optional[ssl.SSLContext] = ...): ... def install_opener(opener: OpenerDirector) -> None: ... -def build_opener(*handlers: BaseHandler) -> OpenerDirector: ... +def build_opener(*handlers: Union[BaseHandler, Type[BaseHandler]]) -> OpenerDirector: ... class BaseHandler: handler_order = ... # type: int