MCPcopy
hub / github.com/doocs/leetcode / get_contests

Function get_contests

solution/main.py:361–383  ·  view source on GitHub ↗
(fetch_new=True)

Source from the content-addressed store, hash-verified

359
360
361def get_contests(fetch_new=True) -> List:
362 res = [] if fetch_new else load_contest_result()
363 t = 0
364 d = {x.get("contest_title_slug"): x for x in res}
365 for r in (weekly_range, biweekly_range):
366 t += 1
367 cnt = 0
368 for i in r:
369 c = Contest(i, contest_type=t)
370 if c.contest_title_slug in d:
371 continue
372 contest_data = c.get_data(retry=10)
373 time.sleep(1)
374 if not contest_data:
375 cnt += 1
376 if cnt > 2:
377 break
378 continue
379 print(contest_data)
380 res.append(contest_data)
381 d[c.contest_title_slug] = contest_data
382 save_contest_result(res)
383 return res
384
385
386########################################################################################

Callers 1

runFunction · 0.85

Calls 7

get_dataMethod · 0.95
load_contest_resultFunction · 0.85
ContestClass · 0.85
printFunction · 0.85
save_contest_resultFunction · 0.85
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected