You've already forked wakapi-readme-stats
Merge branch 'master' into feat/difference_between_additions_and_deletions
This commit is contained in:
@@ -10,7 +10,7 @@ from humanize import intword, naturalsize, intcomma
|
||||
from manager_download import init_download_manager, DownloadManager as DM
|
||||
from manager_environment import EnvironmentManager as EM
|
||||
from manager_github import init_github_manager, GitHubManager as GHM
|
||||
from manager_localization import init_localization_manager, LocalizationManager as LM
|
||||
from manager_file import init_localization_manager, FileManager as FM
|
||||
from manager_debug import init_debug_manager, DebugManager as DBM
|
||||
from graphics_chart_drawer import create_loc_graph, GRAPH_PATH
|
||||
from yearly_commit_calculator import calculate_yearly_commit_data
|
||||
@@ -33,33 +33,33 @@ async def get_waka_time_stats() -> str:
|
||||
stats += f"{await make_commit_day_time_list(data['data']['timezone'])}\n\n"
|
||||
|
||||
if EM.SHOW_TIMEZONE or EM.SHOW_LANGUAGE or EM.SHOW_EDITORS or EM.SHOW_PROJECTS or EM.SHOW_OS:
|
||||
no_activity = LM.t("No Activity Tracked This Week")
|
||||
stats += f"📊 **{LM.t('This Week I Spend My Time On')}** \n\n```text\n"
|
||||
no_activity = FM.t("No Activity Tracked This Week")
|
||||
stats += f"📊 **{FM.t('This Week I Spend My Time On')}** \n\n```text\n"
|
||||
|
||||
if EM.SHOW_TIMEZONE:
|
||||
DBM.i("Adding user timezone info...")
|
||||
time_zone = data["data"]["timezone"]
|
||||
stats += f"🕑︎ {LM.t('Timezone')}: {time_zone}\n\n"
|
||||
stats += f"🕑︎ {FM.t('Timezone')}: {time_zone}\n\n"
|
||||
|
||||
if EM.SHOW_LANGUAGE:
|
||||
DBM.i("Adding user top languages info...")
|
||||
lang_list = no_activity if len(data["data"]["languages"]) == 0 else make_list(data["data"]["languages"])
|
||||
stats += f"💬 {LM.t('Languages')}: \n{lang_list}\n\n"
|
||||
stats += f"💬 {FM.t('Languages')}: \n{lang_list}\n\n"
|
||||
|
||||
if EM.SHOW_EDITORS:
|
||||
DBM.i("Adding user editors info...")
|
||||
edit_list = no_activity if len(data["data"]["editors"]) == 0 else make_list(data["data"]["editors"])
|
||||
stats += f"🔥 {LM.t('Editors')}: \n{edit_list}\n\n"
|
||||
stats += f"🔥 {FM.t('Editors')}: \n{edit_list}\n\n"
|
||||
|
||||
if EM.SHOW_PROJECTS:
|
||||
DBM.i("Adding user projects info...")
|
||||
project_list = no_activity if len(data["data"]["projects"]) == 0 else make_list(data["data"]["projects"])
|
||||
stats += f"🐱💻 {LM.t('Projects')}: \n{project_list}\n\n"
|
||||
stats += f"🐱💻 {FM.t('Projects')}: \n{project_list}\n\n"
|
||||
|
||||
if EM.SHOW_OS:
|
||||
DBM.i("Adding user operating systems info...")
|
||||
os_list = no_activity if len(data["data"]["operating_systems"]) == 0 else make_list(data["data"]["operating_systems"])
|
||||
stats += f"💻 {LM.t('operating system')}: \n{os_list}\n\n"
|
||||
stats += f"💻 {FM.t('operating system')}: \n{os_list}\n\n"
|
||||
|
||||
stats = f"{stats[:-1]}```\n\n"
|
||||
|
||||
@@ -75,20 +75,20 @@ async def get_short_github_info() -> str:
|
||||
:returns: String representation of the info.
|
||||
"""
|
||||
DBM.i("Adding short GitHub info...")
|
||||
stats = f"**🐱 {LM.t('My GitHub Data')}** \n\n"
|
||||
stats = f"**🐱 {FM.t('My GitHub Data')}** \n\n"
|
||||
|
||||
DBM.i("Adding user disk usage info...")
|
||||
if GHM.USER.disk_usage is None:
|
||||
disk_usage = LM.t("Used in GitHub's Storage") % "?"
|
||||
disk_usage = FM.t("Used in GitHub's Storage") % "?"
|
||||
DBM.p("Please add new github personal access token with user permission!")
|
||||
else:
|
||||
disk_usage = LM.t("Used in GitHub's Storage") % naturalsize(GHM.USER.disk_usage)
|
||||
disk_usage = FM.t("Used in GitHub's Storage") % naturalsize(GHM.USER.disk_usage)
|
||||
stats += f"> 📦 {disk_usage} \n > \n"
|
||||
|
||||
data = await DM.get_remote_json("github_stats")
|
||||
DBM.i("Adding contributions info...")
|
||||
if len(data["years"]) > 0:
|
||||
contributions = LM.t("Contributions in the year") % (intcomma(data["years"][0]["total"]), data["years"][0]["year"])
|
||||
contributions = FM.t("Contributions in the year") % (intcomma(data["years"][0]["total"]), data["years"][0]["year"])
|
||||
stats += f"> 🏆 {contributions}\n > \n"
|
||||
else:
|
||||
DBM.p("GitHub contributions data unavailable!")
|
||||
@@ -96,23 +96,23 @@ async def get_short_github_info() -> str:
|
||||
DBM.i("Adding opted for hire info...")
|
||||
opted_to_hire = GHM.USER.hireable
|
||||
if opted_to_hire:
|
||||
stats += f"> 💼 {LM.t('Opted to Hire')}\n > \n"
|
||||
stats += f"> 💼 {FM.t('Opted to Hire')}\n > \n"
|
||||
else:
|
||||
stats += f"> 🚫 {LM.t('Not Opted to Hire')}\n > \n"
|
||||
stats += f"> 🚫 {FM.t('Not Opted to Hire')}\n > \n"
|
||||
|
||||
DBM.i("Adding public repositories info...")
|
||||
public_repo = GHM.USER.public_repos
|
||||
if public_repo != 1:
|
||||
stats += f"> 📜 {LM.t('public repositories') % public_repo} \n > \n"
|
||||
stats += f"> 📜 {FM.t('public repositories') % public_repo} \n > \n"
|
||||
else:
|
||||
stats += f"> 📜 {LM.t('public repository') % public_repo} \n > \n"
|
||||
stats += f"> 📜 {FM.t('public repository') % public_repo} \n > \n"
|
||||
|
||||
DBM.i("Adding private repositories info...")
|
||||
private_repo = GHM.USER.owned_private_repos if GHM.USER.owned_private_repos is not None else 0
|
||||
if public_repo != 1:
|
||||
stats += f"> 🔑 {LM.t('private repositories') % private_repo} \n > \n"
|
||||
stats += f"> 🔑 {FM.t('private repositories') % private_repo} \n > \n"
|
||||
else:
|
||||
stats += f"> 🔑 {LM.t('private repository') % private_repo} \n > \n"
|
||||
stats += f"> 🔑 {FM.t('private repository') % private_repo} \n > \n"
|
||||
|
||||
DBM.g("Short GitHub info added!")
|
||||
return stats
|
||||
@@ -144,7 +144,7 @@ async def get_stats() -> str:
|
||||
if EM.SHOW_PROFILE_VIEWS:
|
||||
DBM.i("Adding profile views info...")
|
||||
data = GHM.REPO.get_views_traffic(per="week")
|
||||
stats += f")}-{data['count']}-blue)\n\n"
|
||||
stats += f")}-{data['count']}-blue)\n\n"
|
||||
|
||||
if EM.SHOW_LINES_OF_CODE:
|
||||
DBM.i("Adding lines of code info...")
|
||||
@@ -163,9 +163,7 @@ async def get_stats() -> str:
|
||||
|
||||
if EM.SHOW_LOC_CHART:
|
||||
await create_loc_graph(yearly_data, GRAPH_PATH)
|
||||
GHM.update_chart(GRAPH_PATH)
|
||||
chart_path = f"{GHM.USER.login}/{GHM.USER.login}/{GHM.branch()}/{GRAPH_PATH}"
|
||||
stats += f"**{LM.t('Timeline')}**\n\n\n\n"
|
||||
stats += GHM.update_chart(GRAPH_PATH)
|
||||
|
||||
if EM.SHOW_UPDATED_DATE:
|
||||
DBM.i("Adding last updated time...")
|
||||
@@ -181,12 +179,17 @@ async def main():
|
||||
Initializes all managers, collects user info and updates README.md if necessary.
|
||||
"""
|
||||
init_github_manager()
|
||||
await init_download_manager()
|
||||
await init_download_manager(GHM.USER.login)
|
||||
init_localization_manager()
|
||||
DBM.i("Managers initialized.")
|
||||
|
||||
if GHM.update_readme(await get_stats()):
|
||||
DBM.g("Readme updated!")
|
||||
stats = await get_stats()
|
||||
if not EM.DEBUG_RUN:
|
||||
if GHM.update_readme(stats):
|
||||
DBM.g("Readme updated!")
|
||||
else:
|
||||
GHM.set_github_output(stats)
|
||||
DBM.g("Debug run, readme not updated. Check the latest comment for the generated stats.")
|
||||
await DM.close_remote_resources()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user