11import os
22import subprocess
33import sys
4+ from collections .abc import Callable
45from pathlib import Path
56from tempfile import TemporaryDirectory
6- from typing import Callable , Dict , List , Union
77
88from cookiecutter .main import cookiecutter
99
@@ -26,11 +26,11 @@ def get_module_name(project_dir: Path) -> str:
2626 return module_name
2727
2828
29- def resolve_module_dir (files : List [str ], module_name : str ) -> List [str ]:
29+ def resolve_module_dir (files : list [str ], module_name : str ) -> list [str ]:
3030 return [(s .format (module_name = module_name ) if '{' in s else s ) for s in files ] if files else []
3131
3232
33- def check_files (project_dir : Path , files : List [str ], exist = True ):
33+ def check_files (project_dir : Path , files : list [str ], exist = True ):
3434 for file in files :
3535 path = (project_dir / file ).resolve ()
3636 assert path .exists () == exist , f"file '{ path } ' should { '' if exist else 'not ' } have existed"
@@ -47,8 +47,8 @@ def list_files(base_dir, indent=4):
4747
4848
4949def check_project (
50- project_name = "Test Project" , settings : Dict [str , str ] = None , files_existent : List = None ,
51- files_non_existent : List = None , test_cli = False , run_pytest = False ,
50+ project_name = "Test Project" , settings : dict [str , str ] = None , files_existent : list = None ,
51+ files_non_existent : list = None , test_cli = False , run_pytest = False ,
5252 fun : Callable [[Path ], None ] = None ):
5353 # define cookiecutter settings
5454 if settings is None :
@@ -81,7 +81,7 @@ def check_project(
8181 fun (project_dir )
8282
8383
84- def assert_file_contains (file : Union [ str , Path ] , contains : str = None , not_contains : str = None ):
84+ def assert_file_contains (file : str | Path , contains : str = None , not_contains : str = None ):
8585 with open (file ) as fp :
8686 content = fp .read ()
8787 if contains :
0 commit comments