mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
use _typeshed's Path aliases (#4214)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# Stubs for imp (Python 3.6)
|
||||
|
||||
import os
|
||||
import sys
|
||||
from _typeshed import StrPath
|
||||
import types
|
||||
from typing import Any, IO, List, Optional, Tuple, TypeVar, Union
|
||||
|
||||
@@ -13,11 +12,6 @@ from _imp import create_dynamic as create_dynamic
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[str, os.PathLike[str]]
|
||||
else:
|
||||
_Path = str
|
||||
|
||||
SEARCH_ERROR: int
|
||||
PY_SOURCE: int
|
||||
PY_COMPILED: int
|
||||
@@ -32,21 +26,21 @@ IMP_HOOK: int
|
||||
def new_module(name: str) -> types.ModuleType: ...
|
||||
def get_magic() -> bytes: ...
|
||||
def get_tag() -> str: ...
|
||||
def cache_from_source(path: _Path, debug_override: Optional[bool] = ...) -> str: ...
|
||||
def source_from_cache(path: _Path) -> str: ...
|
||||
def cache_from_source(path: StrPath, debug_override: Optional[bool] = ...) -> str: ...
|
||||
def source_from_cache(path: StrPath) -> str: ...
|
||||
def get_suffixes() -> List[Tuple[str, str, int]]: ...
|
||||
|
||||
class NullImporter:
|
||||
def __init__(self, path: _Path) -> None: ...
|
||||
def __init__(self, path: StrPath) -> None: ...
|
||||
def find_module(self, fullname: Any) -> None: ...
|
||||
|
||||
# PathLike doesn't work for the pathname argument here
|
||||
def load_source(name: str, pathname: str, file: Optional[IO[Any]] = ...) -> types.ModuleType: ...
|
||||
def load_compiled(name: str, pathname: str, file: Optional[IO[Any]] = ...) -> types.ModuleType: ...
|
||||
def load_package(name: str, path: _Path) -> types.ModuleType: ...
|
||||
def load_package(name: str, path: StrPath) -> types.ModuleType: ...
|
||||
def load_module(name: str, file: IO[Any], filename: str, details: Tuple[str, str, int]) -> types.ModuleType: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def find_module(name: str, path: Union[None, List[str], List[os.PathLike[str]], List[_Path]] = ...) -> Tuple[IO[Any], str, Tuple[str, str, int]]: ...
|
||||
def find_module(name: str, path: Union[None, List[str], List[os.PathLike[str]], List[StrPath]] = ...) -> Tuple[IO[Any], str, Tuple[str, str, int]]: ...
|
||||
else:
|
||||
def find_module(name: str, path: Optional[List[str]] = ...) -> Tuple[IO[Any], str, Tuple[str, str, int]]: ...
|
||||
def reload(module: types.ModuleType) -> types.ModuleType: ...
|
||||
|
||||
Reference in New Issue
Block a user