Suffix T to type variable names (#4898)

* _MessageType to _MessageT

* _default to _T

* _TConnection to _ConnectionT, _TListener to _ListenerT

* _Number to _NumberT

* _MessageVar to _MessageT

* _Type to _TypeT

* _ArgType to _T

* _Ch to _CharT

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2021-01-04 00:03:32 -08:00
committed by GitHub
parent bc1fe548b9
commit 484c014665
9 changed files with 62 additions and 62 deletions

View File

@@ -1,16 +1,16 @@
from typing import Any, Callable, Hashable, List, Optional, SupportsInt, Tuple, TypeVar, Union
_Type = TypeVar("_Type", bound=type)
_Reduce = Union[Tuple[Callable[..., _Type], Tuple[Any, ...]], Tuple[Callable[..., _Type], Tuple[Any, ...], Optional[Any]]]
_TypeT = TypeVar("_TypeT", bound=type)
_Reduce = Union[Tuple[Callable[..., _TypeT], Tuple[Any, ...]], Tuple[Callable[..., _TypeT], Tuple[Any, ...], Optional[Any]]]
__all__: List[str]
def pickle(
ob_type: _Type,
pickle_function: Callable[[_Type], Union[str, _Reduce[_Type]]],
constructor_ob: Optional[Callable[[_Reduce[_Type]], _Type]] = ...,
ob_type: _TypeT,
pickle_function: Callable[[_TypeT], Union[str, _Reduce[_TypeT]]],
constructor_ob: Optional[Callable[[_Reduce[_TypeT]], _TypeT]] = ...,
) -> None: ...
def constructor(object: Callable[[_Reduce[_Type]], _Type]) -> None: ...
def constructor(object: Callable[[_Reduce[_TypeT]], _TypeT]) -> None: ...
def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ...
def remove_extension(module: Hashable, name: Hashable, code: int) -> None: ...
def clear_extension_cache() -> None: ...

View File

@@ -4,8 +4,8 @@ from typing import Any, List, Optional, Tuple, Type, TypeVar, Union
families: List[None]
_TConnection = TypeVar("_TConnection", bound=Connection)
_TListener = TypeVar("_TListener", bound=Listener)
_ConnectionT = TypeVar("_ConnectionT", bound=Connection)
_ListenerT = TypeVar("_ListenerT", bound=Listener)
_Address = Union[str, Tuple[str, int]]
class Connection(object):
@@ -15,7 +15,7 @@ class Connection(object):
recv_bytes: Any
send: Any
send_bytes: Any
def __enter__(self: _TConnection) -> _TConnection: ...
def __enter__(self: _ConnectionT) -> _ConnectionT: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...
@@ -27,7 +27,7 @@ class Listener(object):
_backlog_queue: Optional[Queue[Any]]
@property
def address(self) -> Optional[Queue[Any]]: ...
def __enter__(self: _TListener) -> _TListener: ...
def __enter__(self: _ListenerT) -> _ListenerT: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...

View File

@@ -6,7 +6,7 @@ from typing import Any, Hashable, Iterable, List, Optional, SupportsFloat, Type,
_T = TypeVar("_T")
# Most functions in this module accept homogeneous collections of one of these types
_Number = TypeVar("_Number", float, Decimal, Fraction)
_NumberT = TypeVar("_NumberT", float, Decimal, Fraction)
# Used in mode, multimode
_HashableT = TypeVar("_HashableT", bound=Hashable)
@@ -17,25 +17,25 @@ if sys.version_info >= (3, 8):
def fmean(data: Iterable[SupportsFloat]) -> float: ...
def geometric_mean(data: Iterable[SupportsFloat]) -> float: ...
def mean(data: Iterable[_Number]) -> _Number: ...
def harmonic_mean(data: Iterable[_Number]) -> _Number: ...
def median(data: Iterable[_Number]) -> _Number: ...
def mean(data: Iterable[_NumberT]) -> _NumberT: ...
def harmonic_mean(data: Iterable[_NumberT]) -> _NumberT: ...
def median(data: Iterable[_NumberT]) -> _NumberT: ...
def median_low(data: Iterable[SupportsLessThanT]) -> SupportsLessThanT: ...
def median_high(data: Iterable[SupportsLessThanT]) -> SupportsLessThanT: ...
def median_grouped(data: Iterable[_Number], interval: _Number = ...) -> _Number: ...
def median_grouped(data: Iterable[_NumberT], interval: _NumberT = ...) -> _NumberT: ...
def mode(data: Iterable[_HashableT]) -> _HashableT: ...
if sys.version_info >= (3, 8):
def multimode(data: Iterable[_HashableT]) -> List[_HashableT]: ...
def pstdev(data: Iterable[_Number], mu: Optional[_Number] = ...) -> _Number: ...
def pvariance(data: Iterable[_Number], mu: Optional[_Number] = ...) -> _Number: ...
def pstdev(data: Iterable[_NumberT], mu: Optional[_NumberT] = ...) -> _NumberT: ...
def pvariance(data: Iterable[_NumberT], mu: Optional[_NumberT] = ...) -> _NumberT: ...
if sys.version_info >= (3, 8):
def quantiles(data: Iterable[_Number], *, n: int = ..., method: str = ...) -> List[_Number]: ...
def quantiles(data: Iterable[_NumberT], *, n: int = ..., method: str = ...) -> List[_NumberT]: ...
def stdev(data: Iterable[_Number], xbar: Optional[_Number] = ...) -> _Number: ...
def variance(data: Iterable[_Number], xbar: Optional[_Number] = ...) -> _Number: ...
def stdev(data: Iterable[_NumberT], xbar: Optional[_NumberT] = ...) -> _NumberT: ...
def variance(data: Iterable[_NumberT], xbar: Optional[_NumberT] = ...) -> _NumberT: ...
if sys.version_info >= (3, 8):
class NormalDist: