55from __future__ import unicode_literals
66
77import datetime
8+ from asyncio import Future , ensure_future
89
910from prompt_toolkit .application import Application
1011from prompt_toolkit .application .current import get_app
1112from prompt_toolkit .completion import PathCompleter
12- from prompt_toolkit .eventloop import From , Future , Return , ensure_future
1313from prompt_toolkit .filters import Condition
1414from prompt_toolkit .key_binding import KeyBindings
1515from prompt_toolkit .layout .containers import (
@@ -159,14 +159,14 @@ def _(event):
159159#
160160
161161def do_open_file ():
162- def coroutine ():
162+ async def coroutine ():
163163 global current_path
164164 open_dialog = TextInputDialog (
165165 title = 'Open file' ,
166166 label_text = 'Enter the path of a file:' ,
167167 completer = PathCompleter ())
168168
169- path = yield From ( show_dialog_as_float (open_dialog ) )
169+ path = await show_dialog_as_float (open_dialog )
170170 current_path = path
171171
172172 if path is not None :
@@ -184,9 +184,9 @@ def do_about():
184184
185185
186186def show_message (title , text ):
187- def coroutine ():
187+ async def coroutine ():
188188 dialog = MessageDialog (title , text )
189- yield From ( show_dialog_as_float (dialog ) )
189+ await show_dialog_as_float (dialog )
190190
191191 ensure_future (coroutine ())
192192
@@ -206,7 +206,7 @@ def show_dialog_as_float(dialog):
206206 if float_ in root_container .floats :
207207 root_container .floats .remove (float_ )
208208
209- raise Return ( result )
209+ return result
210210
211211
212212def do_new_file ():
@@ -223,12 +223,12 @@ def do_time_date():
223223
224224
225225def do_go_to ():
226- def coroutine ():
226+ async def coroutine ():
227227 dialog = TextInputDialog (
228228 title = 'Go to line' ,
229229 label_text = 'Line number:' )
230230
231- line_number = yield From ( show_dialog_as_float (dialog ) )
231+ line_number = await show_dialog_as_float (dialog )
232232
233233 try :
234234 line_number = int (line_number )
0 commit comments