From d9afb5ee8f10d5f5d666792ceffa61f910c59805 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sun, 18 Dec 2016 15:15:20 +0100 Subject: [PATCH 1/2] Define __slots__ for object as Iterable[str] / Iterable[Union[str, unicode]] --- stdlib/2/__builtin__.pyi | 1 + stdlib/3.4/asyncio/events.pyi | 1 - stdlib/3.4/asyncio/futures.pyi | 1 - stdlib/3/builtins.pyi | 1 + 4 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index aaa2aedbc9f1..894ebcafad85 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -29,6 +29,7 @@ class classmethod: pass # Special, only valid as a decorator. class object: __doc__ = ... # type: Optional[str] __class__ = ... # type: type + __slots__ = ... # type: Optional[Iterable[Union[str, unicode]]] def __init__(self) -> None: ... def __new__(cls) -> Any: ... diff --git a/stdlib/3.4/asyncio/events.pyi b/stdlib/3.4/asyncio/events.pyi index a7d9c4d28502..15328e5324f2 100644 --- a/stdlib/3.4/asyncio/events.pyi +++ b/stdlib/3.4/asyncio/events.pyi @@ -13,7 +13,6 @@ AF_UNSPEC = 0 # from socket AI_PASSIVE = 0 class Handle: - __slots__ = ... # type: List[str] _cancelled = False _args = ... # type: List[Any] def __init__(self, callback: Callable[..., Any], args: List[Any], diff --git a/stdlib/3.4/asyncio/futures.pyi b/stdlib/3.4/asyncio/futures.pyi index 22d97bdafc85..1ce31976431d 100644 --- a/stdlib/3.4/asyncio/futures.pyi +++ b/stdlib/3.4/asyncio/futures.pyi @@ -15,7 +15,6 @@ from concurrent.futures import ( class InvalidStateError(Error): ... class _TracebackLogger: - __slots__ = ... # type: List[str] exc = ... # type: BaseException tb = ... # type: List[str] def __init__(self, exc: Any, loop: AbstractEventLoop) -> None: ... diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index 27d64632da72..6a7ce23f5cb8 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -32,6 +32,7 @@ class object: __doc__ = ... # type: Optional[str] __class__ = ... # type: type __dict__ = ... # type: Dict[str, Any] + __slots__ = ... # type: Optional[Iterable[str]] def __init__(self) -> None: ... def __new__(cls) -> Any: ... From bce33edddb110fc011c927a96620e4ef9b1fd63e Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Mon, 19 Dec 2016 21:16:26 +0100 Subject: [PATCH 2/2] A string as __slots__ value is also valid and represents a single item --- stdlib/2/__builtin__.pyi | 2 +- stdlib/3/builtins.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 894ebcafad85..d778c05196c1 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -29,7 +29,7 @@ class classmethod: pass # Special, only valid as a decorator. class object: __doc__ = ... # type: Optional[str] __class__ = ... # type: type - __slots__ = ... # type: Optional[Iterable[Union[str, unicode]]] + __slots__ = ... # type: Optional[Union[str, unicode, Iterable[Union[str, unicode]]]] def __init__(self) -> None: ... def __new__(cls) -> Any: ... diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index 6a7ce23f5cb8..ca83395a8c87 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -32,7 +32,7 @@ class object: __doc__ = ... # type: Optional[str] __class__ = ... # type: type __dict__ = ... # type: Dict[str, Any] - __slots__ = ... # type: Optional[Iterable[str]] + __slots__ = ... # type: Optional[Union[str, Iterable[str]]] def __init__(self) -> None: ... def __new__(cls) -> Any: ...