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

Class _localized_month

Lib/calendar.py:97–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95# fresh on each call, in case the user changes locale between calls.
96
97class _localized_month:
98
99 _months = [datetime.date(2001, i+1, 1).strftime for i in range(12)]
100 _months.insert(0, lambda x: "")
101
102 def __init__(self, format):
103 self.format = format
104
105 def __getitem__(self, i):
106 funcs = self._months[i]
107 if isinstance(i, slice):
108 return [f(self.format) for f in funcs]
109 else:
110 return funcs(self.format)
111
112 def __len__(self):
113 return 13
114
115
116class _localized_day:

Callers 1

calendar.pyFile · 0.85

Calls 2

dateMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…