mode: str
    def read(self) -> Union[str, bytes]: ...
    def close(self) -> Any: ...
    def __enter__(self) -> Any: ...
    def __exit__(self, *args: Any) -> Any: ...

# PathLike doesn't work for the pathname argument here
def load_source(name: str, pathname: str, file: Optional[_FileLike] = ...) -> types.ModuleType: ...
def load_compiled(name: str, pathname: str, file: Optional[_FileLike] = ...) -> types.ModuleType: ...
def load_package(name: str, path: StrPath) -> types.ModuleType: ...
def load_module(name: str, file: Optional[_FileLike], filename: str, details: Tuple[str, str, int]) -> types.ModuleType: ...

# IO[Any] is a TextIOWrapper if name is a .py file, and a FileIO otherwise.
def find_module(
    name: str, path: Union[None, List[str], List[os.PathLike[str]], List[StrPath]] = ...
) -> Tuple[IO[Any], str, Tuple[str, str, int]]: ...
def reload(module: types.ModuleType) -> types.ModuleType: ...
def init_builtin(name: str) -> Optional[types.ModuleType]: ...
def load_dynamic(name: str, path: str, file: Any = ...) -> types.ModuleType: ...  # file argument is ignored
PK