def test_make_map_from_repo(self): """Unit test for make_map() with a number greater than 100 of contributors and using a repo URL.""" make_map(repo="www.github.com/iqtlabs/gitgeo", num=200) # identify and delete map file created for test files = glob.glob("results/*.html") test_file = max(files, key=os.path.getctime) os.remove(test_file)
def update_map(dataset, selected_LA, surgery_switch, iomd_decile): if surgery_switch == 'on': print('Switching on GP Surgery Points') surgery_data, missing_postcodes = gp_coords_from_LA(selected_LA) print(missing_postcodes) elif surgery_switch == 'off': print('Switching off GP Surgery Points') surgery_data = None if dataset == 'IoMD Decile': iomd_decile = None if iomd_decile == 'None' else iomd_decile if iomd_decile is not None: iomd_decile = int(iomd_decile) selected_LSOA_data, selected_iomd_df = filter_LSOAs_by_decile( selected_LA, LSOA_data, iomd_df, iomd_decile) else: selected_LSOA_data, selected_LSOA_df = LA_to_LSOA( selected_LA, LSOA_data) selected_iomd_df = LSOA_to_IoMD(selected_LSOA_data, iomd_df) fig = make_map(selected_LSOA_data, selected_iomd_df, 'imd_decile', LA_name=selected_LA, LA_data=LA_data, surgery_data=surgery_data) elif dataset == 'IoMD Rank': selected_LSOA_data, selected_LSOA_df = LA_to_LSOA( selected_LA, LSOA_data) selected_iomd_df = LSOA_to_IoMD(selected_LSOA_data, iomd_df) fig = make_map(selected_LSOA_data, selected_iomd_df, 'imd_rank', LA_name=selected_LA, LA_data=LA_data, surgery_data=surgery_data) elif dataset == 'LSOA': selected_LSOA_data, selected_LSOA_df = LA_to_LSOA( selected_LA, LSOA_data) fig = make_map(selected_LSOA_data, selected_LSOA_df, 'color', LA_name=selected_LA, LA_data=LA_data, surgery_data=surgery_data) else: selected_LSOA_data, selected_LSOA_df = LA_to_LSOA( selected_LA, LSOA_data) fig = make_map(selected_LSOA_data, selected_LSOA_df, 'color', LA_name=selected_LA, LA_data=LA_data, surgery_data=surgery_data) return fig
def test_make_map_from_csv(self): """Unit test for make_map() using a csv created by multirepo_scan.""" make_map(csv="test_multirepo.csv") files = glob.glob("results/*.html") test_file = max(files, key=os.path.getctime) os.remove(test_file)
def main(): screen_width = 80 screen_height = 50 #map definition map_width = 80 map_height = 45 room_max_size = 10 room_min_size = 6 max_rooms = 30 max_monsters_per_room = 3 #FOV configuration fov_algorithm = 'BASIC' fov_light_walls = True fov_radius = 10 #color list colors = { 'dark_wall': (0, 0, 100), 'dark_ground': (50, 50, 150), 'light_wall': (130, 110, 50), 'light_ground': (200, 180, 50), 'dark_brown': (51, 25, 0), 'slate_gray': (112, 128, 144), 'crimson': (220, 20, 60) } #end definition tdl.set_font('arial10x10.png', greyscale=True, altLayout=True) fighter_component = Fighter(hp=30, defense=2, power=5) player = Entity(0, 0, '@', (255, 255, 255), 'Player', blocks=True, fighter=fighter_component) entities = [player] root_console = tdl.init( screen_width, screen_height, title='Roguelike Tutorial With extra Elbow Grease.') con = tdl.Console(screen_width, screen_height) game_map = GameMap(map_width, map_height) # make_map(game_map) make_map(game_map, max_rooms, room_min_size, room_max_size, map_width, map_height, player, entities, max_monsters_per_room, colors) fov_recompute = True game_state = GameStates.PLAYERS_TURN while not tdl.event.is_window_closed(): if fov_recompute: game_map.compute_fov(player.x, player.y, fov=fov_algorithm, radius=fov_radius, light_walls=fov_light_walls) render_all(con, entities, game_map, fov_recompute, root_console, screen_width, screen_height, colors) tdl.flush() clear_all(con, entities) fov_recompute = False for event in tdl.event.get(): if event.type == 'KEYDOWN': user_input = event break else: user_input = None if not user_input: continue action = handle_keys(user_input) move = action.get('move') bye = action.get('exit') fullscreen = action.get('fullscreen') player_turn_results = [] if move and game_state == GameStates.PLAYERS_TURN: dx, dy = move destination_x = player.x + dx destination_y = player.y + dy if game_map.walkable[destination_x, destination_y]: target = get_blocking_entities_at_location( entities, destination_x, destination_y) if target: # player.fighter.attack(target) attack_results = player.fighter.attack(target) player_turn_results.extend(attack_results) else: player.move(dx, dy) fov_recompute = True game_state = GameStates.ENEMY_TURN if game_state == GameStates.ENEMY_TURN: for entity in entities: if entity.ai: # entity.ai.take_turn(player,game_map, entities) enemy_turn_results = entity.ai.take_turn( player, game_map, entities) for enemy_turn_result in enemy_turn_results: message = enemy_turn_result.get('message') dead_entity = enemy_turn_result.get('dead') if message: print(message) if dead_entity: pass else: game_state = GameStates.PLAYERS_TURN if bye: return True if fullscreen: tdl.set_fullscreen(not tdl.get_fullscreen()) for player_turn_result in player_turn_results: message = player_turn_result.get('message') dead_entity = player_turn_result.get('dead') if message: print(message) if dead_entity: pass # We'll do something here momentarily
dbc.Row([ dbc.Col( html.Div(children=[ html. H4(children= 'Choose a local authority from the dropdown or select on the map', style={'padding-bottom': '40px'}), dcc.Dropdown(id='LA-dropdown', options=[{ 'label': k, 'value': k } for k in LA_list], value='LA', style={'color': '#A9A9A9'}), dcc.Graph(id='main-map', figure=make_map( LA_data, LA_df, 'color', show_scalebar=False), style={'padding-top': '70px'}), ]), ), dbc.Col( html.Div(children=[ html.H4(children='Select a dataset'), dcc.RadioItems(id='dataset-radio', options=[{ 'label': k, 'value': k } for k in datasets], value='IoMD Decile', labelStyle={ 'display': 'inline-block', 'padding': '5px' },
null """ repo_ending_string = extract_github_owner_and_repo(repo) contributors = get_contributors(repo_ending_string, num) print("-----------------") print("GITHUB REPO: {}".format(repo_ending_string)) print("-----------------") if summary: print_by_country(contributors) else: print_by_contributor(repo_ending_string, contributors, output_csv) if __name__ == "__main__": # pragma: no cover args = parse_arguments() if args.package: scan_single_package(args.package, args.summary, args.num) elif args.repo: if args.map: make_map(repo=args.repo, num=args.num) else: scan_single_repo(args.repo, args.summary, args.output_csv, args.num) elif args.multirepo: scan_multiple_repos(num=args.num) elif args.multirepo_map: make_map(csv=args.multirepo_map)