Beispiel #1
0
    def test_question_list(self):
        # given
        # when
        manager = MemoryManager(self.trainer)
        q_list = manager.get_question_list()

        # then
        self.assertDictEqual(q_list, self.question_dict)
Beispiel #2
0
    def test_today_list(self):
        # given
        # when
        self.trainer.upsert_record('1', 1, datetime(2019, 1, 1), StatusEnum.PASS)
        self.trainer.upsert_record('1', 2, datetime(2019, 1, 4), StatusEnum.NOT_STARTED)

        manager = MemoryManager(self.trainer)
        q_list = manager.get_today_question_list()

        # then
        target_list = {'2': '2 + 2', '3': '3 + 3'}
Beispiel #3
0
    def test_history(self):
        # given
        # when
        self.trainer.upsert_record('1', 1, datetime(2019, 1, 1), StatusEnum.PASS)
        self.trainer.upsert_record('1', 2, datetime(2019, 1, 4), StatusEnum.NOT_STARTED)

        manager = MemoryManager(self.trainer)
        history = manager.get_history()

        # then
        target_dict = {'1': {'content': '1 + 1',
                             'records': [{'level': 1, 'date': '20190101', 'status': StatusEnum.PASS},
                                         {'level': 2, 'date': '20190104', 'status': StatusEnum.NOT_STARTED}]},
                       '2': {'content': '2 + 2', 'records': []},
                       '3': {'content': '3 + 3', 'records': []}}
        self.assertDictEqual(history, target_dict)
Beispiel #4
0
    def test_red(self):
        # given
        # when
        self.trainer.upsert_record('1', 1, datetime(2019, 1, 1), StatusEnum.PASS)
        self.trainer.upsert_record('1', 2, datetime(2019, 1, 4), StatusEnum.NOT_STARTED)

        manager = MemoryManager(self.trainer)
        manager.red('1', today=datetime(2019, 3, 1))
        manager.red('2', today=datetime(2019, 2, 1))

        # then
        last1 = self.trainer.training_log['1']['records'][-1]
        last2 = self.trainer.training_log['1']['records'][-2]
        self.assertDictEqual(last1, {'level': 1, 'date': '20190302', 'status': StatusEnum.NOT_STARTED})
        self.assertDictEqual(last2, {'level': 2, 'date': '20190104', 'status': StatusEnum.FAIL})

        last1 = self.trainer.training_log['2']['records'][-1]
        last2 = self.trainer.training_log['2']['records'][-2]
        self.assertDictEqual(last1, {'level': 1, 'date': '20190202', 'status': StatusEnum.NOT_STARTED})
        self.assertDictEqual(last2, {'level': 1, 'date': '20190201', 'status': StatusEnum.FAIL})
    def __init__(self, numIntRegisters = 32, numFloatRegisters = 32, timingModel = timingmodel.defaultTimingModel) :
        self.memory = Memory()
        
        self.registerFile = {}
        self.numIntRegisters = numIntRegisters
        self.numFloatRegisters = numFloatRegisters
        self.__createRegisterFile()

        self.memoryManager = MemoryManager(self.memory.heap[0], self.memory.heap[1] - self.memory.heap[0])
        # print("Memory allocator " + str(self.memoryManager))

        self.timingModel = timingModel()
        # print(self.timingModel)

        self.prog = None

        self.pc = self.memory.text[0]
        self.registerFile['sp'].write(self.memory.text[1] - 4) #initialize the stack pointer
Beispiel #6
0
    print "| Copyright 2014 Devin Gund. All rights reserved. |"
    print "\\-------------------------------------------------/"
    print

    if not isInternetConnected():
        print "A connection to the Internet could not be established."
        print "Some services may be unavailable."
        print

    # Create an instance of UserInfo, which encapsulates user data
    userInfo = UserInfo()
    # Create instances of the managers that govern Felix
    # The extension manager compiles the dictionary and languagemodel,
    #     so it must be called before the speech manager
    # Create an instance of MemoryManager, which encapsulates memory
    memoryManager = MemoryManager(userInfo)
    # Create an instance of ExtensionManager, which encapsulates extensions
    extensionManager = ExtensionManager()
    # Create an instance of SpeechManager, which encapsulates STT and TTS
    speechManager = SpeechManager(speechInEngine(), speechOutEngine())
    # Add speechManager to memoryManager once created
    memoryManager.speechManager = speechManager
    # Add speechManager and memoryManager to extensionManager once created
    extensionManager.speechManager = speechManager
    extensionManager.memoryManager = memoryManager

    print "STARTING UP..."

    message = "I am Felix, the intelligent computer personal assistant."
    speechManager.speakText(message)
Beispiel #7
0
    print "| Copyright 2014 Devin Gund. All rights reserved. |"
    print "\\-------------------------------------------------/"
    print

    if not isInternetConnected():
        print "A connection to the Internet could not be established."
        print "Some services may be unavailable."
        print

    # Create an instance of UserInfo, which encapsulates user data
    userInfo = UserInfo()
    # Create instances of the managers that govern Felix
    # The extension manager compiles the dictionary and languagemodel,
    #     so it must be called before the speech manager
    # Create an instance of MemoryManager, which encapsulates memory
    memoryManager = MemoryManager(userInfo)
    # Create an instance of ExtensionManager, which encapsulates extensions
    extensionManager = ExtensionManager()
    # Create an instance of SpeechManager, which encapsulates STT and TTS
    speechManager = SpeechManager(speechInEngine(), speechOutEngine())
    # Add speechManager to memoryManager once created
    memoryManager.speechManager = speechManager
    # Add speechManager and memoryManager to extensionManager once created
    extensionManager.speechManager = speechManager
    extensionManager.memoryManager = memoryManager

    print "STARTING UP..."

    message = "I am Felix, the intelligent computer personal assistant."
    speechManager.speakText(message)