From a4dc7dff52715c9bd4dc0cfad837cca811390b5f Mon Sep 17 00:00:00 2001 From: josh Date: Sun, 29 Mar 2026 10:16:35 -0400 Subject: [PATCH] refactor: flatten app/scoreboard/ subpackage and rename files for clarity --- .gitignore | 5 ++--- app/{scoreboard/get_data.py => api.py} | 0 app/{scoreboard/process_data.py => games.py} | 0 app/routes.py | 2 +- app/{scoreboard/tasks.py => scheduler.py} | 4 ++-- app/scoreboard/__init__.py | 0 ...pdate_nhl_standings_db.py => standings.py} | 0 run.py | 6 +++--- .../conftest.cpython-313-pytest-8.3.4.pyc | Bin 3241 -> 3193 bytes tests/conftest.py | 4 ++-- tests/{test_process_data.py => test_games.py} | 2 +- 11 files changed, 11 insertions(+), 12 deletions(-) rename app/{scoreboard/get_data.py => api.py} (100%) rename app/{scoreboard/process_data.py => games.py} (100%) rename app/{scoreboard/tasks.py => scheduler.py} (72%) delete mode 100644 app/scoreboard/__init__.py rename app/{scoreboard/update_nhl_standings_db.py => standings.py} (100%) rename tests/{test_process_data.py => test_games.py} (98%) diff --git a/.gitignore b/.gitignore index 5a9ad5a..e0313ee 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ /nhle_standings_response.txt /app/data/nhl_standings.db /app/data/scoreboard_data.json -/__pycache__ -/app/__pycache__ -/app/scoreboard/__pycache__ nhl_standings.db +**/__pycache__ +.venv/ diff --git a/app/scoreboard/get_data.py b/app/api.py similarity index 100% rename from app/scoreboard/get_data.py rename to app/api.py diff --git a/app/scoreboard/process_data.py b/app/games.py similarity index 100% rename from app/scoreboard/process_data.py rename to app/games.py diff --git a/app/routes.py b/app/routes.py index da876be..f76530b 100644 --- a/app/routes.py +++ b/app/routes.py @@ -4,7 +4,7 @@ from flask import render_template, jsonify from app import app from app.config import SCOREBOARD_DATA_FILE -from app.scoreboard.process_data import extract_game_info +from app.games import extract_game_info @app.route("/") diff --git a/app/scoreboard/tasks.py b/app/scheduler.py similarity index 72% rename from app/scoreboard/tasks.py rename to app/scheduler.py index 566c947..7276f93 100644 --- a/app/scoreboard/tasks.py +++ b/app/scheduler.py @@ -3,8 +3,8 @@ import time import schedule -from app.scoreboard.get_data import store_scoreboard_data -from app.scoreboard.update_nhl_standings_db import update_nhl_standings +from app.api import store_scoreboard_data +from app.standings import update_nhl_standings logger = logging.getLogger(__name__) diff --git a/app/scoreboard/__init__.py b/app/scoreboard/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/scoreboard/update_nhl_standings_db.py b/app/standings.py similarity index 100% rename from app/scoreboard/update_nhl_standings_db.py rename to app/standings.py diff --git a/run.py b/run.py index 9c8e54e..7ce91c7 100644 --- a/run.py +++ b/run.py @@ -1,9 +1,9 @@ import threading from app import app from app.config import PORT -from app.scoreboard.tasks import schedule_tasks -from app.scoreboard.get_data import store_scoreboard_data -from app.scoreboard.update_nhl_standings_db import update_nhl_standings +from app.scheduler import schedule_tasks +from app.api import store_scoreboard_data +from app.standings import update_nhl_standings from waitress import serve if __name__ == "__main__": diff --git a/tests/__pycache__/conftest.cpython-313-pytest-8.3.4.pyc b/tests/__pycache__/conftest.cpython-313-pytest-8.3.4.pyc index a1aeb510f2e0004daab8ce42554b1f9249dfe5c5..6eb554d5c197632ffd6ef4cefef89611eb5b85aa 100644 GIT binary patch delta 215 zcmZ1}`BQ@TGcPX}0}#lVoXnKj$ZO5Y=(X9C)t8YYk6nQwlrczt@)9<4M)}Ei*eo># zyae(%6c~azLpg$!K$=iNFqb+|04S$AIe}Gba|F8}Bct%-ERIZm&cuQOz4XM~)Z!uo zppwa)oH>jJlgl_Qxq^UPdmt`;HF+mz7xP^f*~y+(O#4R3VnaOuJau_`(dvaQGg#cY-55&c9C--o6vE64e zyTD>LS&~bMhi5_N7U2!yn`N%B*iCllvXo|ZQDZ#9&gvq{e1wM+#1`dpQD#3P&+ei& Vc{bNy#*oP~xn&uXCvWFI1OVNMMpFO) diff --git a/tests/conftest.py b/tests/conftest.py index 12c0950..34f6ccf 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -81,10 +81,10 @@ def flask_client(tmp_path, monkeypatch): # Patch module-level path constants so no reloads are needed import app.routes as routes - import app.scoreboard.process_data as process_data + import app.games as games monkeypatch.setattr(routes, "SCOREBOARD_DATA_FILE", str(scoreboard_file)) - monkeypatch.setattr(process_data, "DB_PATH", str(db_path)) + monkeypatch.setattr(games, "DB_PATH", str(db_path)) from app import app as flask_app diff --git a/tests/test_process_data.py b/tests/test_games.py similarity index 98% rename from tests/test_process_data.py rename to tests/test_games.py index f9df1af..f791545 100644 --- a/tests/test_process_data.py +++ b/tests/test_games.py @@ -1,5 +1,5 @@ from tests.conftest import make_game -from app.scoreboard.process_data import ( +from app.games import ( convert_game_state, get_game_outcome, process_period,