Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_send_key_mult(self):
self.notepad.send(KEYS.TAB * 4)
time.sleep(0.5)
self.assertEqual(self.notepad.text.count(b'\t'), 4, self.notepad.text)
def __getattr__(name):
return getattr(KEYS, name)
for i in range(1, 25):
# set function keys
key_name = f'F{i}'
setattr(KEYS, key_name, Key(key_name))
for i in range(1, 33):
# set joystick keys
key_name = f'Joy{i}'
setattr(KEYS, key_name, Key(key_name))
setattr(KEYS, key_name.upper(), Key(key_name))
_init_keys()
__all__ = [name for name in dir(KEYS) if not name.startswith('_')]
def __getattr__(name):
return getattr(KEYS, name)
def _init_keys():
'''put this in a function to avoid polluting global namespace'''
for i in range(0, 10):
# set numpad keys
key_name = f'Numpad{i}'
key = Key(key_name)
setattr(KEYS, key_name, key)
setattr(KEYS, key_name.upper(), key)
for i in range(1, 25):
# set function keys
key_name = f'F{i}'
setattr(KEYS, key_name, Key(key_name))
for i in range(1, 33):
# set joystick keys
key_name = f'Joy{i}'
setattr(KEYS, key_name, Key(key_name))
setattr(KEYS, key_name.upper(), Key(key_name))