# HG changeset patch # User Sietse Brouwer # Date 1530881688 -7200 # Fri Jul 06 14:54:48 2018 +0200 # Node ID 971ee4e727da7973ba755a4b14722ed2c588f36f # Parent 1934c25a510d5bc8c34ef2142340aebb8e688083 Separate main and run functions diff --git a/check.py b/check.py --- a/check.py +++ b/check.py @@ -74,7 +74,7 @@ t.addstr(i + 2, 0, pformat(state), styles['plain']) -def main(t, styles): +def run(t, styles): state = { 'tasks': [(False, t) for t in TASKS], 'current_task_id': 0, @@ -88,7 +88,9 @@ if not state['running']: break +def main(): + with TerminalAndStyles() as (t, styles): + run(t, styles) if __name__ == '__main__': - with TerminalAndStyles() as (t, styles): - main(t, styles) + main()