def install_reactor(explicit_reactor=None, verbose=False):
 import sys
 log = txaio.make_logger()
 if explicit_reactor:
  from twisted.application.reactors import installReactor
  log.info("Trying to install explicitly specified Twisted reactor '{reactor}'", reactor=explicit_reactor)
  try:
   installReactor(explicit_reactor)
  except:
   log.failure('Could not install Twisted reactor {reactor}\n{log_failure.value}', reactor=explicit_reactor)
   sys.exit(1)
 else:
  log.debug('Automatically choosing optimal Twisted reactor')
  install_optimal_reactor(verbose)
 from twisted.internet import reactor
 txaio.config.loop = reactor
 if verbose:
  from twisted.python.reflect import qual
  log.debug('Running Twisted reactor {reactor}', reactor=qual(reactor.__class__))
 return reactor

def install_reactor ( explicit_reactor = None , verbose = False ) : import sys log = txaio . make_logger ( ) if explicit_reactor : from twisted . application . reactors import installReactor log . info ( "Trying to install explicitly specified Twisted reactor '{reactor}'" , reactor = explicit_reactor ) try : installReactor ( explicit_reactor ) except : log . failure ( 'Could not install Twisted reactor {reactor}\n{log_failure.value}' , reactor = explicit_reactor ) sys . exit ( 1 ) else : log . debug ( 'Automatically choosing optimal Twisted reactor' ) install_optimal_reactor ( verbose ) from twisted . internet import reactor txaio . config . loop = reactor if verbose : from twisted . python . reflect import qual log . debug ( 'Running Twisted reactor {reactor}' , reactor = qual ( reactor . __class__ ) ) return reactor
install twisted reactor .