File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 22from pathlib import Path
33
44
5- def main ():
5+ def main () -> int :
66 wrong_directory_msg = "Must run this script from the repo root"
77 if not Path ("Doc" ).exists () or not Path ("Doc" ).is_dir ():
88 raise RuntimeError (wrong_directory_msg )
99
1010 with Path ("Doc/epubcheck.txt" ).open (encoding = "UTF-8" ) as f :
11- warnings = f .read ().splitlines ()
11+ warnings = [ warning . split ( " - " ) for warning in f .read ().splitlines ()]
1212
13- warnings = [warning . split ( " - " ) for warning in warnings ]
13+ fatal_warnings = [warning for warning in warnings if warning [ 0 ] == "FATAL" ]
1414
15- fatals = [warning for warning in warnings if warning [0 ] == "FATAL" ]
16-
17- if fatals :
15+ if fatal_warnings :
1816 print ("\n Error: must not contain fatal errors:\n " )
19- for fatal in fatals :
20- print (" - " .join (fatal ))
17+ for warning in fatal_warnings :
18+ print (" - " .join (warning ))
2119
22- return len (fatals )
20+ return len (fatal_warnings )
2321
2422
2523if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments