cpython/Lib/tkinter
Ethan Furman a02cb474f9
bpo-38659: [Enum] add _simple_enum decorator (GH-25497)
add:

* `_simple_enum` decorator to transform a normal class into an enum
* `_test_simple_enum` function to compare
* `_old_convert_` to enable checking `_convert_` generated enums

`_simple_enum` takes a normal class and converts it into an enum:

    @simple_enum(Enum)
    class Color:
        RED = 1
        GREEN = 2
        BLUE = 3

`_old_convert_` works much like` _convert_` does, using the original logic:

    # in a test file
    import socket, enum
    CheckedAddressFamily = enum._old_convert_(
            enum.IntEnum, 'AddressFamily', 'socket',
            lambda C: C.isupper() and C.startswith('AF_'),
            source=_socket,
            )

`_test_simple_enum` takes a traditional enum and a simple enum and
compares the two:

    # in the REPL or the same module as Color
    class CheckedColor(Enum):
        RED = 1
        GREEN = 2
        BLUE = 3

    _test_simple_enum(CheckedColor, Color)

    _test_simple_enum(CheckedAddressFamily, socket.AddressFamily)

Any important differences will raise a TypeError
2021-04-21 10:20:44 -07:00
..
test bpo-38659: [Enum] add _simple_enum decorator (GH-25497) 2021-04-21 10:20:44 -07:00
__init__.py bpo-38659: [Enum] add _simple_enum decorator (GH-25497) 2021-04-21 10:20:44 -07:00
__main__.py
colorchooser.py bpo-33289: Return RGB triplet of ints instead of floats from tkinter.colorchooser (GH-6578) 2021-01-21 21:14:04 +02:00
commondialog.py bpo-42721: Improve using simple dialogs without root window (GH-23897) 2020-12-25 20:19:20 +02:00
constants.py
dialog.py bpo-29446: tkinter 'import *' only imports what it should (GH-14864) 2019-07-25 21:30:33 -04:00
dnd.py bpo-15303: Support widgets with boolean value False in Tkinter (GH-23904) 2020-12-25 17:04:26 +02:00
filedialog.py Fix typos mostly in comments, docs and test names (GH-15209) 2019-08-30 16:21:19 -04:00
font.py bpo-42759: Fix equality comparison of Variable and Font in Tkinter (GH-23968) 2020-12-29 12:56:55 +02:00
messagebox.py bpo-29446: tkinter 'import *' only imports what it should (GH-14864) 2019-07-25 21:30:33 -04:00
scrolledtext.py bpo-29446: tkinter 'import *' only imports what it should (GH-14864) 2019-07-25 21:30:33 -04:00
simpledialog.py bpo-42721: Improve using simple dialogs without root window (GH-23897) 2020-12-25 20:19:20 +02:00
tix.py bpo-15303: Support widgets with boolean value False in Tkinter (GH-23904) 2020-12-25 17:04:26 +02:00
ttk.py bpo-15303: Support widgets with boolean value False in Tkinter (GH-23904) 2020-12-25 17:04:26 +02:00