Improve ABCMeta.register signature (#962)

* Improve ABCMeta.register signature

* Fix ABCMeta.register return type for Python 3.3+
This commit is contained in:
Dominik Miedziński
2017-03-08 01:42:06 +01:00
committed by Matthias Kramm
parent 8e59579953
commit 4f51a4f2fc
2 changed files with 9 additions and 5 deletions

View File

@@ -1,10 +1,15 @@
from typing import Any
from typing import Any, Type, TypeVar
import sys
# Stubs for abc.
_T = TypeVar('_T')
# Thesee definitions have special processing in type checker.
class ABCMeta(type):
def register(cls: "ABCMeta", subclass: Any) -> None: ...
if sys.version_info >= (3, 3):
def register(cls: "ABCMeta", subclass: Type[_T]) -> Type[_T]: ...
else:
def register(cls: "ABCMeta", subclass: Type[Any]) -> None: ...
abstractmethod = object()
abstractproperty = object()