Skip to content

Commit c8a978f

Browse files
typing: Add dataclass_transform (#7690)
python/cpython#91861
1 parent ac2b24c commit c8a978f

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

stdlib/typing.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ if sys.version_info >= (3, 11):
8888
"assert_type",
8989
"cast",
9090
"clear_overloads",
91+
"dataclass_transform",
9192
"final",
9293
"get_args",
9394
"get_origin",
@@ -1224,6 +1225,14 @@ if sys.version_info >= (3, 11):
12241225
def assert_type(__val: _T, __typ: Any) -> _T: ...
12251226
def clear_overloads() -> None: ...
12261227
def get_overloads(func: Callable[..., object]) -> Sequence[Callable[..., object]]: ...
1228+
def dataclass_transform(
1229+
*,
1230+
eq_default: bool = ...,
1231+
order_default: bool = ...,
1232+
kw_only_default: bool = ...,
1233+
field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = ...,
1234+
**kwargs: Any,
1235+
) -> Callable[[_T], _T]: ...
12271236

12281237
# Type constructors
12291238

stdlib/typing_extensions.pyi

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ if sys.version_info >= (3, 11):
201201
assert_never as assert_never,
202202
assert_type as assert_type,
203203
clear_overloads as clear_overloads,
204+
dataclass_transform as dataclass_transform,
204205
get_overloads as get_overloads,
205206
reveal_type as reveal_type,
206207
)
@@ -224,12 +225,11 @@ else:
224225
def __init__(self, name: str) -> None: ...
225226
def __iter__(self) -> Any: ... # Unpack[Self]
226227

227-
# Experimental (hopefully these will be in 3.11)
228-
def dataclass_transform(
229-
*,
230-
eq_default: bool = ...,
231-
order_default: bool = ...,
232-
kw_only_default: bool = ...,
233-
field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = ...,
234-
**kwargs: object,
235-
) -> Callable[[_T], _T]: ...
228+
def dataclass_transform(
229+
*,
230+
eq_default: bool = ...,
231+
order_default: bool = ...,
232+
kw_only_default: bool = ...,
233+
field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = ...,
234+
**kwargs: object,
235+
) -> Callable[[_T], _T]: ...

0 commit comments

Comments
 (0)