Skip to content

[3.8] bpo-28292: Mark calendar.py helper functions as private. (GH-15113) #15116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Lib/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,18 @@ def monthrange(year, month):
return day1, ndays


def monthlen(year, month):
def _monthlen(year, month):
return mdays[month] + (month == February and isleap(year))


def prevmonth(year, month):
def _prevmonth(year, month):
if month == 1:
return year-1, 12
else:
return year, month-1


def nextmonth(year, month):
def _nextmonth(year, month):
if month == 12:
return year+1, 1
else:
Expand Down Expand Up @@ -207,13 +207,13 @@ def itermonthdays3(self, year, month):
day1, ndays = monthrange(year, month)
days_before = (day1 - self.firstweekday) % 7
days_after = (self.firstweekday - day1 - ndays) % 7
y, m = prevmonth(year, month)
end = monthlen(y, m) + 1
y, m = _prevmonth(year, month)
end = _monthlen(y, m) + 1
for d in range(end-days_before, end):
yield y, m, d
for d in range(1, ndays + 1):
yield year, month, d
y, m = nextmonth(year, month)
y, m = _nextmonth(year, month)
for d in range(1, days_after + 1):
yield y, m, d

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Mark calendar.py helper functions as being private. The follows PEP 8
guidance to maintain the style conventions in the module and it addresses a
known case of user confusion.