m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.6 KiB

6 months ago
  1. # -*- coding: UTF-8 -*-
  2. #this file is needed in site-packages to emulate readline
  3. #necessary for rlcompleter since it relies on the existance
  4. #of a readline module
  5. from __future__ import print_function, unicode_literals, absolute_import
  6. from pyreadline.rlmain import Readline
  7. __all__ = [ 'parse_and_bind',
  8. 'get_line_buffer',
  9. 'insert_text',
  10. 'clear_history',
  11. 'read_init_file',
  12. 'read_history_file',
  13. 'write_history_file',
  14. 'get_current_history_length',
  15. 'get_history_length',
  16. 'get_history_item',
  17. 'set_history_length',
  18. 'set_startup_hook',
  19. 'set_pre_input_hook',
  20. 'set_completer',
  21. 'get_completer',
  22. 'get_begidx',
  23. 'get_endidx',
  24. 'set_completer_delims',
  25. 'get_completer_delims',
  26. 'add_history',
  27. 'callback_handler_install',
  28. 'callback_handler_remove',
  29. 'callback_read_char',] #Some other objects are added below
  30. # create a Readline object to contain the state
  31. rl = Readline()
  32. if rl.disable_readline:
  33. def dummy(completer=""):
  34. pass
  35. for funk in __all__:
  36. globals()[funk] = dummy
  37. else:
  38. def GetOutputFile():
  39. '''Return the console object used by readline so that it can be used for printing in color.'''
  40. return rl.console
  41. __all__.append("GetOutputFile")
  42. import pyreadline.console as console
  43. # make these available so this looks like the python readline module
  44. read_init_file = rl.read_init_file
  45. parse_and_bind = rl.parse_and_bind
  46. clear_history = rl.clear_history
  47. add_history = rl.add_history
  48. insert_text = rl.insert_text
  49. write_history_file = rl.write_history_file
  50. read_history_file = rl.read_history_file
  51. get_completer_delims = rl.get_completer_delims
  52. get_current_history_length = rl.get_current_history_length
  53. get_history_length = rl.get_history_length
  54. get_history_item = rl.get_history_item
  55. get_line_buffer = rl.get_line_buffer
  56. set_completer = rl.set_completer
  57. get_completer = rl.get_completer
  58. get_begidx = rl.get_begidx
  59. get_endidx = rl.get_endidx
  60. set_completer_delims = rl.set_completer_delims
  61. set_history_length = rl.set_history_length
  62. set_pre_input_hook = rl.set_pre_input_hook
  63. set_startup_hook = rl.set_startup_hook
  64. callback_handler_install=rl.callback_handler_install
  65. callback_handler_remove=rl.callback_handler_remove
  66. callback_read_char=rl.callback_read_char
  67. console.install_readline(rl.readline)
  68. __all__.append("rl")