Skip to content

Commit

Permalink
asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Zanger67 committed Jul 26, 2024
1 parent 791b91c commit 6e7c771
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 16 deletions.
36 changes: 28 additions & 8 deletions main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,36 @@
" \n",
" oldest_date = datetime.now()\n",
"\n",
" with tqdm(total=len(paths)) as pbar :\n",
" # with tqdm(total=len(paths), position=0, leave=True) as pbar :\n",
" if IS_NOTEBOOK :\n",
" print('\\n')\n",
" print('/' +_'=' * 15 + '\\\\')\n",
" print(' ', end='')\n",
" pqBarsPrinted = 0\n",
" for i, path in enumerate(paths) :\n",
" path = join(LEETCODE_PATH_FROM_README, path)\n",
" output[path] = individualCTimeViaGit(cmd + [path])\n",
" \n",
" if output[path][0] < oldest_date :\n",
" oldest_date = output[path][0]\n",
" \n",
" pbar.update(1)\n",
" curChunk = int((i / len(paths)) * 15)\n",
" if curChunk > pqBarsPrinted :\n",
" print('=' * (curChunk - pqBarsPrinted), end='')\n",
" pqBarsPrinted = curChunk\n",
" \n",
" print((15 - pqBarsPrinted) * '=', '\\n\\n')\n",
" \n",
" else :\n",
" with tqdm(total=len(paths)) as pbar :\n",
" # with tqdm(total=len(paths), position=0, leave=True) as pbar :\n",
" for i, path in enumerate(paths) :\n",
" path = join(LEETCODE_PATH_FROM_README, path)\n",
" output[path] = individualCTimeViaGit(cmd + [path])\n",
" \n",
" if output[path][0] < oldest_date :\n",
" oldest_date = output[path][0]\n",
" \n",
" pbar.update(1)\n",
"\n",
" global _oldest_date\n",
" _oldest_date = oldest_date.replace(hour=0, minute=0, second=0, microsecond=0)\n",
Expand Down Expand Up @@ -685,8 +705,8 @@
"\n",
" output.append((newK, int(dailies[k]['question']['questionFrontendId'])))\n",
"\n",
" print(f'{firstDate = }')\n",
" print(f'dailies: {output = }')\n",
" # print(f'{firstDate = }')\n",
" # print(f'dailies: {output = }')\n",
" return sorted(output, key=lambda x: x[0], reverse=True)"
]
},
Expand Down Expand Up @@ -766,9 +786,9 @@
" if qNo in questionData and questionData[qNo]['date_done'] <= date + timedelta(days=1, hours=12) :\n",
" dailiesDict[date] = questionData[qNo].copy()\n",
" dailiesDict[date]['date_done'] = date\n",
" print(f'{dailiesDict[date] = }')\n",
" # print(f'{dailiesDict[date] = }')\n",
"\n",
" print(f'{dailiesDict = }')\n",
" # print(f'{dailiesDict = }')\n",
"\n",
" return dailiesDict"
]
Expand Down Expand Up @@ -1797,7 +1817,7 @@
"\n",
"\n",
" questionDetailsDict = retrieveQuestionDetails()\n",
" print(questionDetailsDict)\n",
" # print(questionDetailsDict)\n",
"\n",
" leetcodeFiles.sort()\n",
" contestLeetcodeFiles.sort()\n",
Expand Down
36 changes: 28 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,36 @@ def getAllCTimesViaGit(paths: List[str]) -> Dict[str, Tuple[datetime, datetime]]

oldest_date = datetime.now()

with tqdm(total=len(paths)) as pbar :
# with tqdm(total=len(paths), position=0, leave=True) as pbar :
if IS_NOTEBOOK :
print('\n')
print('/' +_'=' * 15 + '\\')
print(' ', end='')
pqBarsPrinted = 0
for i, path in enumerate(paths) :
path = join(LEETCODE_PATH_FROM_README, path)
output[path] = individualCTimeViaGit(cmd + [path])

if output[path][0] < oldest_date :
oldest_date = output[path][0]

pbar.update(1)
curChunk = int((i / len(paths)) * 15)
if curChunk > pqBarsPrinted :
print('=' * (curChunk - pqBarsPrinted), end='')
pqBarsPrinted = curChunk

print((15 - pqBarsPrinted) * '=', '\n\n')

else :
with tqdm(total=len(paths)) as pbar :
# with tqdm(total=len(paths), position=0, leave=True) as pbar :
for i, path in enumerate(paths) :
path = join(LEETCODE_PATH_FROM_README, path)
output[path] = individualCTimeViaGit(cmd + [path])

if output[path][0] < oldest_date :
oldest_date = output[path][0]

pbar.update(1)

global _oldest_date
_oldest_date = oldest_date.replace(hour=0, minute=0, second=0, microsecond=0)
Expand Down Expand Up @@ -575,8 +595,8 @@ def getDailies(firstDate: datetime = None) -> List[Tuple[datetime, int]] :

output.append((newK, int(dailies[k]['question']['questionFrontendId'])))

print(f'{firstDate = }')
print(f'dailies: {output = }')
# print(f'{firstDate = }')
# print(f'dailies: {output = }')
return sorted(output, key=lambda x: x[0], reverse=True)


Expand Down Expand Up @@ -647,9 +667,9 @@ def parseQuestionsForDailies(questionData: dict) -> Dict[int, Question] :
if qNo in questionData and questionData[qNo]['date_done'] <= date + timedelta(days=1, hours=12) :
dailiesDict[date] = questionData[qNo].copy()
dailiesDict[date]['date_done'] = date
print(f'{dailiesDict[date] = }')
# print(f'{dailiesDict[date] = }')

print(f'{dailiesDict = }')
# print(f'{dailiesDict = }')

return dailiesDict

Expand Down Expand Up @@ -1539,7 +1559,7 @@ def main(*, recalculateAll: bool = False, noRecord: bool = False) -> None :


questionDetailsDict = retrieveQuestionDetails()
print(questionDetailsDict)
# print(questionDetailsDict)

leetcodeFiles.sort()
contestLeetcodeFiles.sort()
Expand Down

0 comments on commit 6e7c771

Please sign in to comment.