From 68ff368f9ab17ba8b09b4a4c47d27d515b82a74e Mon Sep 17 00:00:00 2001 From: Pratyush Venkatakrishnan Date: Sat, 30 Nov 2024 15:49:24 -0500 Subject: [PATCH] Run Black --- scrapers/package.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scrapers/package.py b/scrapers/package.py index 27be513..6c259b2 100644 --- a/scrapers/package.py +++ b/scrapers/package.py @@ -17,6 +17,7 @@ import json import utils + def load_json_data(jsonfile): """ Loads data from the provided file @@ -27,16 +28,17 @@ def load_json_data(jsonfile): Returns: * any: The data contained within the file """ - with open(jsonfile, mode = "r", encoding = "utf-8") as f: + with open(jsonfile, mode="r", encoding="utf-8") as f: return json.load(f) + def merge_data(datasets, keys_to_keep): """ Combines the provided datasets, retaining only keys from keys_to_keep. NOTE: Later datasets will override earlier ones Args: - * datasets (iterable[dict[any, dict]]): + * datasets (iterable[dict[any, dict]]): * keys_to_keep (iterable): The keys to retain in the output Returns: @@ -49,6 +51,7 @@ def merge_data(datasets, keys_to_keep): result[key].update(dataset[key]) return result + def run(): """ The main entry point. @@ -63,8 +66,8 @@ def run(): # If it's not in Fireroad, we don't have its schedule. # If it's not in catalog, it's not offered this semester. courses = merge_data( - datasets = [fireroad, catalog, overrides], - keys_to_keep = set(fireroad) & set(catalog) + datasets=[fireroad, catalog, overrides], + keys_to_keep=set(fireroad) & set(catalog), ) term_info = utils.get_term_info() @@ -75,7 +78,7 @@ def run(): "classes": courses, } - with open("../public/latest.json", mode = "w", encoding = "utf-8") as f: + with open("../public/latest.json", mode="w", encoding="utf-8") as f: json.dump(obj, f, separators=(",", ":")) print(f"Got {len(courses)} courses")