8000 Remove Python3.10 type hinting since Vercel doesn't support it. · code93/complete-python-course@72e6d3f · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 72e6d3f

Browse files
committed
Remove Python3.10 type hinting since Vercel doesn't support it.
1 parent ef95d62 commit 72e6d3f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

content.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
import string
66
import markdown
77
from bs4 import BeautifulSoup
8+
from typing import Dict, List, AnyStr, Union
89

9-
def get_grouped_sections(root: str = "course_contents") -> dict[str, list]:
10+
def get_grouped_sections(root: str = "course_contents") -> Dict[AnyStr, List]:
1011
sections = get_all_sections_with_content(root)
1112
grouped_sections = {}
1213
for section in sections:
@@ -34,13 +35,13 @@ def get_all_sections_with_content(root: str = "course_contents"):
3435
yield {"index": section_index, "lectures": non_hidden_lectures}
3536

3637

37-
def get_section_lectures(folder: pathlib.Path | str) -> list[str]:
38+
def get_section_lectures(folder: Union[pathlib.Path, AnyStr]) -> List[str]:
3839
"""Return a list of pathlib.Path objects for all lectsures in a section folder"""
3940
lecture_path = pathlib.Path(folder) / "lectures"
4041
return sorted([folder for folder in lecture_path.glob("*/README.md")])
4142

4243

43-
def get_lecture_content(lecture_path: pathlib.Path, root_path: str | pathlib.Path = "course_contents") -> dict[str, str]:
44+
def get_lecture_content(lecture_path: pathlib.Path, root_path: Union[pathlib.Path, AnyStr] = "course_contents") -> Dict[str, str]:
4445
"""Return a dictionary of lecture content.
4546
Return a dictionary with the following keys:
4647
- title, the h1 from the markdown file
@@ -68,7 +69,7 @@ def get_lecture_content(lecture_path: pathlib.Path, root_path: str | pathlib.Pat
6869
}
6970

7071

71-
def get_grouped_build_sections(root: str = "build") -> dict[str, list]:
72+
def get_grouped_build_sections(root: str = "build") -> Dict[str, list]:
7273
sections = build_and_get_yaml_contents(root)
7374
grouped_sections = {}
7475
for section in sections:
@@ -108,7 +109,7 @@ def build_and_get_yaml_contents(build_path: str = "build"):
108109
yield section
109110

110111

111-
def copy_lectures_to_build_path(section: dict, new_section_name: str, build_path: str = "build"):
112+
def copy_lectures_to_build_path(section: Dict, new_section_name: str, build_path: str = "build"):
112113
for lecture in section["lectures"]:
113114
lecture_name = "_".join(lecture["full_path"].parent.name.split("_")[1:])
114115
pathlib.Path(build_path, new_section_name, lecture_name).mkdir(parents=True, exist_ok=True)

0 commit comments

Comments
 (0)
0