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

Method formatweek

Lib/calendar.py:689–709  ·  view source on GitHub ↗

Returns a single week in a string (no newline).

(self, theweek, width, *, highlight_day=None)

Source from the content-addressed store, hash-verified

687 self.highlight_day = highlight_day
688
689 def formatweek(self, theweek, width, *, highlight_day=None):
690 """
691 Returns a single week in a string (no newline).
692 """
693 if highlight_day:
694 from _colorize import get_colors
695
696 ansi = get_colors()
697 highlight = f"{ansi.BLACK}{ansi.BACKGROUND_YELLOW}"
698 reset = ansi.RESET
699 else:
700 highlight = reset = ""
701
702 return ' '.join(
703 (
704 f"{highlight}{self.formatday(d, wd, width)}{reset}"
705 if d == highlight_day
706 else self.formatday(d, wd, width)
707 )
708 for (d, wd) in theweek
709 )
710
711 def formatmonth(self, theyear, themonth, w=0, l=0):
712 """

Callers 2

formatmonthMethod · 0.95
formatyearMethod · 0.95

Calls 3

get_colorsFunction · 0.90
joinMethod · 0.45
formatdayMethod · 0.45

Tested by

no test coverage detected