Skip to content

The definitive list of the best of (consumer facing) open source.

Pointed script to new directory for data

Lucas58bd427b2873
diff --git a/core/source/generation/contents_generator.py b/core/source/generation/contents_generator.py
index 601359c..bdc93c8 100644
--- a/core/source/generation/contents_generator.py
+++ b/core/source/generation/contents_generator.py
@@ -41,13 +41,13 @@ def format_stars(n):
def generate_contents(platform="all"):
- with open("core/data/static/categories.json", "r", encoding="utf-8") as f:
+ with open("../../data/static/categories.json", "r", encoding="utf-8") as f:
cat_data = json.load(f)
- with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as f:
+ with open("../../data/dynamic/applications.json", "r", encoding="utf-8") as f:
app_data = json.load(f)
- with open("core/data/static/tags.json", "r", encoding="utf-8") as f:
+ with open("../../data/static/tags.json", "r", encoding="utf-8") as f:
tags_data = json.load(f)
- with open("core/data/static/platforms.json", "r", encoding="utf-8") as f:
+ with open("../../data/static/platforms.json", "r", encoding="utf-8") as f:
platforms_data = json.load(f)
categories = cat_data.get("categories", [])
diff --git a/core/source/generation/mainheader_generator.py b/core/source/generation/mainheader_generator.py
index 5d851c2..caf4b31 100644
--- a/core/source/generation/mainheader_generator.py
+++ b/core/source/generation/mainheader_generator.py
@@ -2,7 +2,7 @@ import json
# Generates mainheader with dynamic project count
def generate_mainheader():
- with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as f:
+ with open("../../data/dynamic/applications.json", "r", encoding="utf-8") as f:
data = json.load(f)
project_count = len(data.get("applications", []))
diff --git a/core/source/maintenance/json_formatter.py b/core/source/maintenance/json_formatter.py
index d541da8..fffbc3e 100644
--- a/core/source/maintenance/json_formatter.py
+++ b/core/source/maintenance/json_formatter.py
@@ -1,13 +1,13 @@
import json
-with open("core/data/dynamic/applications.json") as f:
+with open("../../data/dynamic/applications.json") as f:
applications = json.load(f)["applications"]
-with open("core/data/static/categories.json") as f:
+with open("../../data/static/categories.json") as f:
categories_data = json.load(f)["subcategories"]
valid_categories = {c["id"].lower() for c in categories_data}
-with open("core/data/static/platforms.json") as f:
+with open("../../data/static/platforms.json") as f:
platforms_data = json.load(f)["platforms"]
valid_platforms = {p["id"].lower() for p in platforms_data}
diff --git a/core/source/maintenance/stats_updator.py b/core/source/maintenance/stats_updator.py
index 938c3b9..0c3c71d 100644
--- a/core/source/maintenance/stats_updator.py
+++ b/core/source/maintenance/stats_updator.py
@@ -4,7 +4,7 @@ import json
from datetime import datetime
import os
-with open('core/data/dynamic/applications.json', 'r') as f:
+with open('../../data/dynamic/applications.json', 'r') as f:
data = json.load(f)
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
@@ -57,7 +57,7 @@ def update_application_data(app):
for app in data['applications']:
app = update_application_data(app)
-with open('core/data/dynamic/applications.json', 'w') as f:
+with open('../../data/dynamic/applications.json', 'w') as f:
json.dump(data, f, indent=4)
print("Updated application data successfully!")
diff --git a/core/source/maintenance/status_checker.py b/core/source/maintenance/status_checker.py
index 1c8b612..62ec3f4 100644
--- a/core/source/maintenance/status_checker.py
+++ b/core/source/maintenance/status_checker.py
@@ -4,7 +4,7 @@ import json
from datetime import datetime, timedelta
import os
-INPUT_FILE = "core/data/dynamic/applications.json"
+INPUT_FILE = "../../data/dynamic/applications.json"
OUTPUT_FILE = "resources/maintenance/status_maintenance.md"
GITHUB_TOKEN = os.getenv("GITHUB_TOKEN")
diff --git a/scripts/utils/contributing_autofill.py b/scripts/utils/contributing_autofill.py
index 6096e5d..4713a65 100644
--- a/scripts/utils/contributing_autofill.py
+++ b/scripts/utils/contributing_autofill.py
@@ -391,7 +391,7 @@ def main() -> None:
parser.add_argument(
"--applications-file",
default=str(APPLICATIONS_FILE),
- help="Path to applications.json (default: core/data/dynamic/applications.json).",
+ help="Path to applications.json (default: ../../data/dynamic/applications.json).",
)
parser.add_argument(
"--full-details",
diff --git a/scripts/utils/json_mod.py b/scripts/utils/json_mod.py
index f26f6bb..63cbc48 100644
--- a/scripts/utils/json_mod.py
+++ b/scripts/utils/json_mod.py
@@ -3,7 +3,7 @@ import json
"""
# Load the JSON data from file
-with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as file:
+with open("../../data/dynamic/applications.json", "r", encoding="utf-8") as file:
data = json.load(file)
# Convert all platform entries to lowercase
@@ -12,7 +12,7 @@ for app in data.get("applications", []):
app["platforms"] = [platform.lower() for platform in app["platforms"]]
# Write the modified data back to the file
-with open("core/data/dynamic/applications.json", "w", encoding="utf-8") as file:
+with open("../../data/dynamic/applications.json", "w", encoding="utf-8") as file:
json.dump(data, file, indent=4)
print("All platform entries have been converted to lowercase.")
@@ -20,7 +20,7 @@ print("All platform entries have been converted to lowercase.")
"""
# Load the JSON file
-with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as file:
+with open("../../data/dynamic/applications.json", "r", encoding="utf-8") as file:
data = json.load(file)
# Add "flags" and "stars" properties to each application
@@ -28,14 +28,14 @@ for app in data.get("applications", []):
app["homepage_url"] = ""
# Save the updated JSON back to the file
-with open("core/data/dynamic/applications.json", "w", encoding="utf-8") as file:
+with open("../../data/dynamic/applications.json", "w", encoding="utf-8") as file:
json.dump(data, file, indent=4, ensure_ascii=False)
print("Operation successful: applications.json updated")
"""
# Load applications.json
-with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as f:
+with open("../../data/dynamic/applications.json", "r", encoding="utf-8") as f:
data = json.load(f)
# Platforms to check for
@@ -58,5 +58,5 @@ for app in data.get("applications", []):
app["tags"] = sorted(tags)
# Save the updated file
-with open("core/data/dynamic/applications.json", "w", encoding="utf-8") as f:
+with open("../../data/dynamic/applications.json", "w", encoding="utf-8") as f:
json.dump(data, f, indent=4)