File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 11"""
22Validates 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
66Usage: python3 validate-created.py filename1 [filename2 [...]]
77"""
88import sys
99from datetime import datetime as dt
1010
11- COL_NUMBER = len ("Created:" )
11+ COL_NUMBER = len ("Created: " )
1212
1313
1414def 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" )
You can’t perform that action at this time.
0 commit comments