66from os .path import exists
77import struct
88import sys
9- from typing import IO , BinaryIO , Literal , TextIO
9+ from typing import IO , BinaryIO , Literal
1010
1111from configobj import ConfigObj , ConfigObjError
1212from Cryptodome .Cipher import AES
@@ -23,7 +23,7 @@ def log(logger: logging.Logger, level: int, message: str) -> None:
2323 logger .log (level , message )
2424
2525
26- def read_config_file (f : str | TextIO | TextIOWrapper , list_values : bool = True ) -> ConfigObj | None :
26+ def read_config_file (f : str | IO [ str ] , list_values : bool = True ) -> ConfigObj | None :
2727 """Read a config file.
2828
2929 *list_values* set to `True` is the default behavior of ConfigObj.
@@ -50,7 +50,7 @@ def read_config_file(f: str | TextIO | TextIOWrapper, list_values: bool = True)
5050 return config
5151
5252
53- def get_included_configs (config_file : str | TextIOWrapper ) -> list [str | TextIOWrapper ]:
53+ def get_included_configs (config_file : str | IO [ str ] ) -> list [str | IO [ str ] ]:
5454 """Get a list of configuration files that are included into config_path
5555 with !includedir directive.
5656
@@ -62,7 +62,7 @@ def get_included_configs(config_file: str | TextIOWrapper) -> list[str | TextIOW
6262 """
6363 if not isinstance (config_file , str ) or not os .path .isfile (config_file ):
6464 return []
65- included_configs : list [str | TextIOWrapper ] = []
65+ included_configs : list [str | IO [ str ] ] = []
6666
6767 try :
6868 with open (config_file ) as f :
@@ -78,7 +78,7 @@ def get_included_configs(config_file: str | TextIOWrapper) -> list[str | TextIOW
7878 return included_configs
7979
8080
81- def read_config_files (files : list [str | TextIOWrapper ], list_values : bool = True ) -> ConfigObj :
81+ def read_config_files (files : list [str | IO [ str ] ], list_values : bool = True ) -> ConfigObj :
8282 """Read and merge a list of config files."""
8383
8484 config = create_default_config (list_values = list_values )
0 commit comments