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

Method formatmonth

Lib/calendar.py:711–733  ·  view source on GitHub ↗

Return a month's calendar string (multi-line).

(self, theyear, themonth, w=0, l=0)

Source from the content-addressed store, hash-verified

709 )
710
711 def formatmonth(self, theyear, themonth, w=0, l=0):
712 """
713 Return a month's calendar string (multi-line).
714 """
715 if (
716 self.highlight_day
717 and self.highlight_day.year == theyear
718 and self.highlight_day.month == themonth
719 ):
720 highlight_day = self.highlight_day.day
721 else:
722 highlight_day = None
723 w = max(2, w)
724 l = max(1, l)
725 s = self.formatmonthname(theyear, themonth, 7 * (w + 1) - 1)
726 s = s.rstrip()
727 s += '\n' * l
728 s += self.formatweekheader(w).rstrip()
729 s += '\n' * l
730 for week in self.monthdays2calendar(theyear, themonth):
731 s += self.formatweek(week, w, highlight_day=highlight_day).rstrip()
732 s += '\n' * l
733 return s
734
735 def formatyear(self, theyear, w=2, l=1, c=6, m=3):
736 """

Callers

nothing calls this directly

Calls 5

formatweekMethod · 0.95
monthdays2calendarMethod · 0.80
formatmonthnameMethod · 0.45
rstripMethod · 0.45
formatweekheaderMethod · 0.45

Tested by

no test coverage detected