@@ -103,9 +103,6 @@ def dataclass(
103
103
order : bool = False ,
104
104
unsafe_hash : bool = False ,
105
105
frozen : bool = False ,
106
- match_args : bool = True ,
107
- kw_only : bool = False ,
108
- slots : bool = True ,
109
106
base_schema : Optional [Type [marshmallow .Schema ]] = None ,
110
107
cls_frame : Optional [types .FrameType ] = None ,
111
108
) -> Type [_U ]:
@@ -120,9 +117,6 @@ def dataclass(
120
117
order : bool = False ,
121
118
unsafe_hash : bool = False ,
122
119
frozen : bool = False ,
123
- match_args : bool = True ,
124
- kw_only : bool = False ,
125
- slots : bool = True ,
126
120
base_schema : Optional [Type [marshmallow .Schema ]] = None ,
127
121
cls_frame : Optional [types .FrameType ] = None ,
128
122
) -> Callable [[Type [_U ]], Type [_U ]]:
@@ -141,9 +135,6 @@ def dataclass(
141
135
order : bool = False ,
142
136
unsafe_hash : bool = False ,
143
137
frozen : bool = False ,
144
- match_args : bool = True ,
145
- kw_only : bool = False ,
146
- slots : bool = False ,
147
138
base_schema : Optional [Type [marshmallow .Schema ]] = None ,
148
139
cls_frame : Optional [types .FrameType ] = None ,
149
140
) -> Union [Type [_U ], Callable [[Type [_U ]], Type [_U ]]]:
@@ -172,46 +163,10 @@ def dataclass(
172
163
>>> Point.Schema().load({'x':0, 'y':0}) # This line can be statically type checked
173
164
Point(x=0.0, y=0.0)
174
165
"""
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
+ )
215
170
if not cls_frame :
216
171
current_frame = inspect .currentframe ()
217
172
if current_frame :
0 commit comments