MCPcopy Index your code
hub / github.com/bpython/bpython / start

Function start

bpython/urwid.py:1322–1355  ·  view source on GitHub ↗
(main_loop, user_data)

Source from the content-addressed store, hash-verified

1320
1321 # This needs more thought. What needs to happen inside the mainloop?
1322 def start(main_loop, user_data):
1323 if exec_args:
1324 bpargs.exec_code(interpreter, exec_args)
1325 if not options.interactive:
1326 raise urwid.ExitMainLoop()
1327 if not exec_args:
1328 sys.path.insert(0, "")
1329 # this is CLIRepl.startup inlined.
1330 filename = os.environ.get("PYTHONSTARTUP")
1331 if filename and os.path.isfile(filename):
1332 with open(filename) as f:
1333 interpreter.runsource(f.read(), filename, "exec")
1334
1335 if banner is not None:
1336 myrepl.write(banner)
1337 myrepl.write("\n")
1338
1339 # XXX these deprecation warnings need to go at some point
1340 myrepl.write(
1341 _(
1342 "WARNING: You are using `bpython-urwid`, the urwid backend for `bpython`. This backend has been deprecated in version 0.19 and might disappear in a future version."
1343 )
1344 )
1345 myrepl.write("\n")
1346
1347 myrepl.start()
1348
1349 # This bypasses main_loop.set_alarm_in because we must *not*
1350 # hit the draw_screen call (it's unnecessary and slow).
1351 def run_find_coroutine():
1352 if myrepl.module_gatherer.find_coroutine():
1353 main_loop.event_loop.alarm(0, run_find_coroutine)
1354
1355 run_find_coroutine()
1356
1357 myrepl.main_loop.screen.run_wrapper(run_with_screen_before_mainloop)
1358

Callers

nothing calls this directly

Calls 5

_Function · 0.90
run_find_coroutineFunction · 0.85
runsourceMethod · 0.80
startMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected