Skip to content

Commit b1c8ec0

Browse files
authored
bpo-28292: Mark calendar.py helper functions as private. (GH-15113)
1 parent 8183bb8 commit b1c8ec0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Lib/calendar.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,18 @@ def monthrange(year, month):
127127
return day1, ndays
128128

129129

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

133133

134-
def prevmonth(year, month):
134+
def _prevmonth(year, month):
135135
if month == 1:
136136
return year-1, 12
137137
else:
138138
return year, month-1
139139

140140

141-
def nextmonth(year, month):
141+
def _nextmonth(year, month):
142142
if month == 12:
143143
return year+1, 1
144144
else:
@@ -207,13 +207,13 @@ def itermonthdays3(self, year, month):
207207
day1, ndays = monthrange(year, month)
208208
days_before = (day1 - self.firstweekday) % 7
209209
days_after = (self.firstweekday - day1 - ndays) % 7
210-
y, m = prevmonth(year, month)
211-
end = monthlen(y, m) + 1
210+
y, m = _prevmonth(year, month)
211+
end = _monthlen(y, m) + 1
212212
for d in range(end-days_before, end):
213213
yield y, m, d
214214
for d in range(1, ndays + 1):
215215
yield year, month, d
216-
y, m = nextmonth(year, month)
216+
y, m = _nextmonth(year, month)
217217
for d in range(1, days_after + 1):
218218
yield y, m, d
219219

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

0 commit comments

Comments
 (0)