| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* [Enum] Make some private attributes public.
- ``_EnumDict`` --> ``EnumDict``
- ``EnumDict._member_names`` --> ``EnumDict.member_names``
- ``Enum._add_alias_``
- ``Enum._add_value_alias_``
---------
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|
| |
|
|
|
|
|
| |
(#111898)
Convert definition list to bullet list for readability on mobile
|
|
|
| |
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
|
| |
* Fix wrong indentation in the other dirs.
* Fix more wrong indentation.
|
|
|
|
|
|
|
|
|
|
|
| |
__new__ (GH-108704)
When overriding the `__new__` method of an enum, the underlying data type should be created directly; i.e. .
member = object.__new__(cls)
member = int.__new__(cls, value)
member = str.__new__(cls, value)
Calling `super().__new__()` finds the lookup version of `Enum.__new__`, and will now raise an exception when detected.
|
|
|
|
|
| |
* revert enum pickling from by-name to by-value
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For example:
class Book(StrEnum):
title = auto()
author = auto()
desc = auto()
Book.author.desc is Book.desc
but
Book.author.title() == 'Author'
is commonly expected. Using upper-case member names avoids this confusion and possible performance impacts.
Co-authored-by: samypr100 <3933065+samypr100@users.noreply.github.com>
|
|
|
| |
a mixin must either have a __new__ method, or be a dataclass, to be interpreted as a data-type
|
|
|
|
| |
i.e. Color.RED.BLUE is now officially supported.
|
|
|
| |
_gnv_ --> _generate_next_value_
|
|
|
|
| |
fix FlagBoundary statements
add warning about reloading modules and enum identity
|
|
|
| |
Add newline for prompts so copying to REPL does not cause errors.
|
|
|
| |
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
|
|
|
| |
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
|
| |
|
|
|
| |
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
|
|
|
|
|
|
|
| |
access (GH-95083)
* issue deprecation warning for member.member access
* always store member property in current class
* remove __getattr__
|
|
|
|
| |
Also ignored some `make suspicious` false positives while assuring
true positives were properly seen by rstlint.
|
| |
|
|
|
|
|
| |
(GH-30632)
This reverts commit acf7403f9baea3ae1119fc6b4a3298522188bf96.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Undo rejected PEP-663 changes:
- restore `repr()` to its 3.10 status
- restore `str()` to its 3.10 status
New changes:
- `IntEnum` and `IntFlag` now leave `__str__` as the original `int.__str__` so that str() and format() return the same result
- zero-valued flags without a name have a slightly changed repr(), e.g. `repr(Color(0)) == '<Color: 0>'`
- update `dir()` for mixed-in types to return all the methods and attributes of the mixed-in type
- added `_numeric_repr_` to `Flag` to control display of unnamed values
- enums without doc strings have a more comprehensive doc string added
- `ReprEnum` added -- inheriting from this makes it so only `__repr__` is replaced, not `__str__` nor `__format__`; `IntEnum`, `IntFlag`, and `StrEnum` all inherit from `ReprEnum`
|
|
|
|
| |
(GH-30521)
|
|
|
|
|
|
| |
Modify the ``EnumType.__dir__()`` and ``Enum.__dir__()`` to ensure
that user-defined methods and methods inherited from mixin classes always
show up in the output of `help()`. This change also makes it easier for
IDEs to provide auto-completion.
|
|
|
| |
[Enum] add versionadded markers to docs
|
| |
|
|
|
| |
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
| |
enum. (#25837)
|
|
* Enum: streamline repr() and str(); improve docs
- repr() is now ``enum_class.member_name``
- stdlib global enums are ``module_name.member_name``
- str() is now ``member_name``
- add HOW-TO section for ``Enum``
- change main documentation to be an API reference
|