From 01c59b3e3d15cb57248d083f5e9b351135a63f80 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 14 Oct 2024 15:59:20 +0100 Subject: [PATCH] - Have default forms passed through to the bulbapedia parser --- DataGatherers/DetermineOriginGame.py | 7 ++++++- DataGatherers/update_location_information.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/DataGatherers/DetermineOriginGame.py b/DataGatherers/DetermineOriginGame.py index ea306b4..f4c8217 100644 --- a/DataGatherers/DetermineOriginGame.py +++ b/DataGatherers/DetermineOriginGame.py @@ -547,7 +547,7 @@ def compare_forms(a, b): return False -def get_locations_from_bulbapedia(pokemon_name, form, cache: CacheManager): +def get_locations_from_bulbapedia(pokemon_name, form, cache: CacheManager, default_forms = None): page_data = get_pokemon_data_bulbapedia(pokemon_name, cache) if not page_data: return None @@ -635,8 +635,13 @@ def get_locations_from_bulbapedia(pokemon_name, form, cache: CacheManager): for raw_location in raw_locations: raw_text = raw_location.get_text() main_form, sub_form = parse_form_information(str(raw_location)) + + if default_forms and main_form and main_form in default_forms: + main_form = None + if main_form and (main_form != "All Forms" and main_form != "Kantonian Form"): continue + if raw_game not in game_locations: game_locations[raw_game] = [] info = {} diff --git a/DataGatherers/update_location_information.py b/DataGatherers/update_location_information.py index 599c184..92b5d56 100644 --- a/DataGatherers/update_location_information.py +++ b/DataGatherers/update_location_information.py @@ -287,7 +287,7 @@ if __name__ == "__main__": encounters_to_ignore = ["trade", "time capsule", "unobtainable", "evolve", "tradeversion", "poké transfer", "friend safari", "unavailable", "pokémon home"] - encounter_data = get_locations_from_bulbapedia(name, search_form, cache) + encounter_data = get_locations_from_bulbapedia(name, search_form, cache, default_forms) if encounter_data == None: continue