diff --git a/stubs/2.7/typing.py b/stubs/2.7/typing.py index ea042db116d8..17e3382d9766 100644 --- a/stubs/2.7/typing.py +++ b/stubs/2.7/typing.py @@ -39,9 +39,9 @@ def __getitem__(self, typeargs): # Abstract base classes. -T = typevar('T') -KT = typevar('KT') -VT = typevar('VT') +_T = typevar('_T') +_KT = typevar('_KT') +_VT = typevar('_VT') # TODO Container etc. @@ -53,113 +53,113 @@ class SupportsFloat(metaclass=ABCMeta): @abstractmethod def __float__(self) -> float: pass -class SupportsAbs(AbstractGeneric[T]): +class SupportsAbs(AbstractGeneric[_T]): @abstractmethod - def __abs__(self) -> T: pass + def __abs__(self) -> _T: pass @disjointclass(int) @disjointclass(float) -class SupportsRound(AbstractGeneric[T]): +class SupportsRound(AbstractGeneric[_T]): @abstractmethod - def __round__(self, ndigits: int = 0) -> T: pass + def __round__(self, ndigits: int = 0) -> _T: pass -class Reversible(AbstractGeneric[T]): +class Reversible(AbstractGeneric[_T]): @abstractmethod - def __reversed__(self) -> Iterator[T]: pass + def __reversed__(self) -> Iterator[_T]: pass class Sized(metaclass=ABCMeta): @abstractmethod def __len__(self) -> int: pass -class Iterable(AbstractGeneric[T]): +class Iterable(AbstractGeneric[_T]): @abstractmethod - def __iter__(self) -> Iterator[T]: pass + def __iter__(self) -> Iterator[_T]: pass -class Iterator(Iterable[T], AbstractGeneric[T]): +class Iterator(Iterable[_T], AbstractGeneric[_T]): @abstractmethod - def next(self) -> T: pass + def next(self) -> _T: pass -class Sequence(Sized, Iterable[T], AbstractGeneric[T]): +class Sequence(Sized, Iterable[_T], AbstractGeneric[_T]): @abstractmethod def __contains__(self, x: object) -> bool: pass @overload @abstractmethod - def __getitem__(self, i: int) -> T: pass + def __getitem__(self, i: int) -> _T: pass @overload @abstractmethod - def __getitem__(self, s: slice) -> Sequence[T]: pass + def __getitem__(self, s: slice) -> Sequence[_T]: pass -class AbstractSet(Sized, Iterable[T], AbstractGeneric[T]): +class AbstractSet(Sized, Iterable[_T], AbstractGeneric[_T]): @abstractmethod def __contains__(self, x: object) -> bool: pass # TODO __le__, __lt__, __gt__, __ge__ @abstractmethod - def __and__(self, s: AbstractSet[T]) -> AbstractSet[T]: pass + def __and__(self, s: AbstractSet[_T]) -> AbstractSet[_T]: pass @abstractmethod - def __or__(self, s: AbstractSet[T]) -> AbstractSet[T]: pass + def __or__(self, s: AbstractSet[_T]) -> AbstractSet[_T]: pass @abstractmethod - def __sub__(self, s: AbstractSet[T]) -> AbstractSet[T]: pass + def __sub__(self, s: AbstractSet[_T]) -> AbstractSet[_T]: pass @abstractmethod - def __xor__(self, s: AbstractSet[T]) -> AbstractSet[T]: pass + def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[_T]: pass # TODO argument can be any container? @abstractmethod - def isdisjoint(self, s: AbstractSet[T]) -> bool: pass + def isdisjoint(self, s: AbstractSet[_T]) -> bool: pass -class Mapping(Sized, Iterable[KT], AbstractGeneric[KT, VT]): +class Mapping(Sized, Iterable[_KT], AbstractGeneric[_KT, _VT]): @abstractmethod - def __getitem__(self, k: KT) -> VT: pass + def __getitem__(self, k: _KT) -> _VT: pass @abstractmethod - def __setitem__(self, k: KT, v: VT) -> None: pass + def __setitem__(self, k: _KT, v: _VT) -> None: pass @abstractmethod - def __delitem__(self, v: KT) -> None: pass + def __delitem__(self, v: _KT) -> None: pass @abstractmethod def __contains__(self, o: object) -> bool: pass @abstractmethod def clear(self) -> None: pass @abstractmethod - def copy(self) -> Mapping[KT, VT]: pass + def copy(self) -> Mapping[_KT, _VT]: pass @overload @abstractmethod - def get(self, k: KT) -> VT: pass + def get(self, k: _KT) -> _VT: pass @overload @abstractmethod - def get(self, k: KT, default: VT) -> VT: pass + def get(self, k: _KT, default: _VT) -> _VT: pass @overload @abstractmethod - def pop(self, k: KT) -> VT: pass + def pop(self, k: _KT) -> _VT: pass @overload @abstractmethod - def pop(self, k: KT, default: VT) -> VT: pass + def pop(self, k: _KT, default: _VT) -> _VT: pass @abstractmethod - def popitem(self) -> Tuple[KT, VT]: pass + def popitem(self) -> Tuple[_KT, _VT]: pass @overload @abstractmethod - def setdefault(self, k: KT) -> VT: pass + def setdefault(self, k: _KT) -> _VT: pass @overload @abstractmethod - def setdefault(self, k: KT, default: VT) -> VT: pass + def setdefault(self, k: _KT, default: _VT) -> _VT: pass # TODO keyword arguments @overload @abstractmethod - def update(self, m: Mapping[KT, VT]) -> None: pass + def update(self, m: Mapping[_KT, _VT]) -> None: pass @overload @abstractmethod - def update(self, m: Iterable[Tuple[KT, VT]]) -> None: pass + def update(self, m: Iterable[Tuple[_KT, _VT]]) -> None: pass @abstractmethod - def keys(self) -> list[KT]: pass + def keys(self) -> list[_KT]: pass @abstractmethod - def values(self) -> list[VT]: pass + def values(self) -> list[_VT]: pass @abstractmethod - def items(self) -> list[Tuple[KT, VT]]: pass + def items(self) -> list[Tuple[_KT, _VT]]: pass @abstractmethod - def iterkeys(self) -> Iterator[KT]: pass + def iterkeys(self) -> Iterator[_KT]: pass @abstractmethod - def itervalues(self) -> Iterator[VT]: pass + def itervalues(self) -> Iterator[_VT]: pass @abstractmethod - def iteritems(self) -> Iterator[Tuple[KT, VT]]: pass + def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: pass class IO(Iterable[AnyStr], AbstractGeneric[AnyStr]): # TODO detach diff --git a/stubs/3.2/atexit.py b/stubs/3.2/atexit.py index 24183c3b34ee..780965cd34ba 100644 --- a/stubs/3.2/atexit.py +++ b/stubs/3.2/atexit.py @@ -1,5 +1,5 @@ from typing import typevar, Any -FT = typevar('FT') +_FT = typevar('_FT') -def register(func: FT, *args: Any, **kargs: Any) -> FT: pass +def register(func: _FT, *args: Any, **kargs: Any) -> _FT: pass diff --git a/stubs/3.2/collections.py b/stubs/3.2/collections.py index 30b147c8674c..b7b25983c6ef 100644 --- a/stubs/3.2/collections.py +++ b/stubs/3.2/collections.py @@ -13,87 +13,87 @@ Mapping, List, Tuple, Undefined, Function, Set, Sequence, Sized ) -T = typevar('T') -KT = typevar('KT') -VT = typevar('VT') +_T = typevar('_T') +_KT = typevar('_KT') +_VT = typevar('_VT') -class deque(Sized, Iterable[T], AbstractGeneric[T]): +class deque(Sized, Iterable[_T], AbstractGeneric[_T]): # TODO int with None default maxlen = 0 # TODO readonly - def __init__(self, iterable: Iterable[T] = None, + def __init__(self, iterable: Iterable[_T] = None, maxlen: int = None) -> None: pass - def append(self, x: T) -> None: pass - def appendleft(self, x: T) -> None: pass + def append(self, x: _T) -> None: pass + def appendleft(self, x: _T) -> None: pass def clear(self) -> None: pass - def count(self, x: T) -> int: pass - def extend(self, iterable: Iterable[T]) -> None: pass - def extendleft(self, iterable: Iterable[T]) -> None: pass - def pop(self) -> T: pass - def popleft(self) -> T: pass - def remove(self, value: T) -> None: pass + def count(self, x: _T) -> int: pass + def extend(self, iterable: Iterable[_T]) -> None: pass + def extendleft(self, iterable: Iterable[_T]) -> None: pass + def pop(self) -> _T: pass + def popleft(self) -> _T: pass + def remove(self, value: _T) -> None: pass def reverse(self) -> None: pass def rotate(self, n: int) -> None: pass def __len__(self) -> int: pass - def __iter__(self) -> Iterator[T]: pass + def __iter__(self) -> Iterator[_T]: pass def __str__(self) -> str: pass def __hash__(self) -> int: pass - def __getitem__(self, i: int) -> T: pass - def __setitem__(self, i: int, x: T) -> None: pass - def __contains__(self, o: T) -> bool: pass + def __getitem__(self, i: int) -> _T: pass + def __setitem__(self, i: int, x: _T) -> None: pass + def __contains__(self, o: _T) -> bool: pass # TODO __reversed__ -class Counter(Dict[T, int], Generic[T]): +class Counter(Dict[_T, int], Generic[_T]): @overload def __init__(self) -> None: pass @overload - def __init__(self, Mapping: Mapping[T, int]) -> None: pass + def __init__(self, Mapping: Mapping[_T, int]) -> None: pass @overload - def __init__(self, iterable: Iterable[T]) -> None: pass + def __init__(self, iterable: Iterable[_T]) -> None: pass # TODO keyword arguments - def elements(self) -> Iterator[T]: pass + def elements(self) -> Iterator[_T]: pass @overload - def most_common(self) -> List[T]: pass + def most_common(self) -> List[_T]: pass @overload - def most_common(self, n: int) -> List[T]: pass + def most_common(self, n: int) -> List[_T]: pass @overload - def subtract(self, Mapping: Mapping[T, int]) -> None: pass + def subtract(self, Mapping: Mapping[_T, int]) -> None: pass @overload - def subtract(self, iterable: Iterable[T]) -> None: pass + def subtract(self, iterable: Iterable[_T]) -> None: pass # TODO update -class OrderedDict(Dict[KT, VT], Generic[KT, VT]): - def popitem(self, last: bool = True) -> Tuple[KT, VT]: pass - def move_to_end(self, key: KT, last: bool = True) -> None: pass +class OrderedDict(Dict[_KT, _VT], Generic[_KT, _VT]): + def popitem(self, last: bool = True) -> Tuple[_KT, _VT]: pass + def move_to_end(self, key: _KT, last: bool = True) -> None: pass -class defaultdict(Dict[KT, VT], Generic[KT, VT]): - default_factory = Undefined(Function[[], VT]) +class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): + default_factory = Undefined(Function[[], _VT]) @overload def __init__(self) -> None: pass @overload - def __init__(self, map: Mapping[KT, VT]) -> None: pass + def __init__(self, map: Mapping[_KT, _VT]) -> None: pass @overload - def __init__(self, iterable: Iterable[Tuple[KT, VT]]) -> None: pass + def __init__(self, iterable: Iterable[Tuple[_KT, _VT]]) -> None: pass @overload - def __init__(self, default_factory: Function[[], VT]) -> None: pass + def __init__(self, default_factory: Function[[], _VT]) -> None: pass @overload - def __init__(self, default_factory: Function[[], VT], - map: Mapping[KT, VT]) -> None: pass + def __init__(self, default_factory: Function[[], _VT], + map: Mapping[_KT, _VT]) -> None: pass @overload - def __init__(self, default_factory: Function[[], VT], - iterable: Iterable[Tuple[KT, VT]]) -> None: pass + def __init__(self, default_factory: Function[[], _VT], + iterable: Iterable[Tuple[_KT, _VT]]) -> None: pass # TODO __init__ keyword args - def __missing__(self, key: KT) -> VT: pass + def __missing__(self, key: _KT) -> _VT: pass # TODO __reversed__ diff --git a/stubs/3.2/copy.py b/stubs/3.2/copy.py index 103999a491f6..2208a8428190 100644 --- a/stubs/3.2/copy.py +++ b/stubs/3.2/copy.py @@ -4,6 +4,6 @@ from typing import typevar -T = typevar('T') +_T = typevar('_T') -def deepcopy(x: T) -> T: pass +def deepcopy(x: _T) -> _T: pass diff --git a/stubs/3.2/heapq.py b/stubs/3.2/heapq.py index ba6a9bba58b6..fb365bacb693 100644 --- a/stubs/3.2/heapq.py +++ b/stubs/3.2/heapq.py @@ -4,15 +4,15 @@ from typing import typevar, List, Iterable, Any, Function -T = typevar('T') +_T = typevar('_T') -def heappush(heap: List[T], item: T) -> None: pass -def heappop(heap: List[T]) -> T: pass -def heappushpop(heap: List[T], item: T) -> T: pass -def heapify(x: List[T]) -> None: pass -def heapreplace(heap: List[T], item: T) -> T: pass -def merge(*iterables: Iterable[T]) -> Iterable[T]: pass -def nlargest(n: int, iterable: Iterable[T], - key: Function[[T], Any] = None) -> List[T]: pass -def nsmallest(n: int, iterable: Iterable[T], - key: Function[[T], Any] = None) -> List[T]: pass +def heappush(heap: List[_T], item: _T) -> None: pass +def heappop(heap: List[_T]) -> _T: pass +def heappushpop(heap: List[_T], item: _T) -> _T: pass +def heapify(x: List[_T]) -> None: pass +def heapreplace(heap: List[_T], item: _T) -> _T: pass +def merge(*iterables: Iterable[_T]) -> Iterable[_T]: pass +def nlargest(n: int, iterable: Iterable[_T], + key: Function[[_T], Any] = None) -> List[_T]: pass +def nsmallest(n: int, iterable: Iterable[_T], + key: Function[[_T], Any] = None) -> List[_T]: pass diff --git a/stubs/3.2/imp.py b/stubs/3.2/imp.py index c60e195a0611..8344134c1a01 100644 --- a/stubs/3.2/imp.py +++ b/stubs/3.2/imp.py @@ -4,7 +4,7 @@ from typing import typevar -T = typevar('T') +_T = typevar('_T') def cache_from_source(path: str, debug_override: bool = None) -> str: pass -def reload(module: T) -> T: pass # TODO imprecise signature +def reload(module: _T) -> _T: pass # TODO imprecise signature diff --git a/stubs/3.2/itertools.py b/stubs/3.2/itertools.py index e1445851c451..a54bfcb2444c 100644 --- a/stubs/3.2/itertools.py +++ b/stubs/3.2/itertools.py @@ -5,53 +5,53 @@ from typing import (Iterator, typevar, Iterable, overload, Any, Function, Tuple, Union, Sequence) -T = typevar('T') -S = typevar('S') +_T = typevar('_T') +_S = typevar('_S') def count(start: int = 0, step: int = 1) -> Iterator[int]: pass # more general types? -def cycle(iterable: Iterable[T]) -> Iterator[T]: pass +def cycle(iterable: Iterable[_T]) -> Iterator[_T]: pass @overload -def repeat(object: T) -> Iterator[T]: pass +def repeat(object: _T) -> Iterator[_T]: pass @overload -def repeat(object: T, times: int) -> Iterator[T]: pass +def repeat(object: _T, times: int) -> Iterator[_T]: pass -def accumulate(iterable: Iterable[T]) -> Iterator[T]: pass -def chain(*iterables: Iterable[T]) -> Iterator[T]: pass +def accumulate(iterable: Iterable[_T]) -> Iterator[_T]: pass +def chain(*iterables: Iterable[_T]) -> Iterator[_T]: pass # TODO chain.from_Iterable -def compress(data: Iterable[T], selectors: Iterable[Any]) -> Iterator[T]: pass -def dropwhile(predicate: Function[[T], Any], - iterable: Iterable[T]) -> Iterator[T]: pass -def filterfalse(predicate: Function[[T], Any], - iterable: Iterable[T]) -> Iterator[T]: pass +def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: pass +def dropwhile(predicate: Function[[_T], Any], + iterable: Iterable[_T]) -> Iterator[_T]: pass +def filterfalse(predicate: Function[[_T], Any], + iterable: Iterable[_T]) -> Iterator[_T]: pass @overload -def groupby(iterable: Iterable[T]) -> Iterator[Tuple[T, Iterator[T]]]: pass +def groupby(iterable: Iterable[_T]) -> Iterator[Tuple[_T, Iterator[_T]]]: pass @overload -def groupby(iterable: Iterable[T], - key: Function[[T], S]) -> Iterator[Tuple[S, Iterator[T]]]: pass +def groupby(iterable: Iterable[_T], + key: Function[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: pass @overload -def islice(iterable: Iterable[T], stop: int) -> Iterator[T]: pass +def islice(iterable: Iterable[_T], stop: int) -> Iterator[_T]: pass @overload -def islice(iterable: Iterable[T], start: int, stop: int, - step: int = 1) -> Iterator[T]: pass +def islice(iterable: Iterable[_T], start: int, stop: int, + step: int = 1) -> Iterator[_T]: pass def starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: pass -def takewhile(predicate: Function[[T], Any], - iterable: Iterable[T]) -> Iterator[T]: pass +def takewhile(predicate: Function[[_T], Any], + iterable: Iterable[_T]) -> Iterator[_T]: pass def tee(iterable: Iterable[Any], n: int = 2) -> Iterator[Any]: pass def zip_longest(*p: Iterable[Any], fillvalue: Any = None) -> Iterator[Any]: pass # TODO: Return type should be Iterator[Tuple[..]], but unknown tuple shape. -# Iterator[Sequence[T]] loses this type information. -def product(*p: Iterable[T], repeat: int = 1) -> Iterator[Sequence[T]]: pass - -def permutations(iterable: Iterable[T], - r: Union[int, None] = None) -> Iterator[Sequence[T]]: pass -def combinations(iterable: Iterable[T], - r: int) -> Iterable[Sequence[T]]: pass -def combinations_with_replacement(iterable: Iterable[T], - r: int) -> Iterable[Sequence[T]]: pass +# Iterator[Sequence[_T]] loses this type information. +def product(*p: Iterable[_T], repeat: int = 1) -> Iterator[Sequence[_T]]: pass + +def permutations(iterable: Iterable[_T], + r: Union[int, None] = None) -> Iterator[Sequence[_T]]: pass +def combinations(iterable: Iterable[_T], + r: int) -> Iterable[Sequence[_T]]: pass +def combinations_with_replacement(iterable: Iterable[_T], + r: int) -> Iterable[Sequence[_T]]: pass diff --git a/stubs/3.2/random.py b/stubs/3.2/random.py index 19d089069d58..2c534c251e7e 100644 --- a/stubs/3.2/random.py +++ b/stubs/3.2/random.py @@ -11,7 +11,7 @@ Any, typevar, Sequence, List, Function, AbstractSet, Union ) -t = typevar('t') +_T = typevar('_T') class Random(_random.Random): def __init__(self, x: Any = None) -> None: pass @@ -21,9 +21,9 @@ def setstate(self, state: tuple) -> None: pass def getrandbits(self, k: int) -> int: pass def randrange(self, start: int, stop: Union[int, None] = None, step: int = 1) -> int: pass def randint(self, a: int, b: int) -> int: pass - def choice(self, seq: Sequence[t]) -> t: pass + def choice(self, seq: Sequence[_T]) -> _T: pass def shuffle(self, x: List[Any], random: Union[Function[[], float], None] = None) -> None: pass - def sample(self, population: Union[Sequence[t], AbstractSet[t]], k: int) -> List[t]: pass + def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: pass def random(self) -> float: pass def uniform(self, a: float, b: float) -> float: pass def triangular(self, low: float = 0.0, high: float = 1.0, @@ -52,9 +52,9 @@ def setstate(state: object) -> None: pass def getrandbits(k: int) -> int: pass def randrange(start: int, stop: Union[None, int] = None, step: int = 1) -> int: pass def randint(a: int, b: int) -> int: pass -def choice(seq: Sequence[t]) -> t: pass +def choice(seq: Sequence[_T]) -> _T: pass def shuffle(x: List[Any], random: Union[Function[[], float], None] = None) -> None: pass -def sample(population: Union[Sequence[t], AbstractSet[t]], k: int) -> List[t]: pass +def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: pass def random() -> float: pass def uniform(a: float, b: float) -> float: pass def triangular(low: float = 0.0, high: float = 1.0, diff --git a/stubs/3.2/typing.py b/stubs/3.2/typing.py index ee5c7a8a3892..84d4dc8d5257 100644 --- a/stubs/3.2/typing.py +++ b/stubs/3.2/typing.py @@ -39,9 +39,9 @@ def __getitem__(self, typeargs): # Abstract base classes. -T = typevar('T') -KT = typevar('KT') -VT = typevar('VT') +_T = typevar('_T') +_KT = typevar('_KT') +_VT = typevar('_VT') # TODO Container etc. @@ -53,43 +53,43 @@ class SupportsFloat(metaclass=ABCMeta): @abstractmethod def __float__(self) -> float: pass -class SupportsAbs(AbstractGeneric[T]): +class SupportsAbs(AbstractGeneric[_T]): @abstractmethod - def __abs__(self) -> T: pass + def __abs__(self) -> _T: pass @disjointclass(int) @disjointclass(float) -class SupportsRound(AbstractGeneric[T]): +class SupportsRound(AbstractGeneric[_T]): @abstractmethod - def __round__(self, ndigits: int = 0) -> T: pass + def __round__(self, ndigits: int = 0) -> _T: pass -class Reversible(AbstractGeneric[T]): +class Reversible(AbstractGeneric[_T]): @abstractmethod - def __reversed__(self) -> Iterator[T]: pass + def __reversed__(self) -> Iterator[_T]: pass class Sized(metaclass=ABCMeta): @abstractmethod def __len__(self) -> int: pass -class Iterable(AbstractGeneric[T]): +class Iterable(AbstractGeneric[_T]): @abstractmethod - def __iter__(self) -> Iterator[T]: pass + def __iter__(self) -> Iterator[_T]: pass -class Iterator(Iterable[T], AbstractGeneric[T]): +class Iterator(Iterable[_T], AbstractGeneric[_T]): @abstractmethod - def __next__(self) -> T: pass + def __next__(self) -> _T: pass -class Sequence(Iterable[T], Sized, AbstractGeneric[T]): +class Sequence(Iterable[_T], Sized, AbstractGeneric[_T]): @abstractmethod def __contains__(self, x: object) -> bool: pass @overload @abstractmethod - def __getitem__(self, i: int) -> T: pass + def __getitem__(self, i: int) -> _T: pass @overload @abstractmethod - def __getitem__(self, s: slice) -> Sequence[T]: pass + def __getitem__(self, s: slice) -> Sequence[_T]: pass -class AbstractSet(Iterable[T], Sized, AbstractGeneric[T]): +class AbstractSet(Iterable[_T], Sized, AbstractGeneric[_T]): @abstractmethod def __contains__(self, x: object) -> bool: pass @abstractmethod @@ -101,69 +101,69 @@ def __gt__(self, s: AbstractSet[Any]) -> bool: pass @abstractmethod def __ge__(self, s: AbstractSet[Any]) -> bool: pass @abstractmethod - def __and__(self, s: AbstractSet[Any]) -> AbstractSet[T]: pass - # In order to support covariance, T should not be used within an argument + def __and__(self, s: AbstractSet[Any]) -> AbstractSet[_T]: pass + # In order to support covariance,_T should not be used within an argument # type. We need union types to properly model this. @abstractmethod - def __or__(self, s: AbstractSet[T]) -> AbstractSet[T]: pass + def __or__(self, s: AbstractSet[_T]) -> AbstractSet[_T]: pass @abstractmethod - def __sub__(self, s: AbstractSet[Any]) -> AbstractSet[T]: pass + def __sub__(self, s: AbstractSet[Any]) -> AbstractSet[_T]: pass @abstractmethod - def __xor__(self, s: AbstractSet[T]) -> AbstractSet[T]: pass + def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[_T]: pass # TODO argument can be any container? @abstractmethod def isdisjoint(self, s: AbstractSet[Any]) -> bool: pass -class Mapping(Iterable[KT], Sized, AbstractGeneric[KT, VT]): +class Mapping(Iterable[_KT], Sized, AbstractGeneric[_KT, _VT]): @abstractmethod - def __getitem__(self, k: KT) -> VT: pass + def __getitem__(self, k: _KT) -> _VT: pass @abstractmethod - def __setitem__(self, k: KT, v: VT) -> None: pass + def __setitem__(self, k: _KT, v: _VT) -> None: pass @abstractmethod - def __delitem__(self, v: KT) -> None: pass + def __delitem__(self, v: _KT) -> None: pass @abstractmethod def __contains__(self, o: object) -> bool: pass @abstractmethod def clear(self) -> None: pass @abstractmethod - def copy(self) -> Mapping[KT, VT]: pass + def copy(self) -> Mapping[_KT, _VT]: pass @overload @abstractmethod - def get(self, k: KT) -> VT: pass + def get(self, k: _KT) -> _VT: pass @overload @abstractmethod - def get(self, k: KT, default: VT) -> VT: pass + def get(self, k: _KT, default: _VT) -> _VT: pass @overload @abstractmethod - def pop(self, k: KT) -> VT: pass + def pop(self, k: _KT) -> _VT: pass @overload @abstractmethod - def pop(self, k: KT, default: VT) -> VT: pass + def pop(self, k: _KT, default: _VT) -> _VT: pass @abstractmethod - def popitem(self) -> Tuple[KT, VT]: pass + def popitem(self) -> Tuple[_KT, _VT]: pass @overload @abstractmethod - def setdefault(self, k: KT) -> VT: pass + def setdefault(self, k: _KT) -> _VT: pass @overload @abstractmethod - def setdefault(self, k: KT, default: VT) -> VT: pass + def setdefault(self, k: _KT, default: _VT) -> _VT: pass # TODO keyword arguments @overload @abstractmethod - def update(self, m: Mapping[KT, VT]) -> None: pass + def update(self, m: Mapping[_KT, _VT]) -> None: pass @overload @abstractmethod - def update(self, m: Iterable[Tuple[KT, VT]]) -> None: pass + def update(self, m: Iterable[Tuple[_KT, _VT]]) -> None: pass # TODO use views for the return values instead @abstractmethod - def keys(self) -> AbstractSet[KT]: pass + def keys(self) -> AbstractSet[_KT]: pass @abstractmethod - def values(self) -> AbstractSet[VT]: pass + def values(self) -> AbstractSet[_VT]: pass @abstractmethod - def items(self) -> AbstractSet[Tuple[KT, VT]]: pass + def items(self) -> AbstractSet[Tuple[_KT, _VT]]: pass class IO(Iterable[AnyStr], AbstractGeneric[AnyStr]): # TODO detach diff --git a/stubs/3.2/unittest.py b/stubs/3.2/unittest.py index 5a28fdd9e4b8..809ba35c06f1 100644 --- a/stubs/3.2/unittest.py +++ b/stubs/3.2/unittest.py @@ -13,8 +13,8 @@ ) from abc import abstractmethod, ABCMeta -T = typevar('T') -FT = typevar('FT') +_T = typevar('_T') +_FT = typevar('_FT') class Testable(metaclass=ABCMeta): @abstractmethod @@ -111,9 +111,9 @@ def assertIsNot(self, first: object, second: object, msg: object = None) -> None: pass def assertIsNone(self, expr: Any, msg: object = None) -> None: pass def assertIsNotNone(self, expr: Any, msg: object = None) -> None: pass - def assertIn(self, first: T, second: Iterable[T], + def assertIn(self, first: _T, second: Iterable[_T], msg: object = None) -> None: pass - def assertNotIn(self, first: T, second: Iterable[T], + def assertNotIn(self, first: _T, second: Iterable[_T], msg: object = None) -> None: pass def assertIsInstance(self, obj: Any, cls: type, msg: object = None) -> None: pass @@ -159,7 +159,7 @@ class SkipTest(Exception): # TODO precise types def skipUnless(condition: Any, reason: str) -> Any: pass def skipIf(condition: Any, reason: str) -> Any: pass -def expectedFailure(func: FT) -> FT: pass +def expectedFailure(func: _FT) -> _FT: pass def skip(reason: str) -> Any: pass def main(module: str = '__main__', defaultTest: str = None, diff --git a/stubs/3.2/weakref.py b/stubs/3.2/weakref.py index da6e3c440a53..67f681e8096a 100644 --- a/stubs/3.2/weakref.py +++ b/stubs/3.2/weakref.py @@ -7,64 +7,64 @@ Iterable ) -T = typevar('T') -KT = typevar('KT') -VT = typevar('VT') +_T = typevar('_T') +_KT = typevar('_KT') +_VT = typevar('_VT') -class ReferenceType(Generic[T]): +class ReferenceType(Generic[_T]): # TODO members pass -def ref(o: T, callback: Function[[ReferenceType[T]], - Any] = None) -> ReferenceType[T]: pass +def ref(o: _T, callback: Function[[ReferenceType[_T]], + Any] = None) -> ReferenceType[_T]: pass # TODO callback -def proxy(object: T) -> T: pass +def proxy(object: _T) -> _T: pass -class WeakValueDictionary(Generic[KT, VT]): +class WeakValueDictionary(Generic[_KT, _VT]): # TODO tuple iterable argument? @overload def __init__(self) -> None: pass @overload - def __init__(self, map: Mapping[KT, VT]) -> None: pass + def __init__(self, map: Mapping[_KT, _VT]) -> None: pass def __len__(self) -> int: pass - def __getitem__(self, k: KT) -> VT: pass - def __setitem__(self, k: KT, v: VT) -> None: pass - def __delitem__(self, v: KT) -> None: pass + def __getitem__(self, k: _KT) -> _VT: pass + def __setitem__(self, k: _KT, v: _VT) -> None: pass + def __delitem__(self, v: _KT) -> None: pass def __contains__(self, o: object) -> bool: pass - def __iter__(self) -> Iterator[KT]: pass + def __iter__(self) -> Iterator[_KT]: pass def __str__(self) -> str: pass def clear(self) -> None: pass - def copy(self) -> Dict[KT, VT]: pass + def copy(self) -> Dict[_KT, _VT]: pass @overload - def get(self, k: KT) -> VT: pass + def get(self, k: _KT) -> _VT: pass @overload - def get(self, k: KT, default: VT) -> VT: pass + def get(self, k: _KT, default: _VT) -> _VT: pass @overload - def pop(self, k: KT) -> VT: pass + def pop(self, k: _KT) -> _VT: pass @overload - def pop(self, k: KT, default: VT) -> VT: pass + def pop(self, k: _KT, default: _VT) -> _VT: pass - def popitem(self) -> Tuple[KT, VT]: pass + def popitem(self) -> Tuple[_KT, _VT]: pass @overload - def setdefault(self, k: KT) -> VT: pass + def setdefault(self, k: _KT) -> _VT: pass @overload - def setdefault(self, k: KT, default: VT) -> VT: pass + def setdefault(self, k: _KT, default: _VT) -> _VT: pass @overload - def update(self, m: Mapping[KT, VT]) -> None: pass + def update(self, m: Mapping[_KT, _VT]) -> None: pass @overload - def update(self, m: Iterable[Tuple[KT, VT]]) -> None: pass + def update(self, m: Iterable[Tuple[_KT, _VT]]) -> None: pass # NOTE: incompatible with Mapping - def keys(self) -> Iterator[KT]: pass - def values(self) -> Iterator[VT]: pass - def items(self) -> Iterator[Tuple[KT, VT]]: pass + def keys(self) -> Iterator[_KT]: pass + def values(self) -> Iterator[_VT]: pass + def items(self) -> Iterator[Tuple[_KT, _VT]]: pass # TODO return type def valuerefs(self) -> Iterable[Any]: pass diff --git a/stubs/3.4/asyncio/events.py b/stubs/3.4/asyncio/events.py index cada2a42da62..f6007fcc94b5 100644 --- a/stubs/3.4/asyncio/events.py +++ b/stubs/3.4/asyncio/events.py @@ -14,7 +14,7 @@ __all__ = ['AbstractEventLoop', 'Handle', 'get_event_loop'] -T = typevar('T') +_T = typevar('_T') class Handle: __slots__ = [] # type: List[str] @@ -31,7 +31,7 @@ class AbstractEventLoop(metaclass=ABCMeta): @abstractmethod def run_forever(self) -> None: pass @abstractmethod - def run_until_complete(self, future: Future[T]) -> T: pass + def run_until_complete(self, future: Future[_T]) -> _T: pass @abstractmethod def stop(self) -> None: pass @abstractmethod @@ -147,4 +147,4 @@ def get_debug(self) -> bool: pass def set_debug(self, enabled: bool) -> None: pass -def get_event_loop() -> AbstractEventLoop: pass \ No newline at end of file +def get_event_loop() -> AbstractEventLoop: pass diff --git a/stubs/3.4/asyncio/futures.py b/stubs/3.4/asyncio/futures.py index 8b78b5f63a1b..d1c318d15f85 100644 --- a/stubs/3.4/asyncio/futures.py +++ b/stubs/3.4/asyncio/futures.py @@ -6,7 +6,7 @@ # ] __all__ = ['Future'] -T = typevar('T') +_T = typevar('_T') class _TracebackLogger: __slots__ = [] # type: List[str] @@ -17,7 +17,7 @@ def activate(self) -> None: pass def clear(self) -> None: pass def __del__(self) -> None: pass -class Future(Generic[T]): +class Future(Generic[_T]): _state = '' _exception = Any #Exception _blocking = False @@ -30,11 +30,11 @@ def cancel(self) -> bool: pass def _schedule_callbacks(self) -> None: pass def cancelled(self) -> bool: pass def done(self) -> bool: pass - def result(self) -> T: pass + def result(self) -> _T: pass def exception(self) -> Any: pass def add_done_callback(self, fn: Function[[],Any]) -> None: pass def remove_done_callback(self, fn: Function[[], Any]) -> int: pass - def set_result(self, result: T) -> None: pass + def set_result(self, result: _T) -> None: pass def set_exception(self, exception: Any) -> None: pass def _copy_state(self, other: Any) -> None: pass - def __iter__(self) -> Any: pass \ No newline at end of file + def __iter__(self) -> Any: pass diff --git a/stubs/3.4/asyncio/tasks.py b/stubs/3.4/asyncio/tasks.py index 6920a0229ccb..c05afcf88ada 100644 --- a/stubs/3.4/asyncio/tasks.py +++ b/stubs/3.4/asyncio/tasks.py @@ -9,6 +9,6 @@ __all__ = ['coroutine', 'sleep'] -T = typevar('T') +_T = typevar('_T') def coroutine(f: Any) -> Any: pass -def sleep(delay: float, result: T=None, loop: AbstractEventLoop=None) -> T: pass +def sleep(delay: float, result: _T=None, loop: AbstractEventLoop=None) -> _T: pass