Return one of: 'valid', 'placeholder', 'future', 'bad_format', 'empty'. Placeholders are checked before format so that 'YYYY-MM-DD' is reported as 'placeholder' rather than 'bad_format'. The bash version's order was flipped, causing 'YYYY-MM-DD' to be misreported — both still FAIL but t
(date_str)
| 627 | |
| 628 | |
| 629 | def validate_iso_date(date_str): |
| 630 | """Return one of: 'valid', 'placeholder', 'future', 'bad_format', 'empty'. |
| 631 | |
| 632 | Placeholders are checked before format so that 'YYYY-MM-DD' is reported |
| 633 | as 'placeholder' rather than 'bad_format'. The bash version's order was |
| 634 | flipped, causing 'YYYY-MM-DD' to be misreported — both still FAIL but the |
| 635 | Python version gives the clearer message. |
| 636 | """ |
| 637 | if not date_str: |
| 638 | return "empty" |
| 639 | if date_str in ("YYYY-MM-DD", "0000-00-00"): |
| 640 | return "placeholder" |
| 641 | date_part = date_str[:10] |
| 642 | if not re.fullmatch(r"\d{4}-\d{2}-\d{2}", date_part): |
| 643 | return "bad_format" |
| 644 | if len(date_str) > 10 and not re.fullmatch(r"T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})?", date_str[10:]): |
| 645 | return "bad_format" |
| 646 | today = date.today().isoformat() |
| 647 | if date_part > today: |
| 648 | return "future" |
| 649 | return "valid" |
| 650 | |
| 651 | |
| 652 | def detect_skill_version(locations): |
no outgoing calls
no test coverage detected