Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete importlib.readers #13356

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"**/@tests/test_cases",
"stdlib/distutils/command",
"stdlib/distutils/dist.pyi",
"stdlib/importlib/readers.pyi",
"stdlib/lib2to3/fixes/*.pyi",
"stdlib/numbers.pyi",
"stdlib/optparse.pyi",
Expand Down
14 changes: 9 additions & 5 deletions stdlib/importlib/readers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
import pathlib
import sys
import zipfile
from _typeshed import Incomplete, StrPath
from _typeshed import StrPath
from collections.abc import Iterable, Iterator
from io import BufferedReader
from typing import Literal, NoReturn, TypeVar
from typing_extensions import Never

if sys.version_info >= (3, 10):
from importlib._bootstrap_external import FileLoader
from zipimport import zipimporter

if sys.version_info >= (3, 11):
import importlib.resources.abc as abc
else:
Expand All @@ -27,14 +31,14 @@ if sys.version_info >= (3, 10):

class FileReader(abc.TraversableResources):
path: pathlib.Path
def __init__(self, loader) -> None: ...
def __init__(self, loader: FileLoader) -> None: ...
def resource_path(self, resource: StrPath) -> str: ...
def files(self) -> pathlib.Path: ...

class ZipReader(abc.TraversableResources):
prefix: str
archive: Incomplete
def __init__(self, loader, module: str) -> None: ...
archive: str
def __init__(self, loader: zipimporter, module: str) -> None: ...
def open_resource(self, resource: str) -> BufferedReader: ...
def is_resource(self, path: StrPath) -> bool: ...
def files(self) -> zipfile.Path: ...
Expand Down Expand Up @@ -63,6 +67,6 @@ if sys.version_info >= (3, 10):

class NamespaceReader(abc.TraversableResources):
path: MultiplexedPath
def __init__(self, namespace_path) -> None: ...
def __init__(self, namespace_path: Iterable[str]) -> None: ...
def resource_path(self, resource: str) -> str: ...
def files(self) -> MultiplexedPath: ...
Loading