@@ -320,7 +320,7 @@ Module contents
320
320
:func: `!field `, then the class attribute for this field will be
321
321
replaced by the specified *default * value. If *default * is not
322
322
provided, then the class attribute will be deleted. The intent is
323
- that after the :func: ` @ dataclass <dataclass> ` decorator runs, the class
323
+ that after the :deco: ` dataclass ` decorator runs, the class
324
324
attributes will all contain the default values for the fields, just
325
325
as if the default value itself were specified. For example,
326
326
after::
@@ -430,15 +430,15 @@ Module contents
430
430
:data: `typing.Any ` is used for ``type ``. The values of *init *,
431
431
*repr *, *eq *, *order *, *unsafe_hash *, *frozen *,
432
432
*match_args *, *kw_only *, *slots *, and *weakref_slot * have
433
- the same meaning as they do in :func: ` @ dataclass <dataclass> `.
433
+ the same meaning as they do in :deco: ` dataclass `.
434
434
435
435
If *module * is defined, the :attr: `!__module__ ` attribute
436
436
of the dataclass is set to that value.
437
437
By default, it is set to the module name of the caller.
438
438
439
439
This function is not strictly required, because any Python
440
440
mechanism for creating a new class with :attr: `!__annotations__ ` can
441
- then apply the :func: ` @ dataclass <dataclass> ` function to convert that class to
441
+ then apply the :deco: ` dataclass ` function to convert that class to
442
442
a dataclass. This function is provided as a convenience. For
443
443
example::
444
444
@@ -564,7 +564,7 @@ Post-init processing
564
564
def __post_init__(self):
565
565
self.c = self.a + self.b
566
566
567
- The :meth: `~object.__init__ ` method generated by :func: ` @ dataclass <dataclass> ` does not call base
567
+ The :meth: `~object.__init__ ` method generated by :deco: ` dataclass ` does not call base
568
568
class :meth: `!__init__ ` methods. If the base class has an :meth: `!__init__ ` method
569
569
that has to be called, it is common to call this method in a
570
570
:meth: `__post_init__ ` method::
@@ -594,7 +594,7 @@ parameters to :meth:`!__post_init__`. Also see the warning about how
594
594
Class variables
595
595
---------------
596
596
597
- One of the few places where :func: ` @ dataclass <dataclass> ` actually inspects the type
597
+ One of the few places where :deco: ` dataclass ` actually inspects the type
598
598
of a field is to determine if a field is a class variable as defined
599
599
in :pep: `526 `. It does this by checking if the type of the field is
600
600
:data: `typing.ClassVar `. If a field is a ``ClassVar ``, it is excluded
@@ -607,7 +607,7 @@ module-level :func:`fields` function.
607
607
Init-only variables
608
608
-------------------
609
609
610
- Another place where :func: ` @ dataclass <dataclass> ` inspects a type annotation is to
610
+ Another place where :deco: ` dataclass ` inspects a type annotation is to
611
611
determine if a field is an init-only variable. It does this by seeing
612
612
if the type of a field is of type :class: `InitVar `. If a field
613
613
is an :class: `InitVar `, it is considered a pseudo-field called an init-only
@@ -641,7 +641,7 @@ Frozen instances
641
641
----------------
642
642
643
643
It is not possible to create truly immutable Python objects. However,
644
- by passing ``frozen=True `` to the :func: ` @ dataclass <dataclass> ` decorator you can
644
+ by passing ``frozen=True `` to the :deco: ` dataclass ` decorator you can
645
645
emulate immutability. In that case, dataclasses will add
646
646
:meth: `~object.__setattr__ ` and :meth: `~object.__delattr__ ` methods to the class. These
647
647
methods will raise a :exc: `FrozenInstanceError ` when invoked.
@@ -657,7 +657,7 @@ must use :meth:`!object.__setattr__`.
657
657
Inheritance
658
658
-----------
659
659
660
- When the dataclass is being created by the :func: ` @ dataclass <dataclass> ` decorator,
660
+ When the dataclass is being created by the :deco: ` dataclass ` decorator,
661
661
it looks through all of the class's base classes in reverse MRO (that
662
662
is, starting at :class: `object `) and, for each dataclass that it finds,
663
663
adds the fields from that base class to an ordered mapping of fields.
@@ -781,7 +781,7 @@ for :attr:`!x` when creating a class instance will share the same copy
781
781
of :attr: `!x `. Because dataclasses just use normal Python class
782
782
creation they also share this behavior. There is no general way
783
783
for Data Classes to detect this condition. Instead, the
784
- :func: ` @ dataclass <dataclass> ` decorator will raise a :exc: `ValueError ` if it
784
+ :deco: ` dataclass ` decorator will raise a :exc: `ValueError ` if it
785
785
detects an unhashable default parameter. The assumption is that if
786
786
a value is unhashable, it is mutable. This is a partial solution,
787
787
but it does protect against many common errors.
@@ -815,7 +815,7 @@ default value have the following special behaviors:
815
815
:meth: `~object.__get__ ` or :meth: `!__set__ ` method is called rather than returning or
816
816
overwriting the descriptor object.
817
817
818
- * To determine whether a field contains a default value, :func: ` @ dataclass <dataclass> `
818
+ * To determine whether a field contains a default value, :deco: ` dataclass `
819
819
will call the descriptor's :meth: `!__get__ ` method using its class access
820
820
form: ``descriptor.__get__(obj=None, type=cls) ``. If the
821
821
descriptor returns a value in this case, it will be used as the
0 commit comments