From 0c8120a9a53428c3ef8e4a6f533e8a7ce21d8eb9 Mon Sep 17 00:00:00 2001 From: SowinskiBraeden Date: Thu, 13 Mar 2025 17:21:48 -0700 Subject: [PATCH] update requirements.txt --- insights.py | 5 ----- leaderboard.py | 11 ++++++----- parse.py | 3 ++- requirements.txt | 21 +++++++++++++++++++++ 4 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 requirements.txt diff --git a/insights.py b/insights.py index a060338..2cff5aa 100644 --- a/insights.py +++ b/insights.py @@ -16,8 +16,6 @@ async def getInsights(repoURL: str, attempt: int = 0) -> Dict[str, str|None] | N owner: str = repoURL.split("/")[3] repo: str = repoURL.split("/")[4] - # print(f"Querying {repo}") - query: str = f"https://api.github.com/repos/{owner}/{repo}/stats/contributors" headers: Dict[str, str] = { "Accept": "application/vnd.github+json", @@ -27,12 +25,9 @@ async def getInsights(repoURL: str, attempt: int = 0) -> Dict[str, str|None] | N async with aiohttp.ClientSession() as session: async with session.get(query, headers=headers, timeout=5) as resp: - # print(f" {urls.index(repoURL) + 1}/{len(urls)} - {resp.status}") if resp.status > 400: - # print(f"An Error Occured Querying {repo}") return None if resp.status == 202 and attempt <= MAX_RETRY: - # print(f"{repo} Was queried, but no data was received") time.sleep(15) attempt += 1 team = await getInsights(repoURL, attempt) diff --git a/leaderboard.py b/leaderboard.py index a0eb468..9ae9e59 100644 --- a/leaderboard.py +++ b/leaderboard.py @@ -5,21 +5,22 @@ from prettytable import PrettyTable import os, shutil from datetime import datetime -def pretty_table(dct: Dict, title: str, add: str=""): +def pretty_table(dct: Dict, title: str, add: str="") -> None: table = PrettyTable() + for c in dct.keys(): - table.add_column(c, []) + table.add_column(c, []) + table.add_row(['\n'.join(dct[c]) for c in dct.keys()]) table.align = "l" + with open(f"./boards/{title}.txt", "a") as file: if add != "": file.write(f"{add}\n") + file.write(table.__str__()) file.write("\n\n") - # with open(f"./boards/{title}", "ab") as file: - # pickle.dump(dct, file) - def setupDir() -> None: if not os.path.exists("./boards"): os.makedirs("./boards") diff --git a/parse.py b/parse.py index 89a498a..f3f5201 100644 --- a/parse.py +++ b/parse.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 from typing import List, Dict -import json + +# Only ever really needs to be run one time def getSet(team: str) -> str: team = team.upper() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b4e2105 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,21 @@ +aiohappyeyeballs==2.6.1 +aiohttp==3.11.13 +aiosignal==1.3.2 +attrs==25.3.0 +blinker==1.9.0 +click==8.1.8 +Flask==3.1.0 +frozenlist==1.5.0 +gunicorn==23.0.0 +idna==3.10 +itsdangerous==2.2.0 +Jinja2==3.1.6 +MarkupSafe==3.0.2 +multidict==6.1.0 +packaging==24.2 +prettytable==3.15.1 +propcache==0.3.0 +tqdm==4.67.1 +wcwidth==0.2.13 +Werkzeug==3.1.3 +yarl==1.18.3