1
0

b/c...py: subst.: add type hints for replacements

This commit is contained in:
Intel A80486DX2-66 2024-01-09 18:35:28 +03:00
parent c2b67077b2
commit c32ebba8e0
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -1,9 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/python3
from os.path import exists, join as path_join
from os import system, environ, makedirs
from argparse import ArgumentParser from argparse import ArgumentParser
from os import system, environ, makedirs
from os.path import exists, join as path_join
from sys import stdin from sys import stdin
from typing import Dict, Union
import subprocess import subprocess
# Paths # Paths
@ -59,7 +60,8 @@ def read_from_file_or_stdin(path: str) -> str:
print("The specified file doesn't exist") print("The specified file doesn't exist")
raise SystemExit raise SystemExit
def substitute_vars(replacements: dict, text: str, verbose: bool) -> str: def substitute_vars(replacements: Dict[str, Union[bool, str]], text: str,
verbose: bool) -> str:
if verbose: if verbose:
print("Substituting values:") print("Substituting values:")
for placeholder, replacement in replacements.items(): for placeholder, replacement in replacements.items():