diff --git a/Cogs/ampa.py b/Cogs/ampa.py index 93802af6..635c4167 100644 --- a/Cogs/ampa.py +++ b/Cogs/ampa.py @@ -64,7 +64,8 @@ def check(m): logger.error(f"An error occurred: {e}") await ctx.send(f"An error occurred: {e}") - def list_files(self, search_path: str = ".") -> list: + @staticmethod + def list_files(search_path: str = ".") -> list: """List all file paths in the given directory and its subdirectories, ignoring package and cache files.""" file_paths = [] ignore_patterns = [ @@ -100,7 +101,8 @@ def list_files(self, search_path: str = ".") -> list: return file_paths - async def send_file_to_user(self, user: discord.User, file_path: str): + @staticmethod + async def send_file_to_user(user: discord.User, file_path: str): """Send a file to the specified user via DM, handling size limitations.""" try: filename = os.path.basename(file_path) diff --git a/Cogs/anime.py b/Cogs/anime.py index 6256635d..e6443ddd 100644 --- a/Cogs/anime.py +++ b/Cogs/anime.py @@ -299,7 +299,8 @@ async def update_embed(self): return embed - def get_image_url(self, images): + @staticmethod + def get_image_url(images): size_order = ["large", "medium", "small"] for size in size_order: image_url = images.get("jpg", {}).get(f"{size}_image_url") @@ -483,7 +484,8 @@ async def update_embed(self): return embed - def get_image_url(self, images): + @staticmethod + def get_image_url(images): size_order = ["large", "medium", "small"] for size in size_order: image_url = images.get("jpg", {}).get(f"{size}_image_url") diff --git a/Cogs/help.py b/Cogs/help.py index 2945ab5d..57059864 100644 --- a/Cogs/help.py +++ b/Cogs/help.py @@ -378,7 +378,8 @@ def _draw_text(self, draw, text_x, text_y): fill=self.base_font_color, ) - def _download_image(self, url): + @staticmethod + def _download_image(url): """Download an image from a URL.""" response = requests.get(url) response.raise_for_status() # Ensure we notice bad responses @@ -512,7 +513,8 @@ def _load_resources(self): self._resize_character() - def _download_image(self, url): + @staticmethod + def _download_image(url): """Download an image from a URL and return it as a PIL Image.""" response = requests.get(url) response.raise_for_status() @@ -652,7 +654,8 @@ def _update_command_mapping(self): mapping[cog_name][cmd.name] = " " self._save_command_mapping(mapping) - def format_cog_commands(self, cog_name, cog_commands, command_mapping): + @staticmethod + def format_cog_commands(cog_name, cog_commands, command_mapping): embed = discord.Embed( title=f"Commands for {cog_name}", color=primary_color_value ) diff --git a/Cogs/information.py b/Cogs/information.py index 14fb8d40..bf8e42a7 100644 --- a/Cogs/information.py +++ b/Cogs/information.py @@ -69,7 +69,8 @@ async def about(self, ctx, id: Union[discord.Member, int, str] = None): embed = await self.get_information_embed(id, self.bot) await ctx.reply(embed=embed, mention_author=False) - async def get_information_embed(self, id, bot): + @staticmethod + async def get_information_embed(id, bot): if isinstance(id, discord.Member): return await Information_Embed.get_member_embed(bot, id) elif isinstance(id, int): diff --git a/Cogs/memo.py b/Cogs/memo.py index f770e7db..f60381ed 100644 --- a/Cogs/memo.py +++ b/Cogs/memo.py @@ -83,13 +83,15 @@ async def play_emoji_game(self, ctx): except asyncio.TimeoutError: await message.edit(embed=self.timeout_embed(), view=None) - def timeout_embed(self): + @staticmethod + def timeout_embed(): return discord.Embed( title="Time's Up...", description="||```You didn't click the emoji in time.```||", ) - def timestamp_gen(self, timestamp: int) -> str: + @staticmethod + def timestamp_gen(timestamp: int) -> str: dt = datetime.utcfromtimestamp(timestamp).replace(tzinfo=timezone.utc) formatted_timestamp = f"" return formatted_timestamp @@ -401,7 +403,8 @@ async def handle_error(self, interaction, error, title): """Handles errors and sends a custom embed.""" await error_custom_embed(self.bot, interaction, str(error), title=title) - async def validate_input(self, **kwargs): + @staticmethod + async def validate_input(**kwargs): """Validates input values to ensure they are not None or empty.""" for key, value in kwargs.items(): if value is None or value == "": diff --git a/Cogs/pokemon.py b/Cogs/pokemon.py index 18fb3a1d..9031e07a 100644 --- a/Cogs/pokemon.py +++ b/Cogs/pokemon.py @@ -101,7 +101,8 @@ def process_image(self, path, filename): } self.cache[filename] = metadata - def evaluate_image_quality(self, image): + @staticmethod + def evaluate_image_quality(image): """Evaluates image quality based on sharpness.""" sharpness = cv.Laplacian(image, cv.CV_64F).var() return sharpness @@ -123,7 +124,8 @@ def cross_match(self, descriptors, image, k=2): return best_match, max_accuracy - def evaluate_accuracy(self, matches): + @staticmethod + def evaluate_accuracy(matches): """Evaluates accuracy based on good matches.""" good_matches = sum( 1 @@ -321,7 +323,8 @@ async def download_image(self, session, pokemon_name, semaphore): f"Image for {pokemon_name} already exists, skipping download." ) - def remove_srgb_profile(self, img_path): + @staticmethod + def remove_srgb_profile(img_path): try: with Image.open(img_path) as img: img.save(img_path, icc_profile=None) @@ -329,7 +332,8 @@ def remove_srgb_profile(self, img_path): except Exception as e: logger.error(f"Error removing sRGB profile: {e}") - def ensure_correct_color_format(self, img): + @staticmethod + def ensure_correct_color_format(img): """ Convert image to RGB format. """ @@ -340,7 +344,8 @@ def ensure_correct_color_format(self, img): return cv2.cvtColor(img, cv2.COLOR_RGBA2RGB) return img - def download_file(self, url, filename): + @staticmethod + def download_file(url, filename): response = urlopen(url) with open(filename, "wb") as f: f.write(response.read()) @@ -1717,7 +1722,8 @@ async def show_evolutions(self, interaction: discord.Interaction): f"Error fetching Pokémon evolution chain: {str(e)}", ephemeral=True ) - async def get_pokemon_evolution_chain(self, pokemon_name): + @staticmethod + async def get_pokemon_evolution_chain(pokemon_name): async with aiohttp.ClientSession() as session: species_url = ( f"https://pokeapi.co/api/v2/pokemon-species/{pokemon_name.lower()}/" @@ -1784,8 +1790,9 @@ async def display_evolution_chain(self, chain): return embeds + @staticmethod async def determine_evolution_method( - self, current_pokemon, evolution_details, next_pokemon + current_pokemon, evolution_details, next_pokemon ): trigger = evolution_details.get("trigger", {}).get("name") item = evolution_details.get("item") @@ -2012,8 +2019,9 @@ def __init__( def get_flag(self, lang): return self.flag_mapping.get(lang) + @staticmethod def get_pokemon_description( - self, pokemon_id, file_path="Data/pokemon/pokemon_description.csv" + pokemon_id, file_path="Data/pokemon/pokemon_description.csv" ): try: with open(file_path, mode="r", encoding="utf-8") as csv_file: @@ -2030,8 +2038,9 @@ def get_pokemon_description( return f"An error occurred: {e}" return "Pokémon ID not found" + @staticmethod def get_pokemon_region( - self, pokemon_id, file_path="Data/pokemon/pokemon_description.csv" + pokemon_id, file_path="Data/pokemon/pokemon_description.csv" ): try: with open(file_path, mode="r", encoding="utf-8") as csv_file: @@ -2305,7 +2314,8 @@ async def get_pokemon_moves(self): ) return moves_data - async def fetch_move_details(self, move_url): + @staticmethod + async def fetch_move_details(move_url): response = requests.get(move_url) if response.status_code == 200: move_data = response.json() diff --git a/Cogs/quest.py b/Cogs/quest.py index 8c9439c1..56b05ed6 100644 --- a/Cogs/quest.py +++ b/Cogs/quest.py @@ -397,7 +397,8 @@ async def shop(self, ctx): except Exception as e: await ctx.send(f"An error occurred while processing the shop: {e}") - def read_shop_file(self, filename): + @staticmethod + def read_shop_file(filename): with open(filename, "r", encoding="utf-8") as file: shop_data = json.load(file) return shop_data @@ -1029,7 +1030,8 @@ def _draw_text(self, draw, text_x, text_y): fill=self.base_font_color, ) - def _download_image(self, url): + @staticmethod + def _download_image(url): """Download an image from a URL.""" try: response = requests.get(url) @@ -1084,7 +1086,8 @@ def __init__(self, bot): async def handle_error(self, interaction, error, title): await error_custom_embed(self.bot, interaction, str(error), title=title) - async def validate_input(self, **kwargs): + @staticmethod + async def validate_input(**kwargs): for key, value in kwargs.items(): if value is None or value == "": raise ValueError(f"{key} cannot be None or empty") @@ -2669,7 +2672,8 @@ async def start(self, ctx): except Exception as e: await self.handle_error(ctx, e) - async def handle_error(self, interaction, exception): + @staticmethod + async def handle_error(interaction, exception): traceback_msg = "".join( traceback.format_exception( type(exception), exception, exception.__traceback__ diff --git a/Cogs/system.py b/Cogs/system.py index 1bd382be..b1e36575 100644 --- a/Cogs/system.py +++ b/Cogs/system.py @@ -22,7 +22,8 @@ def __init__(self, bot): self.memory_check.start() self.image_file = "Data/commands/help/help_embed_images.json" - async def get_latest_python_version(self): + @staticmethod + async def get_latest_python_version(): latest_version = ( subprocess.check_output( [ @@ -81,7 +82,8 @@ async def ping(self, ctx): logger.error( f"[System cog] Error occurred while sending ping embed: {e}") - def cog_unload(self): + @staticmethod + def cog_unload(): logger.info(f"{Fore.RED}[System cog] Unloaded{Style.RESET_ALL}") @commands.command(name="uptime") @@ -117,7 +119,8 @@ def optimize_memory(self): self.bot._connection.clear() print(f"Optimized memory. Garbage collected: {collected} objects.") - def log_memory_usage(self): + @staticmethod + def log_memory_usage(): """Logs the bot's current memory usage.""" process = psutil.Process(os.getpid()) memory_info = process.memory_info() @@ -141,7 +144,8 @@ async def memory_info(self, ctx): memory_usage = self.get_memory_usage() await ctx.send(f"Current memory usage: {memory_usage:.2f} MB") - def get_memory_usage(self): + @staticmethod + def get_memory_usage(): """Returns the current memory usage of the bot.""" process = psutil.Process(os.getpid()) memory_info = process.memory_info() diff --git a/Data/pokemon/dataset.py b/Data/pokemon/dataset.py index c3e61e67..d2324ead 100644 --- a/Data/pokemon/dataset.py +++ b/Data/pokemon/dataset.py @@ -44,7 +44,8 @@ def __init__(self, db_file='Data/pokemon/pokemon_images.db', processed_file='Dat print(f"Initializing processed entries database at {self.processed_file}...") self._init_processed_db() - def _db_connect(self, db_name): + @staticmethod + def _db_connect(db_name): return sqlite3.connect(db_name) def _init_db(self): @@ -183,15 +184,18 @@ def _process_image(self, image_path): print(f"Error processing image {image_path}: {e}") return None - def serialize_keypoints(self, keypoints): + @staticmethod + def serialize_keypoints(keypoints): """Convert cv2.KeyPoint objects to a serializable format.""" return [{'pt': kp.pt, 'size': kp.size, 'angle': kp.angle, 'response': kp.response, 'octave': kp.octave, 'class_id': kp.class_id} for kp in keypoints] - def deserialize_keypoints(self, serialized_keypoints): + @staticmethod + def deserialize_keypoints(serialized_keypoints): """Convert serialized keypoints back to cv2.KeyPoint objects.""" return [cv2.KeyPoint(kp['pt'][0], kp['pt'][1], kp['size'], kp['angle'], kp['response'], kp['octave'], kp['class_id']) for kp in serialized_keypoints] - def _clear_console(self): + @staticmethod + def _clear_console(): os.system("cls" if os.name == "nt" else "clear") def _get_cache_items(self): diff --git a/Events/appearance.py b/Events/appearance.py index 45f88bf6..6e76c42d 100644 --- a/Events/appearance.py +++ b/Events/appearance.py @@ -178,7 +178,8 @@ async def update_grid_message(self, ctx, grid_index, total_pages): logger.error(f"An error occurred while updating grid message: {e}") raise - async def update_grid_reactions(self, message, grid_index, total_pages): + @staticmethod + async def update_grid_reactions(message, grid_index, total_pages): try: # Add reactions for image selection if there are any images if total_pages > 1: diff --git a/Events/code_logger.py b/Events/code_logger.py index 86511e26..1a635e3b 100644 --- a/Events/code_logger.py +++ b/Events/code_logger.py @@ -150,7 +150,8 @@ async def send_log_embed(self, message): await const.error_custom_embed(self.bot, None, e, title="Log Embed Error") # Method to send an embed message - async def send_embed(self, channel, title, description): + @staticmethod + async def send_embed(channel, title, description): embed = discord.Embed( title=title, description=description, @@ -163,13 +164,15 @@ async def send_embed(self, channel, title, description): await channel.send(embed=embed) # Method to send a file - async def send_file(self, channel, file_path, title, description): + @staticmethod + async def send_file(channel, file_path, title, description): with open(file_path, "w") as file: file.write(description) await channel.send(file=discord.File(file_path), content=f"**{title}**") # Method to get updated commands - async def get_updated_commands(self): + @staticmethod + async def get_updated_commands(): root_dir = os.getcwd() repo = Repo(root_dir) diff = repo.head.commit.diff(None) diff --git a/Events/poketwo_anti_thief.py b/Events/poketwo_anti_thief.py index 8a7e7342..1d5a871d 100644 --- a/Events/poketwo_anti_thief.py +++ b/Events/poketwo_anti_thief.py @@ -123,7 +123,8 @@ def __init__(self, bot, anti_thief=None): self.shiny_ping_phrase = load_ping_phrase() - def timestamp_gen(self, timestamp: int) -> str: + @staticmethod + def timestamp_gen(timestamp: int) -> str: dt = datetime.datetime.utcfromtimestamp(timestamp).replace(tzinfo=datetime.timezone.utc) return f'' @@ -279,14 +280,16 @@ async def process_congratulations(self, congrats_message, original_message, refe logger.error(f"Unexpected error in process_congratulations: {e}") traceback.print_exc() - async def allow_all_to_catch(self, message): + @staticmethod + async def allow_all_to_catch(message): embed = message.embeds[0] embed.description = "✅ Everyone may catch the Pokémon now! No restrictions." embed.color = 0x00FF00 await message.edit(embed=embed) logger.info("Everyone is allowed to catch the Pokémon now.") - async def timeout_user(self, user, message): + @staticmethod + async def timeout_user(user, message): BOT_TOKEN = os.getenv("TOKEN") GUILD_ID = message.guild.id USER_ID = user.id @@ -312,7 +315,8 @@ async def timeout_user(self, user, message): else: logger.error(f"Failed to timeout user {user.mention}: {response.status_code}") - async def delete_embed_on_catch(self, message): + @staticmethod + async def delete_embed_on_catch(message): try: await message.delete() logger.info("Embed deleted after successful catch.") diff --git a/Subcogs/information.py b/Subcogs/information.py index 735443ce..99dadbc0 100644 --- a/Subcogs/information.py +++ b/Subcogs/information.py @@ -124,7 +124,8 @@ def __init__(self, bot): self.afk_file_path = "Caster-Bot/Caster-main/afk_members.json" - async def fetch_invites(self, guild): + @staticmethod + async def fetch_invites(guild): return await guild.invites() async def update_invites(self, guild): @@ -156,13 +157,15 @@ async def get_inviter_mention(self, member): return inviter_mention - async def get_avatar_emoji(self, ctx, member): + @staticmethod + async def get_avatar_emoji(ctx, member): if member.bot: return "🤖" # Bot emoji else: return "👤" # Member emoji - def timestamp_gen(self, timestamp: int) -> str: + @staticmethod + def timestamp_gen(timestamp: int) -> str: dt = datetime.utcfromtimestamp(timestamp).replace(tzinfo=timezone.utc) formatted_timestamp = f"" return formatted_timestamp @@ -661,7 +664,8 @@ async def list_members(self, ctx, *, filter_option: str = None): await ctx.send(error_message) print(f"Error encountered: {traceback.format_exc()}") - def get_usage_guide(self): + @staticmethod + def get_usage_guide(): return ( "Usage: \n" ",members --filter \n" @@ -676,7 +680,8 @@ def get_usage_guide(self): "```" ) - def apply_filter(self, all_members, filter_option): + @staticmethod + def apply_filter(all_members, filter_option): if filter_option == FilterOption.NEWEST_TO_OLDEST.value: all_members = sorted( all_members, key=lambda member: member.joined_at, reverse=True @@ -747,7 +752,8 @@ async def create_member_embeds( return embeds - async def fetch_avatar_data(self, member): + @staticmethod + async def fetch_avatar_data(member): try: async with aiohttp.ClientSession() as session: async with session.get(str(member.avatar.with_size(128))) as resp: @@ -760,7 +766,8 @@ async def fetch_avatar_data(self, member): print(f"Error fetching avatar for {member.display_name}: {e}") return None - def concatenate_images(self, row_images): + @staticmethod + def concatenate_images(row_images): total_width = sum(img.width for img in row_images) max_height = max(img.height for img in row_images) concatenated_image = Image.new("RGB", (total_width, max_height)) @@ -775,8 +782,9 @@ def concatenate_images(self, row_images): temp_file.seek(0) # Reset the position of the file cursor return temp_file + @staticmethod def add_member_info_to_embed( - self, embed, member, emoji, joined_timestamp, filter_option + embed, member, emoji, joined_timestamp, filter_option ): # Add the member's display name and roles to the embed embed.add_field( diff --git a/storage/pokemon.py b/storage/pokemon.py index bb75b92b..6e88e4b5 100644 --- a/storage/pokemon.py +++ b/storage/pokemon.py @@ -121,7 +121,8 @@ def load_from_images(self): print(f"Images loaded in {time.time() - start_time:.2f} seconds") - def _find_image_inside_image(self, img, template): + @staticmethod + def _find_image_inside_image(img, template): img_gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) template_gray = cv.cvtColor(template, cv.COLOR_BGR2GRAY) @@ -231,7 +232,8 @@ def predict_pokemon(self, img): return "No Pokémon detected", round(time.time() - start_time, 2) - def load_image_from_url(self, url): + @staticmethod + def load_image_from_url(url): try: response = requests.get(url) response.raise_for_status() @@ -324,7 +326,8 @@ async def download_image(self, session, pokemon_name, semaphore): f"Image for {pokemon_name} already exists, skipping download." ) - def remove_srgb_profile(self, img_path): + @staticmethod + def remove_srgb_profile(img_path): try: with Image.open(img_path) as img: img.save(img_path, icc_profile=None) @@ -332,7 +335,8 @@ def remove_srgb_profile(self, img_path): except Exception as e: logger.error(f"Error removing sRGB profile: {e}") - def ensure_correct_color_format(self, img): + @staticmethod + def ensure_correct_color_format(img): """ Convert image to RGB format. """ @@ -343,7 +347,8 @@ def ensure_correct_color_format(self, img): return cv2.cvtColor(img, cv2.COLOR_RGBA2RGB) return img - def download_file(self, url, filename): + @staticmethod + def download_file(url, filename): response = urlopen(url) with open(filename, "wb") as f: f.write(response.read()) @@ -1581,7 +1586,8 @@ async def show_evolutions(self, interaction: discord.Interaction): f"Error fetching Pokémon evolution chain: {str(e)}", ephemeral=True ) - async def get_pokemon_evolution_chain(self, pokemon_name): + @staticmethod + async def get_pokemon_evolution_chain(pokemon_name): async with aiohttp.ClientSession() as session: species_url = ( f"https://pokeapi.co/api/v2/pokemon-species/{pokemon_name.lower()}/" @@ -1648,8 +1654,9 @@ async def display_evolution_chain(self, chain): return embeds + @staticmethod async def determine_evolution_method( - self, current_pokemon, evolution_details, next_pokemon + current_pokemon, evolution_details, next_pokemon ): trigger = evolution_details.get("trigger", {}).get("name") item = evolution_details.get("item") @@ -1876,8 +1883,9 @@ def __init__( def get_flag(self, lang): return self.flag_mapping.get(lang) + @staticmethod def get_pokemon_description( - self, pokemon_id, file_path="Data/pokemon/pokemon_description.csv" + pokemon_id, file_path="Data/pokemon/pokemon_description.csv" ): try: with open(file_path, mode="r", encoding="utf-8") as csv_file: @@ -1894,8 +1902,9 @@ def get_pokemon_description( return f"An error occurred: {e}" return "Pokémon ID not found" + @staticmethod def get_pokemon_region( - self, pokemon_id, file_path="Data/pokemon/pokemon_description.csv" + pokemon_id, file_path="Data/pokemon/pokemon_description.csv" ): try: with open(file_path, mode="r", encoding="utf-8") as csv_file: @@ -2169,7 +2178,8 @@ async def get_pokemon_moves(self): ) return moves_data - async def fetch_move_details(self, move_url): + @staticmethod + async def fetch_move_details(move_url): response = requests.get(move_url) if response.status_code == 200: move_data = response.json() diff --git a/storage/predict.py b/storage/predict.py index 11019bbd..1562c026 100644 --- a/storage/predict.py +++ b/storage/predict.py @@ -121,7 +121,8 @@ def cache_flipped_image(self, img, filename): descriptors # Store distances for future use ) - def compute_roi_density(self, img): + @staticmethod + def compute_roi_density(img): gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) density = cv.countNonZero(gray) / (gray.shape[0] * gray.shape[1]) return density @@ -190,7 +191,8 @@ async def predict_pokemon(self, img): # Changed to async return "No match found", time.time() - start_time - def load_image_from_url(self, url): + @staticmethod + def load_image_from_url(url): try: img = np.asarray( bytearray(requests.get(url).content), dtype=np.uint8) @@ -199,7 +201,8 @@ def load_image_from_url(self, url): print(f"Error fetching image from URL: {e}") return None - def evaluate_matches(self, matches, filename): + @staticmethod + def evaluate_matches(matches, filename): """Evaluate the matches and return the accuracy.""" if not matches: return 0 # No matches found, accuracy is 0 @@ -351,7 +354,8 @@ async def download_image(self, session, pokemon_name, semaphore): f"Image for {pokemon_name} already exists, skipping download." ) - def remove_srgb_profile(self, img_path): + @staticmethod + def remove_srgb_profile(img_path): try: with Image.open(img_path) as img: img.save(img_path, icc_profile=None) @@ -359,7 +363,8 @@ def remove_srgb_profile(self, img_path): except Exception as e: logger.error(f"Error removing sRGB profile: {e}") - def ensure_correct_color_format(self, img): + @staticmethod + def ensure_correct_color_format(img): """ Convert image to RGB format. """ @@ -370,7 +375,8 @@ def ensure_correct_color_format(self, img): return cv2.cvtColor(img, cv2.COLOR_RGBA2RGB) return img - def download_file(self, url, filename): + @staticmethod + def download_file(url, filename): response = urlopen(url) with open(filename, "wb") as f: f.write(response.read()) @@ -1779,7 +1785,8 @@ async def show_evolutions(self, interaction: discord.Interaction): f"Error fetching Pokémon evolution chain: {str(e)}", ephemeral=True ) - async def get_pokemon_evolution_chain(self, pokemon_name): + @staticmethod + async def get_pokemon_evolution_chain(pokemon_name): async with aiohttp.ClientSession() as session: species_url = ( f"https://pokeapi.co/api/v2/pokemon-species/{pokemon_name.lower()}/" @@ -1846,8 +1853,9 @@ async def display_evolution_chain(self, chain): return embeds + @staticmethod async def determine_evolution_method( - self, current_pokemon, evolution_details, next_pokemon + current_pokemon, evolution_details, next_pokemon ): trigger = evolution_details.get("trigger", {}).get("name") item = evolution_details.get("item") @@ -2074,8 +2082,9 @@ def __init__( def get_flag(self, lang): return self.flag_mapping.get(lang) + @staticmethod def get_pokemon_description( - self, pokemon_id, file_path="Data/pokemon/pokemon_description.csv" + pokemon_id, file_path="Data/pokemon/pokemon_description.csv" ): try: with open(file_path, mode="r", encoding="utf-8") as csv_file: @@ -2092,8 +2101,9 @@ def get_pokemon_description( return f"An error occurred: {e}" return "Pokémon ID not found" + @staticmethod def get_pokemon_region( - self, pokemon_id, file_path="Data/pokemon/pokemon_description.csv" + pokemon_id, file_path="Data/pokemon/pokemon_description.csv" ): try: with open(file_path, mode="r", encoding="utf-8") as csv_file: @@ -2367,7 +2377,8 @@ async def get_pokemon_moves(self): ) return moves_data - async def fetch_move_details(self, move_url): + @staticmethod + async def fetch_move_details(move_url): response = requests.get(move_url) if response.status_code == 200: move_data = response.json()