def main(): """ Launch ``turses``. """ set_title(__name__) set_encoding('utf8') args = read_arguments() # check if stdout has to be restored after program exit if any([ args.debug, args.offline, getattr(args, 'help', False), getattr(args, 'version', False) ]): # we are going to print information to stdout save_and_restore_stdout = False else: save_and_restore_stdout = True if save_and_restore_stdout: save_stdout() # parse arguments and load configuration configuration.parse_args(args) configuration.load() # start logger logging.basicConfig(filename=LOG_FILE, level=configuration.logging_level) # create view curses_interface = CursesInterface() # create model timeline_list = TimelineList() # create API api = create_async_api(MockApi if args.offline else TweepyApi) # create controller turses = Turses( ui=curses_interface, api=api, timelines=timeline_list, ) try: turses.start() except Exception: # A unexpected exception occurred, open the debugger in debug mode if args.debug or args.offline: import pdb pdb.post_mortem() finally: if save_and_restore_stdout: restore_stdout() restore_title() exit(0)
def main(): """ Launch ``turses``. """ set_title(__name__) set_encoding('utf8') args = parse_arguments() # check if stdout has to be restored after program exit if any([args.debug, args.offline, getattr(args, 'help', False), getattr(args, 'version', False)]): # we are going to print information to stdout save_and_restore_stdout = False else: save_and_restore_stdout = True if save_and_restore_stdout: save_stdout() # load configuration configuration = Configuration(args) configuration.load() # start logger logging.basicConfig(filename=LOG_FILE, level=configuration.logging_level) # create view curses_interface = CursesInterface(configuration) # select API backend if args.offline: api_backend = MockApi else: api_backend = TweepyApi # create controller turses = Turses(configuration=configuration, ui=curses_interface, api_backend=api_backend) try: turses.start() except KeyboardInterrupt: pass except: # open the debugger if args.debug or args.offline: import pdb pdb.post_mortem() finally: if save_and_restore_stdout: restore_stdout() restore_title() exit(0)
def main(): """ Launch ``turses``. """ set_title(__name__) set_encoding('utf8') args = read_arguments() # check if stdout has to be restored after program exit if any([args.debug, args.offline, getattr(args, 'help', False), getattr(args, 'version', False)]): # we are going to print information to stdout save_and_restore_stdout = False else: save_and_restore_stdout = True if save_and_restore_stdout: save_stdout() # parse arguments and load configuration configuration.parse_args(args) configuration.load() # start logger logging.basicConfig(filename=LOG_FILE, level=configuration.logging_level) # create view curses_interface = CursesInterface() # create model timeline_list = TimelineList() # create API api = create_async_api(MockApi if args.offline else TweepyApi) # create controller turses = Turses(ui=curses_interface, api=api, timelines=timeline_list,) try: turses.start() except: # A unexpected exception occurred, open the debugger in debug mode if args.debug or args.offline: import pdb pdb.post_mortem() finally: if save_and_restore_stdout: restore_stdout() restore_title() exit(0)
def main(): """ Launch ``turses``. """ set_title(__name__) set_encoding('utf8') args = read_arguments() # check if stdout has to be restored after program exit if any([ args.debug, args.offline, getattr(args, 'help', False), getattr(args, 'version', False) ]): # we are going to print information to stdout save_and_restore_stdout = False else: save_and_restore_stdout = True if save_and_restore_stdout: save_stdout() # parse arguments and load configuration configuration.parse_args(args) configuration.load() # start logger logging.basicConfig(filename=LOG_FILE, level=configuration.logging_level) # create view curses_interface = CursesInterface() # select API backend if args.offline: api_backend = MockApi else: api_backend = TweepyApi # create controller turses = Turses(ui=curses_interface, api_backend=api_backend) try: turses.start() except KeyboardInterrupt: pass except: # open the debugger if args.debug or args.offline: import pdb pdb.post_mortem() finally: if save_and_restore_stdout: restore_stdout() restore_title() exit(0)