From c32ebba8e06c1247d720eef87d8a3b0c8a08b4b2 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Tue, 9 Jan 2024 18:35:28 +0300 Subject: [PATCH] b/c...py: subst.: add type hints for `replacements` --- bytebeat_compiler.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bytebeat_compiler.py b/bytebeat_compiler.py index 8427cf6..58e27b6 100644 --- a/bytebeat_compiler.py +++ b/bytebeat_compiler.py @@ -1,9 +1,10 @@ #!/usr/bin/python3 -from os.path import exists, join as path_join -from os import system, environ, makedirs from argparse import ArgumentParser +from os import system, environ, makedirs +from os.path import exists, join as path_join from sys import stdin +from typing import Dict, Union import subprocess # Paths @@ -59,7 +60,8 @@ def read_from_file_or_stdin(path: str) -> str: print("The specified file doesn't exist") 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: print("Substituting values:") for placeholder, replacement in replacements.items():