def get_unique_worker_name(): """ Returns unique worker name "Worker %n", where %n is the next available index """ index = 1 workers = MainController.get_workers_data().keys() worker_name = "Worker {0}".format(index) while worker_name in workers: worker_name = "Worker {0}".format(index) index += 1 return worker_name
def __init__(self, sys_argv): super(App, self).__init__(sys_argv) config = MainController.load_config() bitshares_instance = BitShares(config['node']) # Wallet unlock unlock_ctrl = WalletController(bitshares_instance) if unlock_ctrl.wallet_created(): unlock_view = UnlockWalletView(unlock_ctrl) else: unlock_view = CreateWalletView(unlock_ctrl) if unlock_view.exec_(): bitshares_instance = unlock_ctrl.bitshares self.main_ctrl = MainController(bitshares_instance) self.main_view = MainView(self.main_ctrl) self.main_view.show() else: sys.exit()
def get_unique_bot_name(): """ Returns unique bot name "Bot %n", where %n is the next available index """ index = 1 bots = MainController.get_bots_data().keys() botname = "Bot {0}".format(index) while botname in bots: botname = "Bot {0}".format(index) index += 1 return botname
def __init__(self, sys_argv): super(App, self).__init__(sys_argv) # Init config config = Config() # Init main controller self.main_controller = MainController(config) # Init main view self.main_view = MainView(self.main_controller) # Show main view self.main_view.show()
def test_measure_latency_one_working(many_failing_one_working): """Test connection to 3 nodes where only 3rd is working.""" MainController.measure_latency(many_failing_one_working)
def test_measure_latency_all_failing(failing_nodes): """Expect an error if no nodes could be reached.""" with pytest.raises(NumRetriesReached): MainController.measure_latency(failing_nodes)
def is_account_in_use(account): workers = MainController.get_workers_data() for worker_name, worker in workers.items(): if worker['account'] == account: return True return False
def is_bot_name_valid(bot_name): bot_names = MainController.get_bots_data().keys() if bot_name in bot_names: return False return True
def is_worker_name_valid(worker_name): worker_names = MainController.get_workers_data().keys() # Check that the name is unique if worker_name in worker_names: return False return True