Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add precise values for enum members where possible #11299

Merged
merged 39 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9bb03d0
Changed enums to conform with proposed change to typing spec discusse…
erictraut Jan 22, 2024
2c63836
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2024
ce2f1ba
Fixed some of the problems stubtest found.
erictraut Jan 22, 2024
1447bf9
Merge branch 'enum-type-change' of https://github.com/erictraut/types…
erictraut Jan 22, 2024
e7df031
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2024
44ea4d1
Fixed more issues found by stubtest
erictraut Jan 22, 2024
42f5f81
Merge branch 'enum-type-change' of https://github.com/erictraut/types…
erictraut Jan 22, 2024
76030ba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2024
0de299b
More fixes from tests
erictraut Jan 22, 2024
9a8eafe
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2024
71be421
More fixes from test results
erictraut Jan 22, 2024
ed15ebd
More fixes
erictraut Jan 22, 2024
4c84746
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2024
16f4971
Tests really didn't like that change
erictraut Jan 22, 2024
f3de805
Merge branch 'enum-type-change' of https://github.com/erictraut/types…
erictraut Jan 22, 2024
6253c04
Merge branch 'main' into enum-type-change
JelleZijlstra Mar 9, 2024
9be0c58
Merge branch 'main' of https://github.com/python/typeshed into enum-t…
erictraut Apr 10, 2024
18480de
Added missing enum values to recently-added stubs.
erictraut Apr 10, 2024
1e54df7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 10, 2024
4819fe2
Addressed another stubtest failure.
erictraut Apr 10, 2024
2aeb508
Merge branch 'enum-type-change' of https://github.com/erictraut/types…
erictraut Apr 10, 2024
56560c2
Silenced a pyright error.
erictraut Apr 10, 2024
0748e23
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 10, 2024
79d034d
Trying to make stubtest happy.
erictraut Apr 10, 2024
be000b0
Merge branch 'enum-type-change' of https://github.com/erictraut/types…
erictraut Apr 10, 2024
a66fb38
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 10, 2024
4aef83b
fix pre-commit errors
AlexWaygood Apr 11, 2024
e0f8e84
make sure it's Final constants being assigned in the psutil enum
AlexWaygood Apr 11, 2024
db11c8e
Merge branch 'main' into enum-type-change
AlexWaygood Apr 11, 2024
e4ab75c
Update .flake8
AlexWaygood Apr 11, 2024
bd170fa
Address issue with unknown integer values for platform-specific butto…
erictraut Apr 13, 2024
71684a8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 13, 2024
762439d
Added literal values for linux-specific button enums.
erictraut Apr 14, 2024
413b303
Merge branch 'enum-type-change' of https://github.com/erictraut/types…
erictraut Apr 14, 2024
18c0111
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 14, 2024
fb0a2c4
unknown is 0 according to stubtest
JelleZijlstra Apr 15, 2024
129de9e
deal with Key enum
JelleZijlstra Apr 15, 2024
843d4ad
Everything is an alias for alt
JelleZijlstra Apr 15, 2024
279a068
Make the requested changes
AlexWaygood Apr 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed more issues found by stubtest
  • Loading branch information
erictraut committed Jan 22, 2024
commit 44ea4d1a50d903cf7b8128a3e56a57c0f22fa3d2
76 changes: 38 additions & 38 deletions stdlib/tkinter/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -195,45 +195,45 @@ if sys.version_info >= (3, 11):
serial: int

class EventType(StrEnum):
Activate = 36
ButtonPress = 4
Activate = '36'
ButtonPress = '4'
Button = ButtonPress
ButtonRelease = 5
Circulate = 26
CirculateRequest = 27
ClientMessage = 33
Colormap = 32
Configure = 22
ConfigureRequest = 23
Create = 16
Deactivate = 37
Destroy = 17
Enter = 7
Expose = 12
FocusIn = 9
FocusOut = 10
GraphicsExpose = 13
Gravity = 24
KeyPress = 2
Key = 2
KeyRelease = 3
Keymap = 11
Leave = 8
Map = 19
MapRequest = 20
Mapping = 34
Motion = 6
MouseWheel = 38
NoExpose = 14
Property = 28
Reparent = 21
ResizeRequest = 25
Selection = 31
SelectionClear = 29
SelectionRequest = 30
Unmap = 18
VirtualEvent = 35
Visibility = 15
ButtonRelease = '5'
Circulate = '26'
CirculateRequest = '27'
ClientMessage = '33'
Colormap = '32'
Configure = '22'
ConfigureRequest = '23'
Create = '16'
Deactivate = '37'
Destroy = '17'
Enter = '7'
Expose = '12'
FocusIn = '9'
FocusOut = '10'
GraphicsExpose = '13'
Gravity = '24'
KeyPress = '2'
Key = '2'
KeyRelease = '3'
Keymap = '11'
Leave = '8'
Map = '19'
MapRequest = '20'
Mapping = '34'
Motion = '6'
MouseWheel = '38'
NoExpose = '14'
Property = '28'
Reparent = '21'
ResizeRequest = '25'
Selection = '31'
SelectionClear = '29'
SelectionRequest = '30'
Unmap = '18'
VirtualEvent = '35'
Visibility = '15'

