zipimport: various fixes (#3701)

- allow path of find_module to be None (the default value)
- add undocumented find_loader and get_resource_reader
- greater consistency for __init__ param names
This commit is contained in:
Shantanu
2020-02-01 13:44:55 -08:00
committed by GitHub
parent 211aec7b22
commit 0db4897dab

View File

@@ -1,18 +1,29 @@
"""Stub file for the 'zipimport' module."""
from typing import Optional
import os
import sys
from typing import Any, List, Optional, Tuple, Union
from types import CodeType, ModuleType
if sys.version_info >= (3, 7):
from importlib.abc import ResourceReader
class ZipImportError(ImportError): ...
class zipimporter(object):
archive: str
prefix: str
def __init__(self, archivepath: str) -> None: ...
def find_module(self, fullname: str, path: str = ...) -> Optional[zipimporter]: ...
if sys.version_info >= (3, 6):
def __init__(self, path: Union[str, bytes, os.PathLike[Any]]) -> None: ...
else:
def __init__(self, path: Union[str, bytes]) -> None: ...
if sys.version_info >= (3,):
def find_loader(self, fullname: str, path: Optional[str] = ...) -> Tuple[Optional[zipimporter], List[str]]: ... # undocumented
def find_module(self, fullname: str, path: Optional[str] = ...) -> Optional[zipimporter]: ...
def get_code(self, fullname: str) -> CodeType: ...
def get_data(self, pathname: str) -> str: ...
def get_filename(self, fullname: str) -> str: ...
if sys.version_info >= (3, 7):
def get_resource_reader(self, fullname: str) -> Optional[ResourceReader]: ... # undocumented
def get_source(self, fullname: str) -> Optional[str]: ...
def is_package(self, fullname: str) -> bool: ...
def load_module(self, fullname: str) -> ModuleType: ...