@@ -1251,7 +1251,7 @@ def asdict(obj, *, dict_factory=dict):
1251
1251
"""Return the fields of a dataclass instance as a new dictionary mapping
1252
1252
field names to field values.
1253
1253
1254
- Example usage:
1254
+ Example usage::
1255
1255
1256
1256
@dataclass
1257
1257
class C:
@@ -1322,8 +1322,8 @@ class C:
1322
1322
x: int
1323
1323
y: int
1324
1324
1325
- c = C(1, 2)
1326
- assert astuple(c) == (1, 2)
1325
+ c = C(1, 2)
1326
+ assert astuple(c) == (1, 2)
1327
1327
1328
1328
If given, 'tuple_factory' will be used instead of built-in tuple.
1329
1329
The function applies recursively to field values that are
@@ -1372,11 +1372,11 @@ def make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True,
1372
1372
The dataclass name will be 'cls_name'. 'fields' is an iterable
1373
1373
of either (name), (name, type) or (name, type, Field) objects. If type is
1374
1374
omitted, use the string 'typing.Any'. Field objects are created by
1375
- the equivalent of calling 'field(name, type [, Field-info])'.
1375
+ the equivalent of calling 'field(name, type [, Field-info])'.::
1376
1376
1377
1377
C = make_dataclass('C', ['x', ('y', int), ('z', int, field(init=False))], bases=(Base,))
1378
1378
1379
- is equivalent to:
1379
+ is equivalent to::
1380
1380
1381
1381
@dataclass
1382
1382
class C(Base):
@@ -1440,7 +1440,7 @@ def exec_body_callback(ns):
1440
1440
def replace (obj , / , ** changes ):
1441
1441
"""Return a new object replacing specified fields with new values.
1442
1442
1443
- This is especially useful for frozen classes. Example usage:
1443
+ This is especially useful for frozen classes. Example usage::
1444
1444
1445
1445
@dataclass(frozen=True)
1446
1446
class C:
@@ -1450,7 +1450,7 @@ class C:
1450
1450
c = C(1, 2)
1451
1451
c1 = replace(c, x=3)
1452
1452
assert c1.x == 3 and c1.y == 2
1453
- """
1453
+ """
1454
1454
1455
1455
# We're going to mutate 'changes', but that's okay because it's a
1456
1456
# new dict, even if called with 'replace(obj, **my_changes)'.
0 commit comments