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

Method formatyearpage

Lib/calendar.py:563–584  ·  view source on GitHub ↗

Return a formatted year as a complete HTML page.

(self, theyear, width=3, css='calendar.css', encoding=None)

Source from the content-addressed store, hash-verified

561 return ''.join(v)
562
563 def formatyearpage(self, theyear, width=3, css='calendar.css', encoding=None):
564 """
565 Return a formatted year as a complete HTML page.
566 """
567 if encoding is None:
568 encoding = sys.getdefaultencoding()
569 v = []
570 a = v.append
571 a('<?xml version="1.0" encoding="%s"?>\n' % encoding)
572 a('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
573 a('<html>\n')
574 a('<head>\n')
575 a('<meta http-equiv="Content-Type" content="text/html; charset=%s" />\n' % encoding)
576 if css is not None:
577 a('<link rel="stylesheet" type="text/css" href="%s" />\n' % css)
578 a('<title>Calendar for %d</title>\n' % theyear)
579 a('</head>\n')
580 a('<body>\n')
581 a(self.formatyear(theyear, width))
582 a('</body>\n')
583 a('</html>\n')
584 return ''.join(v).encode(encoding, "xmlcharrefreplace")
585
586
587class different_locale:

Callers 2

mainFunction · 0.95

Calls 4

formatyearMethod · 0.95
aClass · 0.50
encodeMethod · 0.45
joinMethod · 0.45

Tested by 1