Skip to content

Fix importlib.resources for mypy #2130

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

Merged
merged 4 commits into from
May 15, 2018
Merged
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
22 changes: 0 additions & 22 deletions stdlib/3.7/importlib/resources.pyi

This file was deleted.

25 changes: 25 additions & 0 deletions stdlib/3/importlib/resources.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import sys
# This is a >=3.7 module, so we conditionally include its source.
if sys.version_info >= (3, 7):
import os

from pathlib import Path
from types import ModuleType
from typing import ContextManager, Iterator, Union, BinaryIO, TextIO

Package = Union[str, ModuleType]
Resource = Union[str, os.PathLike]

def open_binary(package: Package, resource: Resource) -> BinaryIO: ...
def open_text(package: Package,
resource: Resource,
encoding: str = ...,
errors: str = ...) -> TextIO: ...
def read_binary(package: Package, resource: Resource) -> bytes: ...
def read_text(package: Package,
resource: Resource,
encoding: str = ...,
errors: str = ...) -> str: ...
def path(package: Package, resource: Resource) -> ContextManager[Path]: ...
def is_resource(package: Package, name: str) -> bool: ...
def contents(package: Package) -> Iterator[str]: ...