Skip to content

Commit e8c9420

Browse files
committed
Moved format_total() down
1 parent cc8ae73 commit e8c9420

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

utils/update_root_shield.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616
]
1717
STATS_API_URL = 'https://pypistats.org/api/packages/{pkg}/overall'
1818

19-
def format_total(num: int) -> str: # abbr ints to e.g. 1.5k, 2b
20-
return f'{num / 1000000000:.1f}B' if num >= 1000000000 \
21-
else f'{num / 1000000:.1f}M' if num >= 1000000 \
22-
else f'{num / 1000:.1f}K' if num >= 1000 \
23-
else str(num)
24-
2519
def get_downloads(pkg: str, max_retries: int = 5, get_delay: int = 1) -> int:
2620
import json
2721
from time import sleep
@@ -50,6 +44,12 @@ def get_downloads(pkg: str, max_retries: int = 5, get_delay: int = 1) -> int:
5044
print(f'{pkg}: Failed after {max_retries} retries')
5145
return 0
5246

47+
def format_total(num: int) -> str: # abbr ints to e.g. 1.5k, 2b
48+
return f'{num / 1000000000:.1f}B' if num >= 1000000000 \
49+
else f'{num / 1000000:.1f}M' if num >= 1000000 \
50+
else f'{num / 1000:.1f}K' if num >= 1000 \
51+
else str(num)
52+
5353
def read_file(file_path: str) -> list[str]:
5454
with open(file_path, 'r', encoding='utf-8') as file:
5555
return file.readlines()

0 commit comments

Comments
 (0)