-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more stubs to cover all import paths (#207)
* more stubs to cover all import paths * linted
- Loading branch information
Showing
3 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from typing import Any, Callable, Tuple, TypeVar, Union, overload | ||
|
||
from attr import attrib, field | ||
|
||
_T = TypeVar("_T") | ||
_C = TypeVar("_C", bound=type) | ||
|
||
# Note: from here | ||
# https://github.com/python-attrs/attrs/blob/main/src/attr/__init__.pyi | ||
|
||
# Static type inference support via __dataclass_transform__ implemented as per: | ||
# https://github.com/microsoft/pyright/blob/main/specs/dataclass_transforms.md | ||
# This annotation must be applied to all overloads of "spock_attr" | ||
|
||
# NOTE: This is a typing construct and does not exist at runtime. Extensions | ||
# wrapping attrs decorators should declare a separate __dataclass_transform__ | ||
# signature in the extension module using the specification linked above to | ||
# provide pyright support -- this currently doesn't work in PyCharm | ||
def __dataclass_transform__( | ||
*, | ||
eq_default: bool = True, | ||
order_default: bool = False, | ||
kw_only_default: bool = False, | ||
field_descriptors: Tuple[Union[type, Callable[..., Any]], ...] = (()), | ||
) -> Callable[[_T], _T]: ... | ||
@overload | ||
@__dataclass_transform__(kw_only_default=True, field_descriptors=(attrib, field)) | ||
def spock( | ||
maybe_cls: _C, | ||
kw_only: bool = True, | ||
make_init: bool = True, | ||
dynamic: bool = False, | ||
) -> _C: ... | ||
@overload | ||
@__dataclass_transform__(kw_only_default=True, field_descriptors=(attrib, field)) | ||
def spock( | ||
maybe_cls: None = ..., | ||
kw_only: bool = True, | ||
make_init: bool = True, | ||
dynamic: bool = False, | ||
) -> Callable[[_C], _C]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from typing import Any, Callable, Tuple, TypeVar, Union, overload | ||
|
||
from attr import attrib, field | ||
|
||
_T = TypeVar("_T") | ||
_C = TypeVar("_C", bound=type) | ||
|
||
# Note: from here | ||
# https://github.com/python-attrs/attrs/blob/main/src/attr/__init__.pyi | ||
|
||
# Static type inference support via __dataclass_transform__ implemented as per: | ||
# https://github.com/microsoft/pyright/blob/main/specs/dataclass_transforms.md | ||
# This annotation must be applied to all overloads of "spock_attr" | ||
|
||
# NOTE: This is a typing construct and does not exist at runtime. Extensions | ||
# wrapping attrs decorators should declare a separate __dataclass_transform__ | ||
# signature in the extension module using the specification linked above to | ||
# provide pyright support -- this currently doesn't work in PyCharm | ||
def __dataclass_transform__( | ||
*, | ||
eq_default: bool = True, | ||
order_default: bool = False, | ||
kw_only_default: bool = False, | ||
field_descriptors: Tuple[Union[type, Callable[..., Any]], ...] = (()), | ||
) -> Callable[[_T], _T]: ... | ||
@overload | ||
@__dataclass_transform__(kw_only_default=True, field_descriptors=(attrib, field)) | ||
def spock( | ||
maybe_cls: _C, | ||
kw_only: bool = True, | ||
make_init: bool = True, | ||
dynamic: bool = False, | ||
) -> _C: ... | ||
@overload | ||
@__dataclass_transform__(kw_only_default=True, field_descriptors=(attrib, field)) | ||
def spock( | ||
maybe_cls: None = ..., | ||
kw_only: bool = True, | ||
make_init: bool = True, | ||
dynamic: bool = False, | ||
) -> Callable[[_C], _C]: ... |