Skip to content

Commit 0739659

Browse files
committedDec 15, 2023
more explicit definition to make ruff happy
1 parent cc2db94 commit 0739659

File tree

1 file changed

+13
-12
lines changed
  • hypothesis-python/src/hypothesis/internal

1 file changed

+13
-12
lines changed
 

Diff for: ‎hypothesis-python/src/hypothesis/internal/compat.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -192,21 +192,22 @@ def bad_django_TestCase(runner):
192192
return not isinstance(runner, HypothesisTestCase)
193193

194194

195-
def dataclass_asdict(obj, *, dict_factory=dict):
196-
"""
197-
A vendored variant of dataclasses.asdict. Includes the bugfix for
198-
defaultdicts (cpython/32056) for all versions. See also issues/3812.
195+
# see issue #3812
196+
if sys.version_info[:2] < (3, 12):
199197

200-
This should be removed whenever we drop support for 3.11. We can use the
201-
standard dataclasses.asdict after that point.
202-
"""
203-
if not dataclasses._is_dataclass_instance(obj): # pragma: no cover
204-
raise TypeError("asdict() should be called on dataclass instances")
205-
return _asdict_inner(obj, dict_factory)
198+
def dataclass_asdict(obj, *, dict_factory=dict):
199+
"""
200+
A vendored variant of dataclasses.asdict. Includes the bugfix for
201+
defaultdicts (cpython/32056) for all versions. See also issues/3812.
206202
203+
This should be removed whenever we drop support for 3.11. We can use the
204+
standard dataclasses.asdict after that point.
205+
"""
206+
if not dataclasses._is_dataclass_instance(obj): # pragma: no cover
207+
raise TypeError("asdict() should be called on dataclass instances")
208+
return _asdict_inner(obj, dict_factory)
207209

208-
if sys.version_info[:2] >= (3, 12):
209-
# see issue #3812
210+
else:
210211
dataclass_asdict = dataclasses.asdict
211212

212213

0 commit comments

Comments
 (0)