From 8e5b9cb0c8e54885141595f01bfb4835285e030b Mon Sep 17 00:00:00 2001 From: David Foster Date: Sat, 5 Mar 2022 06:24:08 -0800 Subject: [PATCH 1/5] Remove double blank line from Python code snippets. In python.org's PEP rendering, with tall per-line spacing, this wastes a lot of space. --- pep-0681.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pep-0681.rst b/pep-0681.rst index 0e0f6513fb2..872482c4359 100644 --- a/pep-0681.rst +++ b/pep-0681.rst @@ -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: @@ -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): @@ -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): @@ -248,7 +245,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) @@ -275,7 +271,6 @@ Class example ): ... - # Example of how this class would be used by code that imports # from this library: class CustomerModel( @@ -313,7 +308,6 @@ Metaclass example class ModelBase(metaclass=ModelMeta): ... - # Example of how this class would be used by code that imports # from this library: class CustomerModel( @@ -424,7 +418,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: From 2e8212bb57d4c76c97eac6513e1524a2bb432a71 Mon Sep 17 00:00:00 2001 From: David Foster Date: Sat, 5 Mar 2022 06:26:29 -0800 Subject: [PATCH 2/5] Replace ```-style headers with ''' instead. Why: * ```-style headers confuse the syntax-highlighting in my text editor. * I believe '''-style headers are also recommended by the PEP rST template for this level of header, but I haven't confirmed. --- pep-0681.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pep-0681.rst b/pep-0681.rst index 872482c4359..b2e4a5ee87b 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 @@ -136,7 +136,7 @@ Decorator function example name: str Class example -````````````` +''''''''''''' .. code-block:: python @@ -152,7 +152,7 @@ Class example name: str Metaclass example -````````````````` +''''''''''''''''' .. code-block:: python @@ -230,7 +230,7 @@ The following sections provide additional examples showing how these parameters are used. Decorator function example -`````````````````````````` +'''''''''''''''''''''''''' .. code-block:: python @@ -253,7 +253,7 @@ Decorator function example name: str Class example -````````````` +''''''''''''' .. code-block:: python @@ -284,7 +284,7 @@ Class example name: str Metaclass example -````````````````` +''''''''''''''''' .. code-block:: python @@ -353,7 +353,7 @@ not required: Field descriptor parameters -``````````````````````````` +''''''''''''''''''''''''''' Libraries that support dataclass-like semantics and support field descriptor classes typically use common parameter names to construct From d0ab16a4e455ccb629d3db2f6b74dab73c98688c Mon Sep 17 00:00:00 2001 From: David Foster Date: Sat, 5 Mar 2022 06:34:08 -0800 Subject: [PATCH 3/5] Nit: Adjust PEP reference to include the word "PEP" --- pep-0681.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pep-0681.rst b/pep-0681.rst index b2e4a5ee87b..d4d0d263ca8 100644 --- a/pep-0681.rst +++ b/pep-0681.rst @@ -180,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. From 83b4d2de9bec29603691359f850603da7924d804 Mon Sep 17 00:00:00 2001 From: David Foster Date: Sat, 5 Mar 2022 07:05:08 -0800 Subject: [PATCH 4/5] Remove gremlin character <0x0c> --- pep-0681.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/pep-0681.rst b/pep-0681.rst index d4d0d263ca8..0eb82e0577f 100644 --- a/pep-0681.rst +++ b/pep-0681.rst @@ -716,8 +716,6 @@ 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 From 9d12c521e4d4ac35ecfaec7ccbce839873431f18 Mon Sep 17 00:00:00 2001 From: David Foster Date: Mon, 7 Mar 2022 21:02:45 -0800 Subject: [PATCH 5/5] Remove entire Emacs configuration block --- pep-0681.rst | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pep-0681.rst b/pep-0681.rst index 0eb82e0577f..68e01b689cd 100644 --- a/pep-0681.rst +++ b/pep-0681.rst @@ -715,12 +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: