#NEWLINE# def main( * args , **kwargs ) : #NEWLINE# #INDENT# if ( sys . version_info [ : 2 ] < ( 3 , 4 ) ) : #NEWLINE# #INDENT# logger . fatal ( 'Error: Python 3.4+ is required' ) #NEWLINE# sys . exit ( ( - 1 ) ) #NEWLINE# #UNINDENT# arguments = docopt ( __doc__ , version = get_version ( ) ) #NEWLINE# formatter = '[%(asctime)s] :: %(levelname)s - %(message)s' #NEWLINE# if arguments [ '-d' ] : #NEWLINE# #INDENT# level = logging . DEBUG #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# level = logging . INFO #NEWLINE# #UNINDENT# logging . basicConfig ( level = level , format = formatter ) #NEWLINE# config = None #NEWLINE# if arguments [ '-c' ] : #NEWLINE# #INDENT# config = read_yaml_config ( arguments [ '-c' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# config = read_yaml_config ( os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , 'default_broker.yaml' ) ) #NEWLINE# logger . debug ( 'Using default configuration' ) #NEWLINE# #UNINDENT# loop = asyncio . get_event_loop ( ) #NEWLINE# broker = Broker ( config ) #NEWLINE# try : #NEWLINE# #INDENT# loop . run_until_complete ( broker . start ( ) ) #NEWLINE# loop . run_forever ( ) #NEWLINE# #UNINDENT# except KeyboardInterrupt : #NEWLINE# #INDENT# loop . run_until_complete ( broker . shutdown ( ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# loop . close ( )