mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 05:52:23 +00:00
Adds prompt_toolkit inputhook using helper func since kwarg was removed
This commit is contained in:
@@ -3,11 +3,18 @@ import os
|
||||
from matplotlib import pyplot
|
||||
|
||||
from prompt_toolkit import PromptSession
|
||||
from prompt_toolkit.eventloop.inputhook import set_eventloop_with_inputhook
|
||||
from prompt_toolkit.history import FileHistory
|
||||
|
||||
def inputhook(inputhook_context):
|
||||
while not inputhook_context.input_is_ready():
|
||||
pyplot.pause(0.1)
|
||||
return False
|
||||
|
||||
history_file = os.path.join(os.path.expanduser("~"), ".gamestonk_terminal.his")
|
||||
|
||||
try:
|
||||
session = PromptSession(history=FileHistory(history_file), inputhook=pyplot.draw)
|
||||
session = PromptSession(history=FileHistory(history_file))
|
||||
set_eventloop_with_inputhook(inputhook)
|
||||
except Exception as e: # noqa: F841
|
||||
session = None
|
||||
raise e
|
||||
|
||||
Reference in New Issue
Block a user