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

Method formatyear

Lib/calendar.py:555–575  ·  view source on GitHub ↗

Return a formatted year as a table of tables.

(self, theyear, width=3)

Source from the content-addressed store, hash-verified

553 return ''.join(v)
554
555 def formatyear(self, theyear, width=3):
556 """
557 Return a formatted year as a table of tables.
558 """
559 v = []
560 a = v.append
561 width = max(width, 1)
562 a(f'<table class="{self.cssclass_year}">')
563 a('\n')
564 a(f'<tr><th colspan="{width}" class="{self.cssclass_year_head}">{theyear}</th></tr>')
565 for i in range(JANUARY, JANUARY+12, width):
566 # months in this row
567 months = range(i, min(i+width, 13))
568 a('<tr>')
569 for m in months:
570 a('<td>')
571 a(self.formatmonth(theyear, m, withyear=False))
572 a('</td>')
573 a('</tr>')
574 a('</table>')
575 return ''.join(v)
576
577 def _format_html_page(self, theyear, content, css, encoding):
578 """

Callers 2

formatyearpageMethod · 0.95
mainFunction · 0.95

Calls 3

formatmonthMethod · 0.95
aClass · 0.50
joinMethod · 0.45

Tested by

no test coverage detected