Skip to content

Commit

Permalink
style: Format code for consistency and improve readability in base.py
Browse files Browse the repository at this point in the history
  • Loading branch information
techtanic committed Nov 3, 2024
1 parent 3b5da6a commit 5387be2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions base.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def __init__(self, interface: str, debug: bool = False):
self.client.headers.update(headers)
self.debug = debug

def print(self, content: str, color: str="red", **kargs):
def print(self, content: str, color: str = "red", **kargs):
content = str(content)
colours_dict = {
"yellow": fy,
Expand Down Expand Up @@ -485,8 +485,8 @@ def fetch_cookies(self):

def get_enrolled_courses(self):
"""Get enrolled courses
Sets enrolled_courses
Sets enrolled_courses
{slug:enrollment_time}
"""
next_page = "https://www.udemy.com/api-2.0/users/me/subscribed-courses/?ordering=-enroll_time&fields[course]=enrollment_time,url&page_size=100"
Expand All @@ -501,7 +501,7 @@ def get_enrolled_courses(self):
next_page = r["next"]
self.enrolled_courses = courses

def compare_versions(self,version1, version2):
def compare_versions(self, version1, version2):
v1_parts = list(map(int, version1.split(".")))
v2_parts = list(map(int, version2.split(".")))
max_length = max(len(v1_parts), len(v2_parts))
Expand Down Expand Up @@ -908,15 +908,15 @@ def print_course_info(self, index, total_courses):

def handle_course_enrollment(self):
slug = self.link.split("/")[4]

if slug in self.enrolled_courses:
self.print(
f"You purchased this course on {self.get_date_from_utc(self.enrolled_courses[slug])}",
color="light blue",
)
self.already_enrolled_c += 1
return

course = self.get_course_id(self.link)
if course["is_invalid"]:
self.print(course["msg"], color="red")
Expand Down

0 comments on commit 5387be2

Please sign in to comment.