(m)
| 466 | year_in_format = False |
| 467 | day_of_month_in_format = False |
| 468 | def repl(m): |
| 469 | directive = m.group()[1:] # exclude `%` symbol |
| 470 | match directive: |
| 471 | case 'Y' | 'y' | 'G': |
| 472 | nonlocal year_in_format |
| 473 | year_in_format = True |
| 474 | case 'd': |
| 475 | nonlocal day_of_month_in_format |
| 476 | day_of_month_in_format = True |
| 477 | return self[directive] |
| 478 | format = re_sub(r'%[-_0^#]*[0-9]*([OE]?[:\\]?.?)', repl, format) |
| 479 | if day_of_month_in_format and not year_in_format: |
| 480 | import warnings |