33from argparse import ArgumentParser
44from pathlib import Path
55from subprocess import CalledProcessError , check_output
6- from typing import List , Optional
76
87
9- def report_output (stdout : bytes , label : str ) -> List [str ]:
8+ def report_output (stdout : bytes , label : str ) -> list [str ]:
109 ret = stdout .decode ().strip ().split ("\n " )
1110 print (f"{ label } : { ret } " )
1211 return ret
1312
1413
15- def get_branch_contents (ref : str ) -> List [str ]:
14+ def get_branch_contents (ref : str ) -> list [str ]:
1615 """Get the list of directories in a branch."""
1716 stdout = check_output (["git" , "ls-tree" , "-d" , "--name-only" , ref ])
1817 return report_output (stdout , "Branch contents" )
1918
2019
21- def get_sorted_tags_list () -> List [str ]:
20+ def get_sorted_tags_list () -> list [str ]:
2221 """Get a list of sorted tags in descending order from the repository."""
2322 stdout = check_output (["git" , "tag" , "-l" , "--sort=-v:refname" ])
2423 return report_output (stdout , "Tags list" )
2524
2625
27- def get_versions (ref : str , add : Optional [ str ] ) -> List [str ]:
26+ def get_versions (ref : str , add : str | None ) -> list [str ]:
2827 """Generate the file containing the list of all GitHub Pages builds."""
2928 # Get the directories (i.e. builds) from the GitHub Pages branch
3029 try :
@@ -41,7 +40,7 @@ def get_versions(ref: str, add: Optional[str]) -> List[str]:
4140 tags = get_sorted_tags_list ()
4241
4342 # Make the sorted versions list from main branches and tags
44- versions : List [str ] = []
43+ versions : list [str ] = []
4544 for version in ["master" , "main" ] + tags :
4645 if version in builds :
4746 versions .append (version )
0 commit comments