-
Notifications
You must be signed in to change notification settings - Fork 0
/
missing_detecter.py
57 lines (47 loc) · 2.08 KB
/
missing_detecter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import requests
import os
def get_solvedac_data(user_id: str, page: int = 1) -> dict:
return requests.get(
f"https://solved.ac/api/v3/search/problem?query=solved_by:{user_id}&page={page}&sort=level&direction=desc"
).json()
def get_solvedac_data_all(user_id: str) -> dict:
all_probles = []
print("Solved.ac 데이터를 가져오는 중입니다... [1]")
temp_data = get_solvedac_data(user_id=user_id, page=1)
if temp_data["count"] > 50:
all_probles.extend(temp_data["items"])
if temp_data["count"] // 50 == 0 and temp_data["count"] % 50 != 0:
loop_val = temp_data["count"] // 50 + 1
else:
loop_val = temp_data["count"] // 50
for page in range(2, loop_val + 2):
print(f"Solved.ac 데이터를 가져오는 중입니다... [{page}/{loop_val+1}]")
all_probles.extend(get_solvedac_data(user_id=user_id, page=page)["items"])
return all_probles
def get_local_data(path: str) -> list:
print("로컬 데이터를 가져오는 중입니다...")
local_file_datas = []
black_list_file = ["missing_detecter.py"]
white_list_ext = ["py", "cpp", "java", "gs", "ada", "b"]
black_list_folder = [".git", ".idea"]
for root, _, files in os.walk(path):
local_file_datas.extend(
int(file.split(".")[0].replace("(PyPy3)", ""))
for file in files
if (
file.split(".")[-1] in white_list_ext
and root.split("\\")[-1] not in black_list_folder
and file not in black_list_file
)
)
return local_file_datas
local_file_datas = get_local_data(path="D:\\Desktop\\github\\baekjoon")
all_probles = get_solvedac_data_all(user_id="kimjunsung04")
print("=============검사 결과=============")
for problem in all_probles:
if problem["problemId"] not in local_file_datas:
print(
f"{problem['problemId']} : {problem['titleKo']}\nhttps://www.acmicpc.net/problem/{problem['problemId']}"
)
print("==================================")
print("검사가 완료되었습니다.")