Skip to content

Commit 6604b40

Browse files
committed
Revert "Merge pull request #1 from kmc6123/add-new-dataclass-kwargs"
This reverts commit d7af73d, reversing changes made to d6396c1.
1 parent 1032710 commit 6604b40

File tree

1 file changed

+4
-49
lines changed

1 file changed

+4
-49
lines changed

marshmallow_dataclass/__init__.py

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ def dataclass(
103103
order: bool = False,
104104
unsafe_hash: bool = False,
105105
frozen: bool = False,
106-
match_args: bool = True,
107-
kw_only: bool = False,
108-
slots: bool = True,
109106
base_schema: Optional[Type[marshmallow.Schema]] = None,
110107
cls_frame: Optional[types.FrameType] = None,
111108
) -> Type[_U]:
@@ -120,9 +117,6 @@ def dataclass(
120117
order: bool = False,
121118
unsafe_hash: bool = False,
122119
frozen: bool = False,
123-
match_args: bool = True,
124-
kw_only: bool = False,
125-
slots: bool = True,
126120
base_schema: Optional[Type[marshmallow.Schema]] = None,
127121
cls_frame: Optional[types.FrameType] = None,
128122
) -> Callable[[Type[_U]], Type[_U]]:
@@ -141,9 +135,6 @@ def dataclass(
141135
order: bool = False,
142136
unsafe_hash: bool = False,
143137
frozen: bool = False,
144-
match_args: bool = True,
145-
kw_only: bool = False,
146-
slots: bool = False,
147138
base_schema: Optional[Type[marshmallow.Schema]] = None,
148139
cls_frame: Optional[types.FrameType] = None,
149140
) -> Union[Type[_U], Callable[[Type[_U]], Type[_U]]]:
@@ -172,46 +163,10 @@ def dataclass(
172163
>>> Point.Schema().load({'x':0, 'y':0}) # This line can be statically type checked
173164
Point(x=0.0, y=0.0)
174165
"""
175-
# Check python version for dataclass params only available for python >= 3.10.
176-
# If python version is below 3.10 and any of these params are set to anything
177-
# other than their default, raise ValueError
178-
if sys.version_info >= (3, 10):
179-
# dataclass's typing doesn't expect it to be called as a function, so ignore type check
180-
dc = dataclasses.dataclass( # type: ignore
181-
_cls,
182-
repr=repr,
183-
eq=eq,
184-
order=order,
185-
unsafe_hash=unsafe_hash,
186-
frozen=frozen,
187-
match_args=match_args,
188-
kw_only=kw_only,
189-
slots=slots,
190-
)
191-
else:
192-
args = {
193-
'match_args': {
194-
'error_message': "'match_args' argument is only available for python >= 3.10",
195-
'default_value': True
196-
},
197-
'kw_only': {
198-
'error_message': "'kw_only' argument is only available for python >= 3.10",
199-
'default_value': False
200-
},
201-
'slots': {
202-
'error_message': "'slots' argument is only available for python >= 3.10",
203-
'default_value': False
204-
}
205-
}
206-
207-
for arg, arg_info in args.items():
208-
if locals()[arg] is not arg_info['default_value']:
209-
raise ValueError(arg_info['error_message'])
210-
211-
# dataclass's typing doesn't expect it to be called as a function, so ignore type check
212-
dc = dataclasses.dataclass( # type: ignore
213-
_cls, repr=repr, eq=eq, order=order, unsafe_hash=unsafe_hash, frozen=frozen
214-
)
166+
# dataclass's typing doesn't expect it to be called as a function, so ignore type check
167+
dc = dataclasses.dataclass( # type: ignore
168+
_cls, repr=repr, eq=eq, order=order, unsafe_hash=unsafe_hash, frozen=frozen
169+
)
215170
if not cls_frame:
216171
current_frame = inspect.currentframe()
217172
if current_frame:

0 commit comments

Comments
 (0)