Andre Delfino
96a09df644
[doc] Fix a few margins due to bad markup (GH-23619)
2020-12-17 09:25:55 -08:00
Ethan Furman
efb13be72c
bpo-42385: [Enum] add `_generate_next_value_` to StrEnum (GH-23735)
...
The default for auto() is to return an integer, which doesn't work for `StrEnum`. The new `_generate_next_value_` for `StrEnum` returns the member name, lower cased.
2020-12-10 12:20:06 -08:00
Ethan Furman
7cf0aad96d
bpo-42517: [Enum] do not convert private names into members (GH-23722)
...
private names, such as `_Color__hue` and `_Color__hue_` are now normal attributes, and do not become members nor raise exceptions
2020-12-09 17:12:11 -08:00
Ethan Furman
d986d1657e
bpo-41816: `StrEnum.__str__` is `str.__str__` (GH-22362)
...
use `str.__str__` for `StrEnum` so that `str(StrEnum.member)` is the same as directly accessing the string value of the `StrEnum` member
2020-09-22 13:00:07 -07:00
Ethan Furman
62e40d8450
Enum: add extended AutoNumber example (GH-22349)
2020-09-22 00:05:27 -07:00
Ethan Furman
0063ff4e58
bpo-41816: add `StrEnum` (GH-22337)
...
`StrEnum` ensures that its members were already strings, or intended to
be strings.
2020-09-21 17:23:13 -07:00
Ethan Furman
7219e27087
Enum: make `Flag` and `IntFlag` members iterable (GH-22221)
2020-09-16 13:01:00 -07:00
Ethan Furman
542e1df2b0
bpo-40721: add note about enum member name case (GH-22231)
...
* UPPER_CASE preferred as enum members are constants
2020-09-14 13:32:44 -07:00
Victor Stinner
d3ded08048
bpo-40204: Add :noindex: in the documentation (GH-21859)
...
Add :noindex: to duplicated documentation to fix "duplicate object
description" errors.
For example, fix this Sphinx 3 issue:
Doc/library/configparser.rst:1146: WARNING: duplicate object
description of configparser.ConfigParser.optionxform, other instance
in library/configparser, use :noindex: for one of them
2020-08-13 21:41:54 +02:00
E-Paine
1ee5dc1586
Remove trailing >>> in enum docs (GH-21358)
...
The >>> as the last line serve no purpose and are not colored correctly by Sphinx.
2020-07-09 12:18:34 -07:00
Ethan Onstott
d9a43e20fa
bpo-40025: Require _generate_next_value_ to be defined before members (GH-19098)
...
require `_generate_next_value_` to be defined before members
2020-04-28 10:20:55 -07:00
YoSTEALTH
24bcefcb74
bpo-39234: `enum.auto()` default initial value as 1 (GH-17878)
...
Updated as Eric mentioned "By default, the initial value starts at 1"
https://bugs.python.org/issue39234
Automerge-Triggered-By: @ericvsmith
2020-01-06 14:04:43 -08:00
YoSTEALTH
2e9012a3e1
bpo-39234: Doc: `enum.auto()` incrementation value not specified. (GH-17872)
...
* `enum.auto()` initial value is now specified as being `1`.
2020-01-06 11:53:36 -08:00
Antoine
d3c8d73514
Minor documentation fixes on library/enum (GH-15234)
...
* Minor documentation fixes on library/enum
2019-08-19 18:41:31 -07:00
thatneat
2f19e82fbe
bpo-37479: on Enum subclasses with mixins, __format__ uses overridden __str__ (GH-14545)
...
* bpo-37479: on Enum subclasses with mixins, __format__ uses overridden __str__
2019-07-04 11:28:37 -07:00
nu_no
dfc8bb987d
Fix typo: class declaration (GH-11678)
2019-01-27 14:07:47 -08:00
Ethan Furman
5bdab641da
bpo-29577: Enum: mixin classes don't mix well with already mixed Enums (GH-9328)
...
* bpo-29577: allow multiple mixin classes
2018-09-21 19:03:09 -07:00
Ethan Furman
f52237400b
bpo-33437: add __new__ vs __init__ example (GH-9145)
...
Improve Enum docs.
https://bugs.python.org/issue33437
2018-09-12 10:00:30 -07:00
Rahul Jha
9430652535
bpo-33217: Raise TypeError for non-Enum lookups in Enums (GH-6651)
...
* bpo-33217: Raise TypeError for non-Enum lookups in Enums
2018-09-10 11:21:04 -07:00
Andrés Delfino
2d748389dc
Fix moduleauthor/sectionauthor directives in Enum (GH-8117)
2018-07-07 22:01:25 +03:00
INADA Naoki
e57f91a0f0
bpo-33866: enum: Stop using OrderedDict (GH-7698)
2018-06-19 01:14:26 +09:00
Ethan Furman
a4b1bb4801
bpo-31801: Enum: add _ignore_ as class option ( #5237 )
...
* bpo-31801: Enum: add _ignore_ as class option
_ignore_ is a list, or white-space seperated str, of names that will not
be candidates for members; these names, and _ignore_ itself, are removed
from the final class.
* bpo-31801: Enum: add documentation for _ignore_
* bpo-31801: Enum: remove trailing whitespace
* bpo-31801: Enum: fix bulleted list format
* bpo-31801: add version added for _ignore_
2018-01-22 07:56:37 -08:00
Julian Kahnert
0f31c74fcf
Improve enum.Flag code example (GH-5167)
...
The code example that demonstrate how to use enum.Flag was missing
the import of enum.auto.
2018-01-12 19:35:57 -08:00
Kartik Anand
626584284e
correct documentation for enum.html ( #358 )
2017-02-28 21:07:18 +01:00
Berker Peksag
2a267a12ee
Issue #29129 : Fix typo in "Using auto" section
2017-01-02 05:51:04 +03:00
Ethan Furman
23bb6f48ea
close issue28172: Change all example enum member names to uppercase, per Guido; patch by Chris Angelico.
2016-11-21 09:22:05 -08:00
Ethan Furman
3515dcce80
issue23591: fix flag decomposition and repr
2016-09-18 13:15:41 -07:00
Ethan Furman
c16595e567
issue23591: add auto() for auto-generating Enum member values
2016-09-10 23:36:59 -07:00
Ethan Furman
54924df2b1
improve Enum docs
2016-09-07 23:40:31 -07:00
Ethan Furman
6a137e8d50
add recipes for pseudo-valueless enums
2016-09-07 08:17:15 -07:00
Ethan Furman
27682d2698
issue23591: more docs; slight change to repr
2016-09-04 11:39:01 -07:00
Ethan Furman
25d94bbf05
issue23591: bool(empty_flags) == False; more docs & tests
2016-09-02 16:32:32 -07:00
Ethan Furman
65a5a47d79
issue23591: add docs; code cleanup; more tests
2016-09-01 23:55:19 -07:00
Ethan Furman
e8e61277ff
issue26981: add _order_ compatibility shim to enum.Enum
2016-08-20 07:19:31 -07:00
Ethan Furman
332dbc7325
Issue26988: remove AutoEnum
2016-08-20 00:00:52 -07:00
Berker Peksag
43b586b951
Silence warnings from 'make suspicious' to make the docs buildbot happy
2016-08-06 13:37:22 +03:00
Ethan Furman
73fc586d9f
Add AutoEnum: automatically provides next value if missing. Issue 26988.
2016-08-05 16:03:16 -07:00
Martin Panter
2fec611a70
Issue #24314 : Merge doc links from 3.5
2016-06-18 08:20:22 +00:00
Martin Panter
bae5d81f5d
Issue #24314 : Fix doc links for general attributes like __name__, __dict__
2016-06-18 03:57:31 +00:00
Martin Panter
e514093a2f
Issue #27125 : Merge typo fixes from 3.5
2016-05-30 05:24:49 +00:00
Martin Panter
a90a4a9651
Issue #27125 : Remove duplicated words from documentation and comments
2016-05-30 04:04:50 +00:00
Martin Panter
bc1ee460dc
Issue #25179 : Documentation for formatted string literals aka f-strings
...
Some of the inspiration and wording is taken from the text of PEP 498 by Eric
V. Smith, and the existing str.format() documentation.
2016-02-13 00:41:37 +00:00
Martin Panter
46988d3659
Merge string formatting doc fixes from 3.5
2016-02-08 01:49:35 +00:00
Martin Panter
d5db14794b
Issue #25179 : Preparatory cleanup of existing docs on string formatting
...
* Various sections were pointing to the section on the string.Formatter
class, when the section on the common format string syntax is probably more
appropriate
* Fix references to various format() functions and methods
* Nested replacement fields may contain conversions and format specifiers,
and this is tested; see Issue #19729 for instance
2016-02-08 01:34:09 +00:00
Ethan Furman
2ae4ea54a2
use public 'value'
2016-01-16 12:39:53 -08:00
Ethan Furman
60255b67b9
revert change 87a9dff5106c: pure Enum members again evaluate to True;
...
update Finer Points section of docs to cover boolean evaluation;
add more tests for pure and mixed boolean evaluation
2016-01-15 15:01:33 -08:00
Ethan Furman
748dad5b6a
Close 25594: advise against accessing Enum members from other members
2015-11-20 13:12:26 -08:00
Ethan Furman
92e5d2f0eb
Close issue25594: advise against accessing Enum members from other members
2015-11-20 13:17:27 -08:00
Victor Stinner
91108f049f
Issue #25210 : Change error message of do_richcompare()
...
Don't add parenthesis to type names. Add also quotes around the type names.
Before:
TypeError: unorderable types: int() < NoneType()
After:
TypeError: '<' not supported between instances of 'int' and 'NoneType'
2015-10-14 18:25:31 +02:00
Martin Panter
84835ab1cb
Issue #25161 : Merge full stops from 3.4 into 3.5
2015-10-10 10:44:25 +00:00