MCPcopy Index your code
hub / github.com/RustPython/RustPython / itermonthdays3

Method itermonthdays3

Lib/calendar.py:248–264  ·  view source on GitHub ↗

Like itermonthdates(), but will yield (year, month, day) tuples. Can be used for dates outside of datetime.date range.

(self, year, month)

Source from the content-addressed store, hash-verified

246 yield d, i % 7
247
248 def itermonthdays3(self, year, month):
249 """
250 Like itermonthdates(), but will yield (year, month, day) tuples. Can be
251 used for dates outside of datetime.date range.
252 """
253 day1, ndays = monthrange(year, month)
254 days_before = (day1 - self.firstweekday) % 7
255 days_after = (self.firstweekday - day1 - ndays) % 7
256 y, m = _prevmonth(year, month)
257 end = _monthlen(y, m) + 1
258 for d in range(end-days_before, end):
259 yield y, m, d
260 for d in range(1, ndays + 1):
261 yield year, month, d
262 y, m = _nextmonth(year, month)
263 for d in range(1, days_after + 1):
264 yield y, m, d
265
266 def itermonthdays4(self, year, month):
267 """

Callers 3

itermonthdatesMethod · 0.95
itermonthdays4Method · 0.95
test_itermonthdays3Method · 0.80

Calls 4

monthrangeFunction · 0.85
_prevmonthFunction · 0.85
_monthlenFunction · 0.85
_nextmonthFunction · 0.85

Tested by 1

test_itermonthdays3Method · 0.64