def format(final, is_input, tracer, controller): """ >>> _create_mock_db() >>> template.enable_color() >>> format(0x42, True, None, None) '\\x1b[0;1;36;44m ESC O B \\x1b[0;1;31m\\r\\x1b[30CCursor key(application keypad): down arrow' >>> template.disable_color() >>> format(0x42, True, None, None) ' ESC O B Cursor key(application keypad): down arrow' >>> format(0x42, False, None, None) ' ESC O B <unknown>' >>> import sys >>> format(0x74, True, sys, None) test """ f = chr(final) if is_input: direction = '<' else: direction = '>' mnemonic = get_mnemonic(direction, f) if mnemonic[0] == "!": eval(mnemonic[1:]) return None context = [] if f: context.append(f) result = template.getss3() % (" ".join(context), mnemonic) return result
def format_seq(final, is_input, tracer, controller): """ >>> _create_mock_db() >>> template.enable_color() >>> format_seq(0x42, True, None, None) '\\x1b[0;1;36;44m ESC O B \\x1b[0;1;31m\\r\\x1b[30CCursor key(application keypad): down arrow' >>> template.disable_color() >>> format_seq(0x42, True, None, None) ' ESC O B Cursor key(application keypad): down arrow' >>> format_seq(0x42, False, None, None) ' ESC O B <unknown>' >>> import sys >>> format_seq(0x74, True, sys, None) test """ f = chr(final) if is_input: direction = '<' else: direction = '>' mnemonic = get_mnemonic(direction, f) if mnemonic[0] == "!": eval(mnemonic[1:]) return None context = [] if f: context.append(f) result = template.getss3() % (" ".join(context), mnemonic) return result
def format(final, is_input, tracer, controller): f = chr(final) if is_input: direction = '<' else: direction = '>' mnemonic = get_mnemonic(direction, f) if mnemonic[0] == "!": eval(mnemonic[1:]) return None context = [] if f: context.append(f) result = template.getss3() % (" ".join(context), mnemonic) return result