88from os .path import exists
99import struct
1010import sys
11- from typing import IO , BinaryIO , Literal
11+ from typing import IO , BinaryIO , Literal , TextIO
1212
1313from configobj import ConfigObj , ConfigObjError
1414import pyaes
@@ -25,7 +25,7 @@ def log(logger: logging.Logger, level: int, message: str) -> None:
2525 logger .log (level , message )
2626
2727
28- def read_config_file (f : str | TextIOWrapper , list_values : bool = True ) -> ConfigObj | None :
28+ def read_config_file (f : str | TextIO | TextIOWrapper , list_values : bool = True ) -> ConfigObj | None :
2929 """Read a config file.
3030
3131 *list_values* set to `True` is the default behavior of ConfigObj.
@@ -52,7 +52,7 @@ def read_config_file(f: str | TextIOWrapper, list_values: bool = True) -> Config
5252 return config
5353
5454
55- def get_included_configs (config_file : str | TextIOWrapper ) -> list [str ]:
55+ def get_included_configs (config_file : str | TextIOWrapper ) -> list [str | TextIOWrapper ]:
5656 """Get a list of configuration files that are included into config_path
5757 with !includedir directive.
5858
@@ -64,7 +64,7 @@ def get_included_configs(config_file: str | TextIOWrapper) -> list[str]:
6464 """
6565 if not isinstance (config_file , str ) or not os .path .isfile (config_file ):
6666 return []
67- included_configs = []
67+ included_configs : list [ str | TextIOWrapper ] = []
6868
6969 try :
7070 with open (config_file ) as f :
@@ -80,7 +80,7 @@ def get_included_configs(config_file: str | TextIOWrapper) -> list[str]:
8080 return included_configs
8181
8282
83- def read_config_files (files : list [str ], list_values : bool = True ) -> ConfigObj :
83+ def read_config_files (files : list [str | TextIOWrapper ], list_values : bool = True ) -> ConfigObj :
8484 """Read and merge a list of config files."""
8585
8686 config = create_default_config (list_values = list_values )
0 commit comments