Exemplo n.º 1
0
 def start(self):
     from data import menu_list
     try:
         while self.loop:
             choice = Controller.make_choice(menu_list[self.__menu].keys(), self.__menu)
             Controller.considering_choice(self, choice, list(menu_list[self.__menu].values()))
     except Exception as e:
         ViewHelper.show_error(str(e))
Exemplo n.º 2
0
def emulation():
    fake = Faker()
    users_count = 10
    users = [
        fake.profile(fields=['username'], sex=None)['username']
        for u in range(users_count)
    ]
    threads = []
    try:
        for i in range(users_count):
            threads.append(
                EmulationController(users[i], users, users_count,
                                    random.randint(1, 2)))
        for thread in threads:
            thread.start()
    except Exception as e:
        View.show_error(str(e))
    finally:
        for thread in threads:
            if thread.is_alive():
                thread.stop()


if __name__ == "__main__":
    choice = Controller.make_choice(["Neo4j menu", "Emulation"],
                                    "Program mode")
    if choice == 0:
        Neo4jController()
    elif choice == 1:
        emulation()
Exemplo n.º 3
0
    users = [
        fake.profile(fields=['username'], sex=None)['username']
        for u in range(users_count)
    ]
    threads = []
    try:

        for i in range(users_count):
            threads.append(
                EmulationController(users[i], users, users_count,
                                    random.randint(1, 2)))
        for thread in threads:
            thread.start()

    except Exception as e:
        View.show_error(str(e))
    finally:
        for thread in threads:
            if thread.is_alive():
                thread.stop()


if __name__ == "__main__":
    choice = Controller.make_choice(
        ["Neo4j", "Emulation(use one time with worker for generate db)"],
        "Program mode")
    if choice == 0:
        Neo4jController()
    elif choice == 1:
        emulation()
Exemplo n.º 4
0
    users = [
        fake.profile(fields=['username'], sex=None)['username']
        for u in range(users_count)
    ]
    threads = []
    try:

        for i in range(users_count):
            threads.append(
                EmulationController(users[i], users, users_count,
                                    random.randint(100, 5000)))
        for thread in threads:
            thread.start()

        AdminController()

        for thread in threads:
            if thread.is_alive():
                thread.stop()
    except Exception as e:
        View.show_error(str(e))


if __name__ == "__main__":

    choice = Controller.make_choice(["Main", "Emulation"], "Program mode")
    if choice == 0:
        UserController()
    elif choice == 1:
        emulation()