def remap_wrapper(): if skin_list.value is not None and joy_list.value is not None: screen = pygame.display.get_surface() size, flags = screen.get_size(), screen.get_flags() mapper.main(skin_list.value, joy_list.value) pygame.display.set_mode(size, flags) app.repaint()
def main(skin, joy_index): pygame.display.init() pygame.joystick.init() joy = pygame.joystick.Joystick(joy_index) joy.init() mappings = configurator.load_mappings(skin) if joy.get_name() not in mappings: mapper.main(skin, joy_index) visualizer.main(skin, joy_index)
def lambda_handler(event, context): connection_id = event["connectionId"] location = event['location'] distance = int(event['distance']) tripLength = int(event['tripLength']) trip = mapper.main(location, distance, tripLength) json_trip = trip.save_geojson(mapper.Path) send_to_wh(connection_id, json_trip) return { 'statusCode': 200, }
import mapper mapper.main()
def test_1(self): self.assertEqual(mapper.main(), None)
import mapper import reducer import os WORKING_DIR = os.path.dirname(__file__) IN_FILE = os.path.join(WORKING_DIR, "..", "data", "training.txt") EVALUATE_SCRIPT = os.path.join(WORKING_DIR, "evaluate.py") str = open(IN_FILE).readlines() stream = mapper.main(str) # #print stream # output = reducer.main(stream) # WEIGHTS_PATH = os.path.join(WORKING_DIR, "weights.txt") with open(WEIGHTS_PATH, 'w') as weight_f: weight_f.write(output) # #print output # Usage: evaluate.py weights.txt # test_data.txt test_labels.txt folder_with_mapper command_line = ["python", EVALUATE_SCRIPT] command_line.append(WEIGHTS_PATH) command_line.append(os.path.join(WORKING_DIR, "test_data.txt")) command_line.append(os.path.join(WORKING_DIR, "test_labels.txt")) command_line.append(WORKING_DIR) command_line = " ".join(command_line) print command_line
def test_mapper(self): with open('test/input/file1.txt','r') as in_f: with open('test/output_mapper.txt','w') as out_f: mapper.main(InputFile = in_f,OutputFile=out_f)
import mapper import reducer import os WORKING_DIR = os.path.dirname(__file__) IN_FILE = os.path.join(WORKING_DIR, "..", "data", "training.txt") EVALUATE_SCRIPT = os.path.join(WORKING_DIR, "evaluate.py") str = open(IN_FILE).readlines() stream = mapper.main(str) # #print stream # output = reducer.main(stream) # WEIGHTS_PATH = os.path.join(WORKING_DIR, "weights.txt") with open(WEIGHTS_PATH, "w") as weight_f: weight_f.write(output) # #print output # Usage: evaluate.py weights.txt # test_data.txt test_labels.txt folder_with_mapper command_line = ["python", EVALUATE_SCRIPT] command_line.append(WEIGHTS_PATH) command_line.append(os.path.join(WORKING_DIR, "test_data.txt")) command_line.append(os.path.join(WORKING_DIR, "test_labels.txt")) command_line.append(WORKING_DIR)