def main(): global todos nox = App.open("Nox App Player") with Region(nox.window()): lib.checkOK() lib.checkSkip() lib.reset() todos = dungeons.run(todos)
def main(): nox = App.open("Nox App Player") with Region(nox.window()): lib.checkOK() lib.reset() if not exists("1514949313948.png"): print("looking for auto") if exists("1514955626442.png"): print("hitting auto") click("1514955626442.png")
def main(): global todos nox = App.open("Nox App Player") with Region(nox.window()): lib.login() lib.checkOK() lib.checkSkip() lib.reset() if todos["temple"] or todos["summoning"]: todos = dungeons.run(todos) lib.reset() if exists("1515159000793.png"): click("1515159012057.png") if todos["sub"]: if exists("1515079317950.png"): print("claiming reward") click("1515079317950.png") todos = weeklys.sub(todos) if todos["daily"]: lib.reset() if exists("1514888901019-1.png"): click("1514888901019-1.png") if exists("1515047937858.png"): click("1515047937858.png") todos = acceptDailys(todos) if not todos["sub"] and not todos["temple"] and not todos["summoning"]: lib.reset() todos = weeklys.run(todos)
def main(): global todos nox = App.open("Nox App Player") with Region(nox.window()): if todos["sub"]: lib.checkOK() lib.checkSkip() lib.reset() if exists("1515079317950.png"): print("claiming reward") click("1515079317950.png") todos = weeklys.sub(todos)
def test_const_map_async(): def check_bin(meta, key, bins): assert("bin_1" in bins) assert("bin_2" in bins) lib.obj_spec_is_I1(bins["bin_1"]) lib.obj_spec_is_I1(bins["bin_2"] - 256) lib.reset() lib.upload_udf("test_module.lua", udf_module) # the UDF should eventually reach all 100 records, writing both "bin_1" and "bin_2" lib.run_benchmark("--duration 1 --workload RUF,0,0 -upn test_module " + "-ufn read_object -ufv \"{\\\"write_bin_1\\\":b,\\\"random_value\\\":I1}\" " + "--start-key 0 --keys 100 --random --async", do_reset=False) lib.check_for_range(0, 100, check_bin)
def test_const_fixed_map(): prev_bin_1 = -1 def check_bin(meta, key, bins): nonlocal prev_bin_1 assert("bin_1" in bins) lib.obj_spec_is_I1(bins["bin_1"]) if prev_bin_1 == -1: prev_bin_1 = bins["bin_1"] else: assert(bins["bin_1"] == prev_bin_1) lib.reset() lib.upload_udf("test_module.lua", udf_module) # the UDF should eventually reach all 100 records, writing both "bin_1" and "bin_2" lib.run_benchmark("--duration 1 --workload RUF,0,0 -upn test_module " + "-ufn read_object -ufv \"{\\\"write_bin_1\\\":true,\\\"random_value\\\":I1}\" " + "--start-key 0 --keys 100 -z 1", do_reset=False) lib.check_for_range(0, 100, check_bin)
def backup_and_restore(fill, check, node_lists): """ Do one backup-restore cycle. """ lib.start() try: fill() paths = [] for node_list in node_lists: argument = ",".join([host + ":" + str(port) for host, port in node_list]) if lib.is_dir_mode(): path = lib.temporary_path("dir") lib.backup_to_directory(path, "--node-list", argument) else: path = lib.temporary_path("asb") lib.backup_to_file(path, "--node-list", argument) paths.append(path) lib.reset() for path in paths: if lib.is_dir_mode(): lib.restore_from_directory(path) else: lib.restore_from_file(path) check() except Exception: lib.stop(True) raise else: lib.stop()
def screenGPIO(): # set up the window screen=lib.setupwindow() # Fill background background = pygame.Surface(screen.get_size()) background = background.convert() background.fill(WHITE) # Set up forms box1 = pygame.draw.rect(background, YELLOW,(0, 0, 80, 80)) box2 = pygame.draw.rect(background, BLACK,(80, 0, 80, 80)) box3 = pygame.draw.rect(background, BLUE, (160, 0, 80, 80)) box4 = pygame.draw.rect(background, GREEN, (240, 0, 80, 80)) box5 = pygame.draw.rect(background, MAGENTA,(0, 80, 80, 80)) # box6 = pygame.draw.rect(background, RED,(80, 80, 80, 80)) # box7 = pygame.draw.rect(background, CYAN, (160, 80, 80, 80)) # box8 = pygame.draw.rect(background, BLACK, (240, 80, 80, 80)) # box9 = pygame.draw.rect(background, GREEN,(80, 160, 80, 80)) # box10 = pygame.draw.rect(background, BLUE, (160, 160, 80, 80)) # box11 = pygame.draw.rect(background, CYAN, (240, 160, 80, 80)) cir = pygame.draw.circle(background, BLACK, (22, 219), 20) # Display some text font = pygame.font.Font(None, 20) GPIO24 = font.render("GPIO 24", 1, (BLACK)) GPIO23 = font.render("GPIO 23", 1, (RED)) GPIO22 = font.render("GPIO 22",1, (YELLOW)) GPIO21 = font.render("GPIO 21",1, (BLACK)) GPIO4 = font.render("GPIO 4",1, (BLACK)) # GPIO21 = font.render("GPIO 21",1,(YELLOW)) # GPIO10 = font.render("GPIO 10",1,(BLACK)) # GPIO9 = font.render("GPIO 9 ",1,(BLACK)) # GPIO11 = font.render("GPIO 11",1,(BLACK)) # GPIO0 = font.render("GPIO 0",1,(BLACK)) # GPIO1 = font.render("GPIO 1",1,(BLACK)) text3 = font.render("<<",1, (YELLOW)) #text = pygame.transform.rotate(text,270) textpos = GPIO24.get_rect(center=(40,40)) textpos2= GPIO23.get_rect(center=(120,40)) textpos5= GPIO22.get_rect(center=(200,40)) textpos6= GPIO21.get_rect(center=(280,40)) textpos3= GPIO4.get_rect(center=(40,120)) #textpos7= GPIO21.get_rect(center=(120,120)) #textpos8= GPIO10.get_rect(center=(200,120)) #textpos9= GPIO9.get_rect(center=(280,120)) # textpos10= GPIO11.get_rect(center=(40,200)) # textpos11= GPIO0.get_rect(center=(120,200)) # textpos12= GPIO1.get_rect(center=(200,200)) textpos4= text3.get_rect(center=(21,215)) background.blit(GPIO24, textpos) background.blit(GPIO23, textpos2) background.blit(GPIO22, textpos5) background.blit(GPIO21, textpos6) background.blit(GPIO4, textpos3) # background.blit(GPIO21,textpos7) # background.blit(GPIO10,textpos8) # background.blit(GPIO9,textpos9) # background.blit(GPIO11,textpos10) # background.blit(GPIO0,textpos11) # background.blit(GPIO1,textpos12) background.blit(text3, textpos4) screen.blit(background, (0, 0)) pygame.display.flip() running = True #State of GPIO state18=0 state16=0 state15=0 state13=0 state7=0 state13=0 state19=0 state21=0 state23=0 state3=0 state5=0 # run the game loop while running: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() running = False elif event.type == pygame.MOUSEBUTTONDOWN: # 4 top buttons if box1.collidepoint(pygame.mouse.get_pos()): state18=lib.SRGPIO(state18,18) if box2.collidepoint(pygame.mouse.get_pos()): state16=lib.SRGPIO(state16,16) if box3.collidepoint(pygame.mouse.get_pos()): state15=lib.SRGPIO(state15,15) if box4.collidepoint(pygame.mouse.get_pos()): state13=lib.SRGPIO(state13,13) # # 4 middle buttons if box5.collidepoint(pygame.mouse.get_pos()): state7=lib.SRGPIO(state7,7) # if box21.collidepoint(pygame.mouse.get_pos()): # state13=lib.SRGPIO(state13,13) # if box2.collidepoint(pygame.mouse.get_pos()): # state21=lib.SRGPIO(state21,21) # if box5.collidepoint(pygame.mouse.get_pos()): # state19=lib.SRGPIO(state19,19) # # # 4 bottom button # if box4.collidepoint(pygame.mouse.get_pos()): # state23=lib.SRGPIO(state23,23) # if box6.collidepoint(pygame.mouse.get_pos()): # state3=lib.SRGPIO(state3,3) # if box9.collidepoint(pygame.mouse.get_pos()): # state5=lib.SRGPIO(state5,5) # back to screenMain if cir.collidepoint(pygame.mouse.get_pos()): lib.reset(18,16) screenMain() elif event.type == KEYDOWN and event.key == K_ESCAPE: running = False pygame.display.update()