b/c...py: subst.: add type hints for replacements
This commit is contained in:
parent
c2b67077b2
commit
c32ebba8e0
@ -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():
|
||||||
|
Loading…
Reference in New Issue
Block a user