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

Method formatmonth

Lib/calendar.py:678–700  ·  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

676 )
677
678 def formatmonth(self, theyear, themonth, w=0, l=0):
679 """
680 Return a month's calendar string (multi-line).
681 """
682 if (
683 self.highlight_day
684 and self.highlight_day.year == theyear
685 and self.highlight_day.month == themonth
686 ):
687 highlight_day = self.highlight_day.day
688 else:
689 highlight_day = None
690 w = max(2, w)
691 l = max(1, l)
692 s = self.formatmonthname(theyear, themonth, 7 * (w + 1) - 1)
693 s = s.rstrip()
694 s += '\n' * l
695 s += self.formatweekheader(w).rstrip()
696 s += '\n' * l
697 for week in self.monthdays2calendar(theyear, themonth):
698 s += self.formatweek(week, w, highlight_day=highlight_day).rstrip()
699 s += '\n' * l
700 return s
701
702 def formatyear(self, theyear, w=2, l=1, c=6, m=3):
703 """

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected