From 8f3bc6115f83359039a1bad432ebe098e84f0701 Mon Sep 17 00:00:00 2001 From: Phaeton <808865+Phaeton@users.noreply.github.com> Date: Sat, 8 Feb 2025 14:06:31 -0500 Subject: [PATCH] linting --- scripts/export_categories.py | 10 ++++---- scripts/update_readme.py | 45 ++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/scripts/export_categories.py b/scripts/export_categories.py index a9a43b68..0e43dbac 100644 --- a/scripts/export_categories.py +++ b/scripts/export_categories.py @@ -1,4 +1,4 @@ -""""script to export current categories, this time sorted descending by frequency""" +""" "script to export current categories, sorted descending by frequency""" import logging import pandas as pd @@ -11,11 +11,13 @@ logging.info("Reading the main csv file...") df = pd.read_csv("plane-alert-db.csv") - logging.info("Sorting categories by frequency...") - category_sorted = df["Category"].value_counts().index.to_series().reset_index(drop=True) + logging.info("Identifying and sorting categories by frequency...") + category_sorted = ( + df["Category"].value_counts().index.to_series().reset_index(drop=True) + ) logging.info(f"Total Unique Categories: ({category_sorted.shape[0]}).") - logging.info("Creating the plane-alert-categories.csv file sorted by frequency.") + logging.info("Creating the plane-alert-categories.csv file, sorted by frequency.") category_sorted.to_csv( "plane-alert-categories.csv", diff --git a/scripts/update_readme.py b/scripts/update_readme.py index fcb96d0f..d91f92a9 100644 --- a/scripts/update_readme.py +++ b/scripts/update_readme.py @@ -1,5 +1,4 @@ -"""Script that performs several counts to update the README -""" +"""Script that performs several counts to update the README""" import logging import pandas as pd @@ -20,23 +19,13 @@ images_df = pd.read_csv("plane_images.csv") logging.info("All csv files read successfully.") - plane_count_df = ( - df["$ICAO"] - .drop_duplicates() - .reset_index(drop=True) - ) + plane_count_df = df["$ICAO"].drop_duplicates().reset_index(drop=True) logging.info(f"Total Planes Count: ({plane_count_df.shape[0]}).") - category_unique_df = ( - df["Category"] - .drop_duplicates() - .reset_index(drop=True) - ) + category_unique_df = df["Category"].drop_duplicates().reset_index(drop=True) logging.info(f"Total Categories Count: ({category_unique_df.shape[0]}).") - category_df = df["Category"].reset_index( - drop=False - ) + category_df = df["Category"].reset_index(drop=False) logging.info("Generating Counts to update README.md via mustache template.") @@ -102,7 +91,9 @@ "flying_doctors_count": category_df[ category_df["Category"] == "Flying Doctors" ].shape[0], - "gaf_count": category_df[category_df["Category"] == "GAF"].shape[0], + "gaf_count": category_df[ + category_df["Category"] == "GAF" + ].shape[0], "gas_bags_count": category_df[ category_df["Category"] == "Gas Bags" ].shape[0], @@ -142,7 +133,9 @@ "psa_count": category_df[ category_df["Category"] == "Perfectly Serviceable Aircraft" ].shape[0], - "pia_count": category_df[category_df["Category"] == "PIA"].shape[0], + "pia_count": category_df[ + category_df["Category"] == "PIA" + ].shape[0], "police_forces_count": category_df[ category_df["Category"] == "Police Forces" ].shape[0], @@ -158,7 +151,9 @@ "radiohead_count": category_df[ category_df["Category"] == "Radiohead" ].shape[0], - "raf_count": category_df[category_df["Category"] == "RAF"].shape[0], + "raf_count": category_df[category_df[ + "Category"] == "RAF" + ].shape[0], "royal_aircraft_count": category_df[ category_df["Category"] == "Royal Aircraft" ].shape[0], @@ -171,20 +166,24 @@ "special_forces_count": category_df[ category_df["Category"] == "Special Forces" ].shape[0], - "uav_count": category_df[category_df["Category"] == "UAV"].shape[0], + "uav_count": category_df[ + category_df["Category"] == "UAV" + ].shape[0], "uk_police_count": category_df[ category_df["Category"] == "UK National Police Air Service" ].shape[0], - "ukraine_count": category_df[category_df["Category"] == "Ukraine"].shape[0], + "ukraine_count": category_df[ + category_df["Category"] == "Ukraine" + ].shape[0], "us_marines_count": category_df[ category_df["Category"] == "United States Marine Corps" ].shape[0], "us_navy_count": category_df[ category_df["Category"] == "United States Navy" ].shape[0], - "usaf_count": category_df[category_df["Category"] == "USAF"].shape[ - 0 - ], + "usaf_count": category_df[ + category_df["Category"] == "USAF" + ].shape[0], "vanity_plate_count": category_df[ category_df["Category"] == "Vanity Plate" ].shape[0],