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

Method format

solution/main.py:333–358  ·  view source on GitHub ↗
(data: dict)

Source from the content-addressed store, hash-verified

331
332 @staticmethod
333 def format(data: dict) -> List:
334 if not data:
335 return []
336 title = data["contest_title"]
337 title_en = data["contest_title_en"]
338 start_time = data["contest_start_time"]
339 duration = data["contest_duration"]
340 cost_minutes = duration // 60
341 user_num = data["user_num"]
342 rows = [
343 f"#### {title}({Contest.format_time(start_time)}, {cost_minutes} 分钟) 参赛人数 {user_num}\n"
344 ]
345 rows_en = [f"#### {title_en}\n"]
346 for question in data["question_list"]:
347 (
348 frontend_question_id,
349 title_cn,
350 title_en,
351 relative_path_cn,
352 relative_path_en,
353 ) = question
354 rows.append(f"- [{frontend_question_id}. {title_cn}]({relative_path_cn})")
355 rows_en.append(
356 f"- [{frontend_question_id}. {title_en}]({relative_path_en})"
357 )
358 return [start_time, "\n".join(rows), "\n".join(rows_en)]
359
360
361def get_contests(fetch_new=True) -> List:

Callers 15

add_headerFunction · 0.80
format_inline_codeFunction · 0.80
generate_readmeFunction · 0.80
generate_question_readmeFunction · 0.80
generate_category_readmeFunction · 0.80
refreshFunction · 0.80
generate_contest_readmeFunction · 0.80
__init__Method · 0.80
runFunction · 0.80
readBinaryWatchMethod · 0.80
readBinaryWatchMethod · 0.80
readBinaryWatchMethod · 0.80

Calls 3

format_timeMethod · 0.80
appendMethod · 0.45
joinMethod · 0.45

Tested by 3

gMethod · 0.64
findLatestTimeMethod · 0.64
findContestMatchMethod · 0.64