From ac0b809bf563a0f60be9ccc1aea1079897af43cb Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Fri, 26 May 2017 08:45:52 -0700 Subject: [PATCH] tweak files to fix pytype parsing errors (#1325) * Don't use "\" to join lines --- stdlib/3/email/headerregistry.pyi | 3 +-- stdlib/3/email/message.pyi | 6 ++---- stdlib/3/http/cookiejar.pyi | 3 +-- stdlib/3/ssl.pyi | 9 +++------ stdlib/3/urllib/request.pyi | 6 ++---- tests/pytype_blacklist.txt | 3 --- 6 files changed, 9 insertions(+), 21 deletions(-) diff --git a/stdlib/3/email/headerregistry.pyi b/stdlib/3/email/headerregistry.pyi index b20ddbe90..6f14cc0b9 100644 --- a/stdlib/3/email/headerregistry.pyi +++ b/stdlib/3/email/headerregistry.pyi @@ -97,6 +97,5 @@ if sys.version_info >= (3, 3): display_name = ... # type: Optional[str] addresses = ... # type: Tuple[Address, ...] def __init__(self, display_name: Optional[str] = ..., - addresses: Optional[Tuple[Address, ...]] = ...) \ - -> None: ... + addresses: Optional[Tuple[Address, ...]] = ...) -> None: ... def __str__(self) -> str: ... diff --git a/stdlib/3/email/message.pyi b/stdlib/3/email/message.pyi index 3acd111dd..824493968 100644 --- a/stdlib/3/email/message.pyi +++ b/stdlib/3/email/message.pyi @@ -29,8 +29,7 @@ class Message: def set_unixfrom(self, unixfrom: str) -> None: ... def get_unixfrom(self) -> Optional[str]: ... def attach(self, payload: 'Message') -> None: ... - def get_payload(self, i: int = ..., decode: bool = ...) \ - -> Optional[_PayloadType]: ... + def get_payload(self, i: int = ..., decode: bool = ...) -> Optional[_PayloadType]: ... def set_payload(self, payload: _PayloadType, charset: _CharsetType = ...) -> None: ... def set_charset(self, charset: _CharsetType) -> None: ... @@ -45,8 +44,7 @@ class Message: def items(self) -> List[Tuple[str, str]]: ... def get(self, name: str, failobj: _T = ...) -> Union[str, _T]: ... def get_all(self, name: str, failobj: _T = ...) -> Union[List[str], _T]: ... - def add_header(self, _name: str, _value: str, **_params: _ParamsType) \ - -> None: ... + def add_header(self, _name: str, _value: str, **_params: _ParamsType) -> None: ... def replace_header(self, _name: str, _value: str) -> None: ... def get_content_type(self) -> str: ... def get_content_maintype(self) -> str: ... diff --git a/stdlib/3/http/cookiejar.pyi b/stdlib/3/http/cookiejar.pyi index 38de5a33c..801a5a66e 100644 --- a/stdlib/3/http/cookiejar.pyi +++ b/stdlib/3/http/cookiejar.pyi @@ -83,8 +83,7 @@ class DefaultCookiePolicy(CookiePolicy): def set_blocked_domains(self, blocked_domains: Sequence[str]) -> None: ... def is_blocked(self, domain: str) -> bool: ... def allowed_domains(self) -> Optional[Tuple[str, ...]]: ... - def set_allowed_domains(self, allowed_domains: Optional[Sequence[str]]) \ - -> None: ... + def set_allowed_domains(self, allowed_domains: Optional[Sequence[str]]) -> None: ... def is_not_allowed(self, domain: str) -> bool: ... diff --git a/stdlib/3/ssl.pyi b/stdlib/3/ssl.pyi index 87ddd659e..988050404 100644 --- a/stdlib/3/ssl.pyi +++ b/stdlib/3/ssl.pyi @@ -205,11 +205,9 @@ class SSLContext: def load_default_certs(self, purpose: _PurposeType = ...) -> None: ... def load_verify_locations(self, cafile: Optional[str] = ..., capath: Optional[str] = ..., - cadata: Union[str, bytes, None] = ...) \ - -> None: ... + cadata: Union[str, bytes, None] = ...) -> None: ... def get_ca_certs(self, - binary_form: bool = ...) \ - -> Union[List[_PeerCertRetDictType], List[bytes]]: ... + binary_form: bool = ...) -> Union[List[_PeerCertRetDictType], List[bytes]]: ... else: def load_verify_locations(self, cafile: Optional[str] = ..., @@ -220,8 +218,7 @@ class SSLContext: def set_alpn_protocols(self, protocols: List[str]) -> None: ... def set_npn_protocols(self, protocols: List[str]) -> None: ... def set_servername_callback(self, - server_name_callback: Optional[_SrvnmeCbType]) \ - -> None: ... + server_name_callback: Optional[_SrvnmeCbType]) -> None: ... def load_dh_params(self, dhfile: str) -> None: ... def set_ecdh_curve(self, curve_name: str) -> None: ... def wrap_socket(self, sock: socket.socket, server_side: bool = ..., diff --git a/stdlib/3/urllib/request.pyi b/stdlib/3/urllib/request.pyi index dca209fc6..8548a889c 100644 --- a/stdlib/3/urllib/request.pyi +++ b/stdlib/3/urllib/request.pyi @@ -106,14 +106,12 @@ class ProxyHandler(BaseHandler): class HTTPPasswordMgr: def add_password(self, realm: str, uri: Union[str, Sequence[str]], user: str, passwd: str) -> None: ... - def find_user_password(self, realm: str, authuri: str) \ - -> Tuple[Optional[str], Optional[str]]: ... + def find_user_password(self, realm: str, authuri: str) -> Tuple[Optional[str], Optional[str]]: ... class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): def add_password(self, realm: str, uri: Union[str, Sequence[str]], user: str, passwd: str) -> None: ... - def find_user_password(self, realm: str, authuri: str) \ - -> Tuple[Optional[str], Optional[str]]: ... + def find_user_password(self, realm: str, authuri: str) -> Tuple[Optional[str], Optional[str]]: ... if sys.version_info >= (3, 5): class HTTPPasswordMgrWithPriorAuth(HTTPPasswordMgrWithDefaultRealm): diff --git a/tests/pytype_blacklist.txt b/tests/pytype_blacklist.txt index 2e9712f6d..53377dbe8 100644 --- a/tests/pytype_blacklist.txt +++ b/tests/pytype_blacklist.txt @@ -23,8 +23,6 @@ stdlib/3/concurrent/futures/__init__.pyi stdlib/3/concurrent/futures/_base.pyi stdlib/3/concurrent/futures/process.pyi stdlib/3/concurrent/futures/thread.pyi -stdlib/3/email/headerregistry.pyi -stdlib/3/email/message.pyi stdlib/3/email/policy.pyi stdlib/3/fileinput.pyi stdlib/3/gzip.pyi @@ -44,7 +42,6 @@ stdlib/3/types.pyi stdlib/3/unittest/__init__.pyi stdlib/3/unittest/mock.pyi stdlib/3/urllib/parse.pyi -stdlib/3/urllib/request.pyi stdlib/3/wsgiref/types.pyi stdlib/3.4/asyncio/events.pyi stdlib/3.4/asyncio/futures.pyi