예제 #1
0
 def initializeReload(self):
     # Dispatcher should only be created once.
     if self.dispatcher is None:
         #create dispatcher:
         self.dispatcher = Dispatcher(self)
     #else reload it
     else:
         self.dispatcher.reload()
예제 #2
0
	def initializeReload(self):
		# Addons should only be created once
		if self.addons is None: self.addons = _ADDONS()
		else: self.addons.clear()
		# Dispatcher should only be created once.
		if self.dispatcher is None:
			#create dispatcher:
			self.dispatcher = Dispatcher(self)
		#else reload it
		else:
			self.dispatcher.reload()
예제 #3
0
def run():
    """
    Bootstraps the application.
    """
    dispatcher = Dispatcher()

    input_file_path = sys.argv[1] if len(sys.argv) > 1 else None
    if input_file_path:
        try:
            with open(input_file_path, "r") as f:
                for cmd in f:
                    response = dispatcher.dispatch(cmd)
        except FileNotFoundError:
            logger.error("No such file: {}".format(input_file_path))

    else:
        cmd = None
        while True:
            cmd = input()
            if cmd:
                if cmd == 'exit':
                    break
                else:
                    response = dispatcher.dispatch(cmd)
예제 #4
0
 def setUp(self):
     self.dispatcher = Dispatcher()