Remove Python 3.4 support (#3147)

Closes #3123
This commit is contained in:
Sebastian Rittau
2019-07-27 10:58:21 +02:00
committed by GitHub
parent 4697adcb1a
commit 9ccf9356bf
55 changed files with 988 additions and 1266 deletions

30
third_party/3/contextvars.pyi vendored Normal file
View File

@@ -0,0 +1,30 @@
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, Union
_T = TypeVar('_T')
class ContextVar(Generic[_T]):
def __init__(self, name: str, *, default: _T = ...) -> None: ...
@property
def name(self) -> str: ...
def get(self, default: _T = ...) -> _T: ...
def set(self, value: _T) -> Token[_T]: ...
def reset(self, token: Token[_T]) -> None: ...
class Token(Generic[_T]):
@property
def var(self) -> ContextVar[_T]: ...
@property
def old_value(self) -> Any: ... # returns either _T or MISSING, but that's hard to express
MISSING: ClassVar[object]
def copy_context() -> Context: ...
# It doesn't make sense to make this generic, because for most Contexts each ContextVar will have
# a different value.
class Context(Mapping[ContextVar[Any], Any]):
def __init__(self) -> None: ...
def run(self, callable: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ...
def copy(self) -> Context: ...
def __getitem__(self, key: ContextVar[Any]) -> Any: ...
def __iter__(self) -> Iterator[ContextVar[Any]]: ...
def __len__(self) -> int: ...

View File

@@ -4,11 +4,4 @@ import sys
needs_makedirs: bool
def _makedirs_31(path: Text, exist_ok: bool = ...) -> None: ...
# _makedirs_31 has special behavior to handle an edge case that was removed in
# 3.4.1. No one should be using 3.4 instead of 3.4.1, so this should be fine.
if sys.version_info >= (3,):
makedirs = os.makedirs
else:
makedirs = _makedirs_31
makedirs = os.makedirs