-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deployed af37fc2 with MkDocs version: 1.4.2
- Loading branch information
Unknown
committed
Nov 4, 2024
0 parents
commit fe214d7
Showing
908 changed files
with
411,268 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from datetime import datetime, date, timedelta | ||
import yaml | ||
|
||
def daterange(start_date, end_date): | ||
for n in range(int((end_date - start_date).days)): | ||
yield start_date + timedelta(n) | ||
|
||
def get_input_datetime(prompt): | ||
while True: | ||
try: | ||
print(prompt) | ||
input_date = input().split("/") | ||
return datetime(int(input_date[2]), int(input_date[0]), int(input_date[1])) | ||
except IndexError as e: | ||
print(f"Error occurred in processing date input: {e}") | ||
pass | ||
|
||
start_date = get_input_datetime("Enter semester start date (mm/dd/yyyy):") | ||
end_date = get_input_datetime("Enter semester end date (mm/dd/yyyy):") | ||
|
||
dict_file = [] | ||
for single_date in daterange(start_date, end_date): | ||
if (single_date.weekday() > 4): | ||
continue | ||
|
||
str_date = single_date.strftime("%a %b %d") | ||
dict_file.append({ | ||
"date": str_date, | ||
"lecture": { | ||
"name": "", | ||
"link": "" | ||
}, | ||
"recitation": { | ||
"name": "", | ||
"slides": "", | ||
"handout": "", | ||
"quiz": "" | ||
}, | ||
"reading": { | ||
"name": "", | ||
"link": "" | ||
}, | ||
"homework": { | ||
"name": "", | ||
"deadline": "", | ||
"link": "", | ||
"numDays": 0 | ||
} | ||
}) | ||
|
||
class LineBreakDumper(yaml.SafeDumper): | ||
# Reference: https://github.com/yaml/pyyaml/issues/127 | ||
def write_line_break(self, data=None): | ||
super().write_line_break(data) | ||
|
||
if len(self.indents) == 1: | ||
super().write_line_break() | ||
|
||
with open(r'schedule.yaml', 'w') as file: | ||
yaml.dump(dict_file, file, Dumper=LineBreakDumper, default_flow_style=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- name: Canvas | ||
link: https://canvas.cmu.edu/ | ||
icon: assets/images/logos/canvas.png | ||
|
||
- name: Slack | ||
link: https://slack.com/ | ||
icon: assets/images/logos/slack.png | ||
|
||
- name: Gradescope | ||
link: https://www.gradescope.com/ | ||
icon: assets/images/logos/gradescope.png |
Oops, something went wrong.