PEP 681: Fix minor formatting and typographical issues (#2382)

This commit is contained in:
David Foster 2022-03-07 21:12:26 -08:00 committed by GitHub
parent f52151b9d8
commit 5ffa9a6de7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 26 deletions

View File

@ -119,7 +119,7 @@ Type checkers supporting this PEP will recognize that the
c5 = CustomerModel(327, "John Smith", 0)
Decorator function example
``````````````````````````
''''''''''''''''''''''''''
.. code-block:: python
@ -134,7 +134,6 @@ Decorator function example
cls.__ne__ = ...
return cls
# The ``create_model`` decorator can now be used to create new model
# classes, like this:
@create_model
@ -143,7 +142,7 @@ Decorator function example
name: str
Class example
`````````````
'''''''''''''
.. code-block:: python
@ -152,7 +151,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):
@ -160,7 +158,7 @@ Class example
name: str
Metaclass example
`````````````````
'''''''''''''''''
.. code-block:: python
@ -171,7 +169,6 @@ Metaclass example
class ModelBase(metaclass=ModelMeta): ...
# The ``ModelBase`` class can now be used to create new model
# subclasses, like this:
class CustomerModel(ModelBase):
@ -189,7 +186,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``, ``match_args`` and ``slots`` are parameters supported
in the stdlib dataclass, first introduced in Python 3.10.
@ -239,7 +237,7 @@ The following sections provide additional examples showing how these
parameters are used.
Decorator function example
``````````````````````````
''''''''''''''''''''''''''
.. code-block:: python
@ -254,7 +252,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)
@ -263,7 +260,7 @@ Decorator function example
name: str
Class example
`````````````
'''''''''''''
.. code-block:: python
@ -281,7 +278,6 @@ Class example
):
...
# Example of how this class would be used by code that imports
# from this library:
class CustomerModel(
@ -295,7 +291,7 @@ Class example
name: str
Metaclass example
`````````````````
'''''''''''''''''
.. code-block:: python
@ -319,7 +315,6 @@ Metaclass example
class ModelBase(metaclass=ModelMeta):
...
# Example of how this class would be used by code that imports
# from this library:
class CustomerModel(
@ -365,7 +360,7 @@ not required:
Field descriptor parameters
```````````````````````````
'''''''''''''''''''''''''''
Libraries that support dataclass-like semantics and support field
descriptor classes typically use common parameter names to construct
@ -441,7 +436,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:
@ -701,14 +695,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: