Find the month format appropriate for the current locale. In some locales (for example French and Hebrew), the default month used in __calc_date_time has the same name in full and abbreviated form. Also, the month name can by accident match other part of the represe
(self, directive)
| 258 | self.LC_time_ampm = date_time[3] |
| 259 | |
| 260 | def __find_month_format(self, directive): |
| 261 | """Find the month format appropriate for the current locale. |
| 262 | |
| 263 | In some locales (for example French and Hebrew), the default month |
| 264 | used in __calc_date_time has the same name in full and abbreviated |
| 265 | form. Also, the month name can by accident match other part of the |
| 266 | representation: the day of the week name (for example in Morisyen) |
| 267 | or the month number (for example in Japanese). Thus, cycle months |
| 268 | of the year and find all positions that match the month name for |
| 269 | each month, If no common positions are found, the representation |
| 270 | does not use the month name. |
| 271 | """ |
| 272 | full_indices = abbr_indices = None |
| 273 | for m in range(1, 13): |
| 274 | time_tuple = time.struct_time((1999, m, 17, 22, 44, 55, 2, 76, 0)) |
| 275 | datetime = time.strftime(directive, time_tuple).lower() |
| 276 | indices = set(_findall(datetime, self.f_month[m])) |
| 277 | if full_indices is None: |
| 278 | full_indices = indices |
| 279 | else: |
| 280 | full_indices &= indices |
| 281 | indices = set(_findall(datetime, self.a_month[m])) |
| 282 | if abbr_indices is None: |
| 283 | abbr_indices = set(indices) |
| 284 | else: |
| 285 | abbr_indices &= indices |
| 286 | if not full_indices and not abbr_indices: |
| 287 | return None, None |
| 288 | if full_indices: |
| 289 | return self.f_month, '%B' |
| 290 | if abbr_indices: |
| 291 | return self.a_month, '%b' |
| 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. |
no test coverage detected