def try_keys():
    print('press a bunch of keys (not at the same time, but you can hit them pretty quickly)')
    import tty
    import termios
    import fcntl
    import os
    from .termhelpers import Cbreak

    def ask_what_they_pressed(seq, Normal):
        print('Unidentified character sequence!')
        with Normal:
            while True:
                r = raw_input("type 'ok' to prove you're not pounding keys ")
                if r.lower().strip() == 'ok':
                    break
        while True:
            print('Press the key that produced %r again please' % (seq,))
            retry = os.read(sys.stdin.fileno(), 1000)
            if seq == retry:
                break
            print("nope, that wasn't it")
        with Normal:
            name = raw_input('Describe in English what key you pressed: ')
            f = open('keylog.txt', 'a')
            f.write("%r is called %s\n" % (seq, name))
            f.close()
            print('Thanks! Please open an issue at https://github.com/thomasballinger/curtsies/issues')
            print('or email thomasballinger@gmail.com. Include this terminal history or keylog.txt.')
            print('You can keep pressing keys')

    with Cbreak(sys.stdin) as NoCbreak:
        while True:
            try:
                chars = os.read(sys.stdin.fileno(), 1000)
                print('---')
                print(repr(chars))
                if chars in CURTSIES_NAMES:
                    print(CURTSIES_NAMES[chars])
                elif len(chars) == 1:
                    print('literal')
                else:
                    print('unknown!!!')
                    ask_what_they_pressed(chars, NoCbreak)
            except __HOLE__:
                pass
dataset/ETHPy150Open thomasballinger/curtsies/curtsies/events.py/try_keys