Skip to content

Commit 57226b4

Browse files
authored
Add frozen_default parameter on dataclass_transform (#101)
1 parent 0ea104b commit 57226b4

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/test_typing_extensions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3009,6 +3009,7 @@ class CustomerModel:
30093009
"eq_default": True,
30103010
"order_default": False,
30113011
"kw_only_default": True,
3012+
"frozen_default": False,
30123013
"field_specifiers": (),
30133014
"kwargs": {},
30143015
}
@@ -3039,6 +3040,7 @@ class CustomerModel(Decorated, frozen=True):
30393040
"eq_default": True,
30403041
"order_default": True,
30413042
"kw_only_default": False,
3043+
"frozen_default": False,
30423044
"field_specifiers": (),
30433045
"kwargs": {"make_everything_awesome": True},
30443046
}
@@ -3070,6 +3072,7 @@ class CustomerModel(ModelBase, init=False):
30703072
"eq_default": True,
30713073
"order_default": True,
30723074
"kw_only_default": False,
3075+
"frozen_default": False,
30733076
"field_specifiers": (Field,),
30743077
"kwargs": {},
30753078
}

src/typing_extensions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,7 @@ def dataclass_transform(
20062006
eq_default: bool = True,
20072007
order_default: bool = False,
20082008
kw_only_default: bool = False,
2009+
frozen_default: bool = False,
20092010
field_specifiers: typing.Tuple[
20102011
typing.Union[typing.Type[typing.Any], typing.Callable[..., typing.Any]],
20112012
...
@@ -2062,6 +2063,8 @@ class CustomerModel(ModelBase):
20622063
assumed to be True or False if it is omitted by the caller.
20632064
- ``kw_only_default`` indicates whether the ``kw_only`` parameter is
20642065
assumed to be True or False if it is omitted by the caller.
2066+
- ``frozen_default`` indicates whether the ``frozen`` parameter is
2067+
assumed to be True or False if it is omitted by the caller.
20652068
- ``field_specifiers`` specifies a static list of supported classes
20662069
or functions that describe fields, similar to ``dataclasses.field()``.
20672070
@@ -2076,6 +2079,7 @@ def decorator(cls_or_fn):
20762079
"eq_default": eq_default,
20772080
"order_default": order_default,
20782081
"kw_only_default": kw_only_default,
2082+
"frozen_default": frozen_default,
20792083
"field_specifiers": field_specifiers,
20802084
"kwargs": kwargs,
20812085
}

0 commit comments

Comments
 (0)