mirror of
https://github.com/mustbeperfect/definitive-opensource.git
synced 2026-04-18 02:54:13 +02:00
Updated script so 60.0k shows as 60k
This commit is contained in:
@@ -13,12 +13,19 @@ def extract_repo_path(link):
|
||||
|
||||
def format_stars(n):
|
||||
if n >= 1_000_000:
|
||||
return f"{n/1_000_000:.1f}M"
|
||||
value = n / 1_000_000
|
||||
suffix = 'M'
|
||||
elif n >= 1_000:
|
||||
return f"{n/1_000:.1f}k"
|
||||
value = n / 1_000
|
||||
suffix = 'k'
|
||||
else:
|
||||
return str(n)
|
||||
|
||||
if value.is_integer():
|
||||
return f"{int(value)}{suffix}"
|
||||
else:
|
||||
return f"{value:.1f}{suffix}"
|
||||
|
||||
def generate_contents(platform="all"):
|
||||
|
||||
with open("source/data/categories.json", "r", encoding="utf-8") as f:
|
||||
|
||||
Reference in New Issue
Block a user