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 4c3c811 commit 4a30bf2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ runs:
# git fetch origin main
# git checkout main
echo "Initializing and updating submodules in case checkout resulted in uninitializations..."
git submodule update --init --recursive
git submodule update --recursive --remote
# echo "Initializing and updating submodules in case checkout resulted in uninitializations..."
# git submodule update --init --recursive
# git submodule update --recursive --remote
# cd ../
Expand Down
17 changes: 10 additions & 7 deletions main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
"source": [
"# Categories besides those in lists\n",
"PRIMARY_CATEGORIES = set(['Daily', 'Weekly Premium', 'Contest', 'Favourite'])\n",
"_OLDEST_DATE = datetime.now()\n",
"_oldest_date = datetime.now()\n",
"# _OLDEST_DATE = datetime(2024, 7, 23)"
]
},
Expand Down Expand Up @@ -296,8 +296,8 @@
" \n",
" pbar.update(1)\n",
"\n",
" global _OLDEST_DATE\n",
" _OLDEST_DATE = oldest_date\n",
" global _oldest_date\n",
" _oldest_date = oldest_date.replace(hour=0, minute=0, second=0, microsecond=0)\n",
"\n",
" # Usually I'd avoid using global for this but this is a personal project so it should be fine.\n",
" _ALL_GIT_CM_TIMES.update(output)\n",
Expand Down Expand Up @@ -659,14 +659,15 @@
"metadata": {},
"outputs": [],
"source": [
"def getDailies(firstDate: datetime = _OLDEST_DATE) -> List[Tuple[datetime, int]] :\n",
"def getDailies(firstDate: datetime = _oldest_date) -> List[Tuple[datetime, int]] :\n",
" '''\n",
" Retrieves the daily questions from the official LeetCode json data\n",
" and returns them as a set of strings\n",
"\n",
" ### Returns :\n",
" dailies : List[Tuple[date, questionNo]]\n",
" '''\n",
" print('Oldest date found:', firstDate)\n",
" \n",
" with open(DAILIES_DATA_PATH, 'rb') as fp:\n",
" dailies = json.load(fp)\n",
Expand All @@ -691,7 +692,7 @@
"metadata": {},
"outputs": [],
"source": [
"def getWeeklies(firstDate: datetime = _OLDEST_DATE) -> List[Tuple[datetime, int]] :\n",
"def getWeeklies(firstDate: datetime = _oldest_date) -> List[Tuple[datetime, int]] :\n",
" '''\n",
" Retrieves the weekly premium questions from the official LeetCode json data\n",
" and returns them as a set of strings\n",
Expand All @@ -700,6 +701,8 @@
" weeklies : List[Tuple[date, questionNo]]\n",
" '''\n",
" \n",
" print('Oldest date found:', firstDate)\n",
" \n",
" with open(WEEKLIES_DATA_PATH, 'rb') as fp:\n",
" weeklies = json.load(fp)\n",
" \n",
Expand Down Expand Up @@ -1636,9 +1639,9 @@
" details = 'Calculations are based on the date of the first solve.\\n\\n'\n",
" elif daily :\n",
" dailyQuestionData = parseQuestionsForDailies(questionData)\n",
" global _OLDEST_DATE\n",
" global _oldest_date\n",
" print(f'{dailyQuestionData = }')\n",
" print(f'{_OLDEST_DATE = }')\n",
" print(f'{_oldest_date = }')\n",
" # for qNo, qData in questionData.items() :\n",
" # if 'Daily' in qData['categories'] :\n",
" # dailyQuestionData[qNo] = qData\n",
Expand Down
17 changes: 10 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@

# Categories besides those in lists
PRIMARY_CATEGORIES = set(['Daily', 'Weekly Premium', 'Contest', 'Favourite'])
_OLDEST_DATE = datetime.now()
_oldest_date = datetime.now()
# _OLDEST_DATE = datetime(2024, 7, 23)


Expand Down Expand Up @@ -228,8 +228,8 @@ def getAllCTimesViaGit(paths: List[str]) -> Dict[str, Tuple[datetime, datetime]]

pbar.update(1)

global _OLDEST_DATE
_OLDEST_DATE = oldest_date
global _oldest_date
_oldest_date = oldest_date.replace(hour=0, minute=0, second=0, microsecond=0)

# Usually I'd avoid using global for this but this is a personal project so it should be fine.
_ALL_GIT_CM_TIMES.update(output)
Expand Down Expand Up @@ -549,14 +549,15 @@ def getRecentFileTimes() -> dict :
# In[ ]:


def getDailies(firstDate: datetime = _OLDEST_DATE) -> List[Tuple[datetime, int]] :
def getDailies(firstDate: datetime = _oldest_date) -> List[Tuple[datetime, int]] :
'''
Retrieves the daily questions from the official LeetCode json data
and returns them as a set of strings
### Returns :
dailies : List[Tuple[date, questionNo]]
'''
print('Oldest date found:', firstDate)

with open(DAILIES_DATA_PATH, 'rb') as fp:
dailies = json.load(fp)
Expand All @@ -578,7 +579,7 @@ def getDailies(firstDate: datetime = _OLDEST_DATE) -> List[Tuple[datetime, int]]
# In[ ]:


def getWeeklies(firstDate: datetime = _OLDEST_DATE) -> List[Tuple[datetime, int]] :
def getWeeklies(firstDate: datetime = _oldest_date) -> List[Tuple[datetime, int]] :
'''
Retrieves the weekly premium questions from the official LeetCode json data
and returns them as a set of strings
Expand All @@ -587,6 +588,8 @@ def getWeeklies(firstDate: datetime = _OLDEST_DATE) -> List[Tuple[datetime, int]
weeklies : List[Tuple[date, questionNo]]
'''

print('Oldest date found:', firstDate)

with open(WEEKLIES_DATA_PATH, 'rb') as fp:
weeklies = json.load(fp)

Expand Down Expand Up @@ -1389,9 +1392,9 @@ def miscMarkdownGenerations(questionData: dict,
details = 'Calculations are based on the date of the first solve.\n\n'
elif daily :
dailyQuestionData = parseQuestionsForDailies(questionData)
global _OLDEST_DATE
global _oldest_date
print(f'{dailyQuestionData = }')
print(f'{_OLDEST_DATE = }')
print(f'{_oldest_date = }')
# for qNo, qData in questionData.items() :
# if 'Daily' in qData['categories'] :
# dailyQuestionData[qNo] = qData
Expand Down

0 comments on commit 4a30bf2

Please sign in to comment.