Skip to content

Commit c66d81c

Browse files
committed
Allow 'Created: 22-Aug-2001 (edited down on 9-Jan-2002 to become PEP 102)' and Python 3.6
1 parent f732ed8 commit c66d81c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/validate-created.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"""
22
Validates the 'Created: ' field of PEPs match %d-%b-%Y as specified in PEP 1.
33
4-
Requires Python 3.9+
4+
Requires Python 3.6+
55
66
Usage: python3 validate-created.py filename1 [filename2 [...]]
77
"""
88
import sys
99
from datetime import datetime as dt
1010

11-
COL_NUMBER = len("Created:")
11+
COL_NUMBER = len("Created: ")
1212

1313

1414
def validate_file(filename: str) -> int:
@@ -19,7 +19,7 @@ def validate_file(filename: str) -> int:
1919
with open(filename, encoding="utf8") as f:
2020
for line in f:
2121
line_number += 1
22-
if line.startswith("Created:"):
22+
if line.startswith("Created: "):
2323
found = True
2424
break
2525

@@ -28,7 +28,7 @@ def validate_file(filename: str) -> int:
2828
print(f"{filename}: 'Created:' not found")
2929
return errors
3030

31-
date = line.removeprefix("Created:").strip()
31+
date = line.split()[1]
3232
try:
3333
# Validate
3434
dt.strptime(date, "%d-%b-%Y")

0 commit comments

Comments
 (0)