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

Method __find_weekday_format

Lib/_strptime.py:294–320  ·  view source on GitHub ↗

Find the day of the week format appropriate for the current locale. Similar to __find_month_format().

(self, directive)

Source from the content-addressed store, hash-verified

292 return None, None
293
294 def __find_weekday_format(self, directive):
295 """Find the day of the week format appropriate for the current locale.
296
297 Similar to __find_month_format().
298 """
299 full_indices = abbr_indices = None
300 for wd in range(7):
301 time_tuple = time.struct_time((1999, 3, 17, 22, 44, 55, wd, 76, 0))
302 datetime = time.strftime(directive, time_tuple).lower()
303 indices = set(_findall(datetime, self.f_weekday[wd]))
304 if full_indices is None:
305 full_indices = indices
306 else:
307 full_indices &= indices
308 if self.f_weekday[wd] != self.a_weekday[wd]:
309 indices = set(_findall(datetime, self.a_weekday[wd]))
310 if abbr_indices is None:
311 abbr_indices = set(indices)
312 else:
313 abbr_indices &= indices
314 if not full_indices and not abbr_indices:
315 return None, None
316 if full_indices:
317 return self.f_weekday, '%A'
318 if abbr_indices:
319 return self.a_weekday, '%a'
320 return None, None
321
322 def __calc_timezone(self):
323 # Set self.timezone by using time.tzname.

Callers 1

__calc_date_timeMethod · 0.95

Calls 4

setFunction · 0.85
_findallFunction · 0.85
lowerMethod · 0.45
strftimeMethod · 0.45

Tested by

no test coverage detected