|
25 | 25 | # TARGET_USERS = 20 |
26 | 26 | MAX_EXTRA_PAGES = 2 |
27 | 27 |
|
28 | | -WEEK_SECONDS = 7 * 24 * 60 * 60 # for trending feature |
| 28 | +WEEK_SECONDS = 7 * 24 * 60 * 60 # for trending feature |
| 29 | + |
29 | 30 |
|
30 | 31 | def load_previous_users(path: str = "./docs/users.json") -> Dict[str, Dict[str, Any]]: |
31 | 32 | """Load previous user data from a JSON file and index it by login. |
@@ -230,7 +231,10 @@ def fetch_user_detail_with_retry(login: str, max_retries: int = 5) -> Dict[str, |
230 | 231 | logger.warning("Failed to fetch %s after %d attempts", login, max_retries) |
231 | 232 | return {} |
232 | 233 |
|
233 | | -def compute_follower_growth(login: str, current_followers: Any, previous_users: Dict[str, Dict[str, Any]]) -> Dict[str, Any]: |
| 234 | + |
| 235 | +def compute_follower_growth( |
| 236 | + login: str, current_followers: Any, previous_users: Dict[str, Dict[str, Any]] |
| 237 | +) -> Dict[str, Any]: |
234 | 238 | """ |
235 | 239 | Trending feature: compute follower growth data, including snapshot timestamp. |
236 | 240 | """ |
@@ -271,7 +275,12 @@ def compute_follower_growth(login: str, current_followers: Any, previous_users: |
271 | 275 | } |
272 | 276 |
|
273 | 277 |
|
274 | | -def enrich_user_with_details(user: Dict[str, Any], idx: int, total: int, previous_users: Dict[str, Dict[str, Any]]) -> None: |
| 278 | +def enrich_user_with_details( |
| 279 | + user: Dict[str, Any], |
| 280 | + idx: int, |
| 281 | + total: int, |
| 282 | + previous_users: Dict[str, Dict[str, Any]], |
| 283 | +) -> None: |
275 | 284 | """Add detailed information (followers, repos, sponsors) to user dict.""" |
276 | 285 | detail = fetch_user_detail_with_retry(user["login"]) |
277 | 286 | if not detail: |
@@ -314,7 +323,9 @@ def enrich_user_with_details(user: Dict[str, Any], idx: int, total: int, previou |
314 | 323 | time.sleep(0.15) |
315 | 324 |
|
316 | 325 |
|
317 | | -def enrich_all_users(users: List[Dict[str, Any]], previous_users: Dict[str, Dict[str, Any]]) -> None: |
| 326 | +def enrich_all_users( |
| 327 | + users: List[Dict[str, Any]], previous_users: Dict[str, Dict[str, Any]] |
| 328 | +) -> None: |
318 | 329 | """Enrich all users with detailed information from GitHub API.""" |
319 | 330 | total = len(users) |
320 | 331 | for idx, user in enumerate(users, 1): |
@@ -566,7 +577,7 @@ def run() -> None: |
566 | 577 | logger.info("Target users: %d", TARGET_USERS) |
567 | 578 | logger.info("") |
568 | 579 |
|
569 | | - previous_users = load_previous_users() # for trending feature |
| 580 | + previous_users = load_previous_users() # for trending feature |
570 | 581 |
|
571 | 582 | users = fetch_users_from_search(TARGET_USERS) |
572 | 583 |
|
|
0 commit comments