MCPcopy Index your code
hub / github.com/python/cpython / itermonthdays

Method itermonthdays

Lib/calendar.py:247–257  ·  view source on GitHub ↗

Like itermonthdates(), but will yield day numbers. For days outside the specified month the day number is 0.

(self, year, month)

Source from the content-addressed store, hash-verified

245 yield datetime.date(y, m, d)
246
247 def itermonthdays(self, year, month):
248 """
249 Like itermonthdates(), but will yield day numbers. For days outside
250 the specified month the day number is 0.
251 """
252 day1, ndays = monthrange(year, month)
253 days_before = (day1 - self.firstweekday) % 7
254 yield from repeat(0, days_before)
255 yield from range(1, ndays + 1)
256 days_after = (self.firstweekday - day1 - ndays) % 7
257 yield from repeat(0, days_after)
258
259 def itermonthdays2(self, year, month):
260 """

Callers 3

itermonthdays2Method · 0.95
monthdayscalendarMethod · 0.95
test_itermonthdaysMethod · 0.95

Calls 2

monthrangeFunction · 0.85
repeatFunction · 0.70

Tested by 1

test_itermonthdaysMethod · 0.76