mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Add undocumented trait decorator to mypy_extensions (#2369)
`@trait` has special meaning to the experimental mypyc compiler, slightly restricting the behavior of the class in exchange for allowing it to be multiply inherited from.
This commit is contained in:
committed by
Jelle Zijlstra
parent
631d2768d6
commit
e4656b1ac6
6
third_party/2and3/mypy_extensions.pyi
vendored
6
third_party/2and3/mypy_extensions.pyi
vendored
@@ -1,4 +1,4 @@
|
||||
from typing import Dict, Type, TypeVar, Optional, Union
|
||||
from typing import Dict, Type, TypeVar, Optional, Union, Any
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
@@ -15,3 +15,7 @@ def KwArg(type: _T = ...) -> _T: ...
|
||||
# This type is equivalent to the None type, but the no-op Union is necessary to
|
||||
# distinguish the None type from the None value.
|
||||
NoReturn = Union[None] # Deprecated: Use typing.NoReturn instead.
|
||||
|
||||
# This is intended as a class decorator, but mypy rejects abstract classes
|
||||
# when a Type[_T] is expected, so we can't give it the type we want
|
||||
def trait(cls: Any) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user