diff --git a/pep-0681.rst b/pep-0681.rst index 0e0f6513fb2..68e01b689cd 100644 --- a/pep-0681.rst +++ b/pep-0681.rst @@ -113,7 +113,7 @@ Type checkers supporting this PEP will recognize that the c5 = CustomerModel(327, "John Smith", 0) Decorator function example -`````````````````````````` +'''''''''''''''''''''''''' .. code-block:: python @@ -127,7 +127,6 @@ Decorator function example cls.__eq__ = ... cls.__ne__ = ... return cls - # The ``create_model`` decorator can now be used to create new model # classes, like this: @@ -137,7 +136,7 @@ Decorator function example name: str Class example -````````````` +''''''''''''' .. code-block:: python @@ -146,7 +145,6 @@ Class example @typing.dataclass_transform() class ModelBase: ... - # The ``ModelBase`` class can now be used to create new model # subclasses, like this: class CustomerModel(ModelBase): @@ -154,7 +152,7 @@ Class example name: str Metaclass example -````````````````` +''''''''''''''''' .. code-block:: python @@ -165,7 +163,6 @@ Metaclass example class ModelBase(metaclass=ModelMeta): ... - # The ``ModelBase`` class can now be used to create new model # subclasses, like this: class CustomerModel(ModelBase): @@ -183,7 +180,8 @@ these parameters accepts a bool argument, and it must be possible for the bool value (``True`` or ``False``) to be statically evaluated. * ``eq``. ``order``, ``frozen``, ``init`` and ``unsafe_hash`` are parameters - supported in the stdlib dataclass, with meanings defined in :pep:`557 <557#id7>`. + supported in the stdlib dataclass, with meanings defined in + :pep:`PEP 557 <557#id7>`. * ``hash`` is an alias for the ``unsafe_hash`` parameter. * ``kw_only`` and ``slots`` are parameters supported in the stdlib dataclass, first introduced in Python 3.10. @@ -233,7 +231,7 @@ The following sections provide additional examples showing how these parameters are used. Decorator function example -`````````````````````````` +'''''''''''''''''''''''''' .. code-block:: python @@ -248,7 +246,6 @@ Decorator function example kw_only: bool = True, ) -> Callable[[Type[_T]], Type[_T]]: ... - # Example of how this decorator would be used by code that imports # from this library: @create_model(frozen=True, kw_only=False) @@ -257,7 +254,7 @@ Decorator function example name: str Class example -````````````` +''''''''''''' .. code-block:: python @@ -275,7 +272,6 @@ Class example ): ... - # Example of how this class would be used by code that imports # from this library: class CustomerModel( @@ -289,7 +285,7 @@ Class example name: str Metaclass example -````````````````` +''''''''''''''''' .. code-block:: python @@ -313,7 +309,6 @@ Metaclass example class ModelBase(metaclass=ModelMeta): ... - # Example of how this class would be used by code that imports # from this library: class CustomerModel( @@ -359,7 +354,7 @@ not required: Field descriptor parameters -``````````````````````````` +''''''''''''''''''''''''''' Libraries that support dataclass-like semantics and support field descriptor classes typically use common parameter names to construct @@ -424,7 +419,6 @@ This example demonstrates the above: init: bool = True, ) -> Callable[[Type[_T]], Type[_T]]: ... - # Code that imports this library: @create_model(init=False) class CustomerModel: @@ -721,14 +715,3 @@ Copyright This document is placed in the public domain or under the CC0-1.0-Universal license, whichever is more permissive. - - - -.. - Local Variables: - mode: indented-text - indent-tabs-mode: nil - sentence-end-double-space: t - fill-column: 70 - coding: utf-8 - End: