diff --git a/utils.py b/utils.py index 7004063c9..78bc544e3 100644 --- a/utils.py +++ b/utils.py @@ -2476,12 +2476,12 @@ def updateAnnounceCollection(recent_posts_cache: {}, save_json(post_json_object, postFilename) -def weekDayOfMonthStart(monthNumber: int, year: int) -> int: +def week_day_of_month_start(month_number: int, year: int) -> int: """Gets the day number of the first day of the month 1=sun, 7=sat """ - firstDayOfMonth = datetime.datetime(year, monthNumber, 1, 0, 0) - return int(firstDayOfMonth.strftime("%w")) + 1 + first_day_of_month = datetime.datetime(year, month_number, 1, 0, 0) + return int(first_day_of_month.strftime("%w")) + 1 def media_file_mime_type(filename: str) -> str: @@ -2505,10 +2505,10 @@ def media_file_mime_type(filename: str) -> str: 'mp4': 'video/mp4', 'ogv': 'video/ogv' } - fileExt = filename.split('.')[-1] - if not extensions.get(fileExt): + file_ext = filename.split('.')[-1] + if not extensions.get(file_ext): return 'image/png' - return extensions[fileExt] + return extensions[file_ext] def is_recent_post(post_json_object: {}, max_days: int) -> bool: diff --git a/webapp_calendar.py b/webapp_calendar.py index 044bc6218..f632256a9 100644 --- a/webapp_calendar.py +++ b/webapp_calendar.py @@ -16,7 +16,7 @@ from utils import getNicknameFromActor from utils import getDomainFromActor from utils import locate_post from utils import load_json -from utils import weekDayOfMonthStart +from utils import week_day_of_month_start from utils import get_alt_path from utils import remove_domain_port from utils import acct_dir @@ -322,7 +322,7 @@ def htmlCalendar(person_cache: {}, cssCache: {}, translate: {}, nextYear = year + 1 print('Calendar year=' + str(year) + ' month=' + str(monthNumber) + - ' ' + str(weekDayOfMonthStart(monthNumber, year))) + ' ' + str(week_day_of_month_start(monthNumber, year))) if monthNumber < 12: daysInMonth = \ @@ -385,7 +385,7 @@ def htmlCalendar(person_cache: {}, cssCache: {}, translate: {}, navLinks[timelineLinkStr] = calActor + '/inbox' dayOfMonth = 0 - dow = weekDayOfMonthStart(monthNumber, year) + dow = week_day_of_month_start(monthNumber, year) for weekOfMonth in range(1, 7): if dayOfMonth == daysInMonth: continue