PEP 663: fix formatting
This commit is contained in:
parent
f34a97383b
commit
f83a575a91
32
pep-0663.txt
32
pep-0663.txt
|
@ -96,7 +96,7 @@ There are also two styles:
|
||||||
namespcae, and their module name shows in their ``repr()`` and ``str()``
|
namespcae, and their module name shows in their ``repr()`` and ``str()``
|
||||||
(where appropriate)
|
(where appropriate)
|
||||||
|
|
||||||
Some sample enums:
|
Some sample enums::
|
||||||
|
|
||||||
# module: tools.py
|
# module: tools.py
|
||||||
|
|
||||||
|
@ -115,53 +115,51 @@ Some sample enums:
|
||||||
WHITE = 1
|
WHITE = 1
|
||||||
|
|
||||||
Using the above enumerations, the following table shows the old and new
|
Using the above enumerations, the following table shows the old and new
|
||||||
behavior (blank cells indicate no behavioral change); the second table shows
|
behavior (blank cells indicate no behavioral change):
|
||||||
the final result:
|
|
||||||
|
|
||||||
|
+--------+------------------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
|
||||||
| style | category | enum repr() | enum str() | enum format() | flag repr() | flag str() | flag format() |
|
| style | category | enum repr() | enum str() | enum format() | flag repr() | flag str() | flag format() |
|
||||||
+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| normal | simple | 3.10 | | | | <Color.RED|GREEN: 3> | Color.RED|GREEN | Color.RED|GREEN |
|
| normal | simple | 3.10 | | | | <Color.RED|GREEN: 3> | Color.RED|GREEN | Color.RED|GREEN |
|
||||||
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | | new | | | | <Color(3): RED|GREEN> | Color.RED|Color.GREEN | Color.RED|Color.GREEN |
|
| | | new | | | | <Color(3): RED|GREEN> | Color.RED|Color.GREEN | Color.RED|Color.GREEN |
|
||||||
+ +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | user mixed | 3.10 | | | 1 | <Grey.WHITE: 1> | | 1 |
|
| | user mixed | 3.10 | | | 1 | <Grey.WHITE: 1> | | 1 |
|
||||||
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | | new | | | Grey.WHITE | <Grey(1): WHITE> | | Grey.WHITE |
|
| | | new | | | Grey.WHITE | <Grey(1): WHITE> | | Grey.WHITE |
|
||||||
+ +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | int drop-in | 3.10 | | Hue.LIGHT | | <Color.RED|GREEN: 3> | Color.RED|GREEN | |
|
| | int drop-in | 3.10 | | Hue.LIGHT | | <Color.RED|GREEN: 3> | Color.RED|GREEN | |
|
||||||
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | | new | | -1 | | <Color(3): RED|GREEN> | 3 | |
|
| | | new | | -1 | | <Color(3): RED|GREEN> | 3 | |
|
||||||
|--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| global | simple | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | Hue.LIGHT | <Color.RED|GREEN: 3> | Color.RED|GREEN | Color.RED|GREEN |
|
| global | simple | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | Hue.LIGHT | <Color.RED|GREEN: 3> | Color.RED|GREEN | Color.RED|GREEN |
|
||||||
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | | new | tools.LIGHT | LIGHT | LIGHT | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN |
|
| | | new | tools.LIGHT | LIGHT | LIGHT | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN |
|
||||||
+ +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | user mixed | 3.10 | <Grey.WHITE: 1 | Grey.WHITE | Grey.WHITE | <Grey.WHITE: 1> | Grey.WHITE | 1 |
|
| | user mixed | 3.10 | <Grey.WHITE: 1 | Grey.WHITE | Grey.WHITE | <Grey.WHITE: 1> | Grey.WHITE | 1 |
|
||||||
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | | new | tools.WHITE | WHITE | WHITE | tools.WHITE | WHITE | WHITE |
|
| | | new | tools.WHITE | WHITE | WHITE | tools.WHITE | WHITE | WHITE |
|
||||||
+ +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | int drop-in | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | | <Color.RED|GREEN: 3> | Color.RED|GREEN | |
|
| | int drop-in | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | | <Color.RED|GREEN: 3> | Color.RED|GREEN | |
|
||||||
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | | new | tools.LIGHT | -1 | | tools.RED|tools.GREEN | 3 | |
|
| | | new | tools.LIGHT | -1 | | tools.RED|tools.GREEN | 3 | |
|
||||||
+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
|
|
||||||
Which will result in:
|
This table shows the final result:
|
||||||
|
|
||||||
+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| style | type | enum repr() | enum str() | enum format() | flag repr() | flag str() | flag format() |
|
| style | category | enum repr() | enum str() | enum format() | flag repr() | flag str() | flag format() |
|
||||||
+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| normal | simple | <Hue.LIGHT: -1> | Hue.LIGHT | Hue.LIGHT | <Color(3): RED|GREEN> | Color.RED|Color.GREEN | Color.RED|Color.GREEN |
|
| normal | simple | <Hue.LIGHT: -1> | Hue.LIGHT | Hue.LIGHT | <Color(3): RED|GREEN> | Color.RED|Color.GREEN | Color.RED|Color.GREEN |
|
||||||
+ +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | user mixed | <Grey.WHITE: 1> | Grey.WHITE | Grey.WHITE | <Grey(1): WHITE> | Grey.WHITE | Grey.WHITE |
|
| | user mixed | <Grey.WHITE: 1> | Grey.WHITE | Grey.WHITE | <Grey(1): WHITE> | Grey.WHITE | Grey.WHITE |
|
||||||
+ +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | int drop-in | <Hue.LIGHT: -1> | -1 | -1 | <Color(3): RED|GREEN> | 3 | 3 |
|
| | int drop-in | <Hue.LIGHT: -1> | -1 | -1 | <Color(3): RED|GREEN> | 3 | 3 |
|
||||||
+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| global | simple | tools.LIGHT | LIGHT | LIGHT | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN |
|
| global | simple | tools.LIGHT | LIGHT | LIGHT | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN |
|
||||||
+ +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | user mixed | tools.WHITE | WHITE | WHITE | tools.WHITE | WHITE | WHITE |
|
| | user mixed | tools.WHITE | WHITE | WHITE | tools.WHITE | WHITE | WHITE |
|
||||||
+ +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
| | int drop-in | tools.LIGHT | -1 | -1 | tools.RED|tools.GREEN | 3 | 3 |
|
| | int drop-in | tools.LIGHT | -1 | -1 | tools.RED|tools.GREEN | 3 | 3 |
|
||||||
+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
|
||||||
|
|
||||||
|
@ -181,7 +179,7 @@ software uses the ``repr()``, ``str()``, and ``format()`` output of enums in
|
||||||
tests, documentation, data structures, and/or code generation.
|
tests, documentation, data structures, and/or code generation.
|
||||||
|
|
||||||
Normal usage of enum members will not change: ``re.ASCII`` can still be used
|
Normal usage of enum members will not change: ``re.ASCII`` can still be used
|
||||||
as ``re.ASCII`` and will still compare equal to ``256``.
|
as ``re.ASCII`` and will still compare equal to ``256``.
|
||||||
|
|
||||||
If the previous output needs to be maintained, for example to ensure
|
If the previous output needs to be maintained, for example to ensure
|
||||||
compatibily between different Python versions, software projects will need to
|
compatibily between different Python versions, software projects will need to
|
||||||
|
|
Loading…
Reference in New Issue