from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode

import usb_hid
import time

class HumanKeyboard(object):
    def __init__(self):
        self.keyboard = Keyboard(usb_hid.devices)
        self.keyboardLayout = KeyboardLayoutUS(self.keyboard)


    def keyPress(self, keyCode):
        """Send a human like keypress.

        Keyword arguments:
        keyCode -- the real key to be pressed (example Keycode.SEVEN)    
        """
        self.keyboard.press(keyCode)
        time.sleep(0.1)
        self.keyboard.release(keyCode)
[((10, 24, 10, 49), 'adafruit_hid.keyboard.Keyboard', 'Keyboard', ({(10, 33, 10, 48): 'usb_hid.devices'}, {}), '(usb_hid.devices)', False, 'from adafruit_hid.keyboard import Keyboard\n'), ((11, 30, 11, 61), 'adafruit_hid.keyboard_layout_us.KeyboardLayoutUS', 'KeyboardLayoutUS', ({(11, 47, 11, 60): 'self.keyboard'}, {}), '(self.keyboard)', False, 'from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS\n'), ((21, 8, 21, 23), 'time.sleep', 'time.sleep', ({(21, 19, 21, 22): '(0.1)'}, {}), '(0.1)', False, 'import time\n')]