_W = TypeVar("_W", bound=Misc)
# Events considered covariant because you should never assign to event.widget.
Expand Down
10 changes: 5 additions & 5 deletions stubs/psutil/psutil/_common.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ NIC_DUPLEX_HALF: int
NIC_DUPLEX_UNKNOWN: int

class NicDuplex(enum.IntEnum):
NIC_DUPLEX_FULL = ...
NIC_DUPLEX_HALF = ...
NIC_DUPLEX_UNKNOWN = ...
NIC_DUPLEX_FULL = 2
NIC_DUPLEX_HALF = 1
NIC_DUPLEX_UNKNOWN = 0

POWER_TIME_UNKNOWN: int
POWER_TIME_UNLIMITED: int

class BatteryTime(enum.IntEnum):
POWER_TIME_UNKNOWN = ...
POWER_TIME_UNLIMITED = ...
POWER_TIME_UNKNOWN = -1
POWER_TIME_UNLIMITED = -2

ENCODING: str
ENCODING_ERRS: str
Expand Down
128 changes: 64 additions & 64 deletions stubs/pynput/pynput/keyboard/_base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,71 +25,71 @@ class KeyCode:
def from_dead(cls, char: str, **kwargs: Any) -> Self: ...

class Key(enum.Enum):
alt = ...
alt_l = ...
alt_r = ...
alt_gr = ...
backspace = ...
caps_lock = ...
cmd = ...
cmd_l = ...
cmd_r = ...
ctrl = ...
ctrl_l = ...
ctrl_r = ...
delete = ...
down = ...
end = ...
enter = ...
esc = ...
f1 = ...
f2 = ...
f3 = ...
f4 = ...
f5 = ...
f6 = ...
f7 = ...
f8 = ...
f9 = ...
f10 = ...
f11 = ...
f12 = ...
f13 = ...
f14 = ...
f15 = ...
f16 = ...
f17 = ...
f18 = ...
f19 = ...
f20 = ...
alt = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears these values are actually KeyCode object, not ints. I'll try to push a fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, that wasn't released. In the last release all the values are really 0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference: moses-palmer/pynput@4ee72f9. The last release was in January 2022.

alt_l = 0
alt_r = 0
alt_gr = 0
backspace = 0
caps_lock = 0
cmd = 0
cmd_l = 0
cmd_r = 0
ctrl = 0
ctrl_l = 0
ctrl_r = 0
delete = 0
down = 0
end = 0
enter = 0
esc = 0
f1 = 0
f2 = 0
f3 = 0
f4 = 0
f5 = 0
f6 = 0
f7 = 0
f8 = 0
f9 = 0
f10 = 0
f11 = 0
f12 = 0
f13 = 0
f14 = 0
f15 = 0
f16 = 0
f17 = 0
f18 = 0
f19 = 0
f20 = 0
if sys.platform == "win32":
f21 = ...
f22 = ...
f23 = ...
f24 = ...
home = ...
left = ...
page_down = ...
page_up = ...
right = ...
shift = ...
shift_l = ...
shift_r = ...
space = ...
tab = ...
up = ...
media_play_pause = ...
media_volume_mute = ...
media_volume_down = ...
media_volume_up = ...
media_previous = ...
media_next = ...
insert = ...
menu = ...
num_lock = ...
pause = ...
print_screen = ...
scroll_lock = ...
f21 = 0
f22 = 0
f23 = 0
f24 = 0
home = 0
left = 0
page_down = 0
page_up = 0
right = 0
shift = 0
shift_l = 0
shift_r = 0
space = 0
tab = 0
up = 0
media_play_pause = 0
media_volume_mute = 0
media_volume_down = 0
media_volume_up = 0
media_previous = 0
media_next = 0
insert = 0
menu = 0
num_lock = 0
pause = 0
print_screen = 0
scroll_lock = 0

class Controller:
_KeyCode: ClassVar[type[KeyCode]] # undocumented
Expand Down