Skip to content

Commit 21a943d

Browse files
committed
Merge branch 'fixup-uinput-modifiers'
2 parents 59f617b + edc3946 commit 21a943d

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/pynput/keyboard/_uinput.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,18 +219,12 @@ def for_vk(self, vk, modifiers):
219219
220220
:return: a mapped key
221221
222-
:raises ValueError: if ``modifiers`` contains keys other than
223-
:attr:`Key.shift` and :attr:`Key.alt_gr`
224-
225222
:raises KeyError: if ``vk`` is an unknown key
226223
"""
227-
if not {Key.shift, Key.alt_gr}.issuperset(modifiers):
228-
raise ValueError(modifiers)
229-
else:
230-
return self._vk_table[vk][
231-
0
232-
| (1 if Key.shift in modifiers else 0)
233-
| (2 if Key.alt_gr in modifiers else 0)]
224+
return self._vk_table[vk][
225+
0
226+
| (1 if Key.shift in modifiers else 0)
227+
| (2 if Key.alt_gr in modifiers else 0)]
234228

235229
def for_char(self, char):
236230
"""Reads a virtual key code and modifier state for a character.

0 commit comments

Comments
 (0)