| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
(GH-112526)
(cherry picked from commit f9e6ce03953e9ee988d55324dc715b0ef2303cfb)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
|
|
|
|
|
|
| |
mobile (GH-111898) (#111908)
gh-111895: Convert definition list to bullet list for readability on mobile (GH-111898)
Convert definition list to bullet list for readability on mobile
(cherry picked from commit 7d21e3d5ee9858aee570aa6c5b6a6e87d776f4b5)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
|
|
|
|
|
|
|
| |
gh-111181: Fix enum doctests (GH-111180)
(cherry picked from commit c4dc5a6ae8aa13abb743182df088f1a3526d1bcd)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
|
|
| |
* Fix wrong indentation in the other dirs.
* Fix more wrong indentation..
(cherry picked from commit 718391f475f2550d99dd794069ca76312f7f6aa6)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
__new__ (GH-108704) (#108733)
gh-108682: [Enum] raise TypeError if super().__new__ called in custom __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.
(cherry picked from commit d48760b2f1e28dd3c1a35721939f400a8ab619b8)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
|
|
|
|
|
|
| |
(GH-105520)
* revert enum pickling from by-name to by-value
(cherry picked from commit 4ff5690e591b7d11cf11e34bf61004e2ea58ab3c)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
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
|