From b8299bd58a62e4675377f5d024e7fe99ca91d92f Mon Sep 17 00:00:00 2001 From: Shantanu Date: Sat, 11 Jan 2020 08:20:46 -0800 Subject: [PATCH] http: update for py38 (#3606) * http: add UNAVAILABLE_FOR_LEGAL_REASONS * http.cookiejar: filename parameter now supports path-like --- stdlib/3/http/__init__.pyi | 2 ++ stdlib/3/http/cookiejar.pyi | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/stdlib/3/http/__init__.pyi b/stdlib/3/http/__init__.pyi index 8e12f7997..3abd978a5 100644 --- a/stdlib/3/http/__init__.pyi +++ b/stdlib/3/http/__init__.pyi @@ -65,3 +65,5 @@ class HTTPStatus(IntEnum): NETWORK_AUTHENTICATION_REQUIRED: int if sys.version_info >= (3, 7): MISDIRECTED_REQUEST: int + if sys.version_info >= (3, 8): + UNAVAILABLE_FOR_LEGAL_REASONS: int diff --git a/stdlib/3/http/cookiejar.pyi b/stdlib/3/http/cookiejar.pyi index 9e31fb994..44d7b5134 100644 --- a/stdlib/3/http/cookiejar.pyi +++ b/stdlib/3/http/cookiejar.pyi @@ -1,6 +1,9 @@ +import sys from typing import Dict, Iterable, Iterator, Optional, Sequence, Tuple, TypeVar, Union, overload from http.client import HTTPResponse from urllib.request import Request +if sys.version_info >= (3, 6): + from os import PathLike _T = TypeVar('_T') @@ -27,8 +30,12 @@ class CookieJar(Iterable[Cookie]): class FileCookieJar(CookieJar): filename: str delayload: bool - def __init__(self, filename: str = ..., delayload: bool = ..., - policy: Optional[CookiePolicy] = ...) -> None: ... + if sys.version_info >= (3, 8): + def __init__(self, filename: Union[str, PathLike[str]] = ..., delayload: bool = ..., + policy: Optional[CookiePolicy] = ...) -> None: ... + else: + def __init__(self, filename: str = ..., delayload: bool = ..., + policy: Optional[CookiePolicy] = ...) -> None: ... def save(self, filename: Optional[str] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ... def load(self, filename: Optional[str] = ..., ignore_discard: bool = ...,