Skip to content

Commit 6b43dd4

Browse files
committed
Move importlib.resources to be in 3, but only usable on 3.7
1 parent 0d1a79f commit 6b43dd4

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

stdlib/3.7/importlib/__init__.pyi

Whitespace-only changes.

stdlib/3.7/importlib/resources.pyi

Lines changed: 0 additions & 22 deletions
This file was deleted.

stdlib/3/importlib/resources.pyi

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
if system.version_info >= (3,7,0):
2+
import os
3+
4+
from pathlib import Path
5+
from types import ModuleType
6+
from typing import ContextManager, Iterator, Union, BinaryIO, TextIO
7+
8+
Package = Union[str, ModuleType]
9+
Resource = Union[str, os.PathLike]
10+
11+
def open_binary(package: Package, resource: Resource) -> BinaryIO: ...
12+
def open_text(package: Package,
13+
resource: Resource,
14+
encoding: str = ...,
15+
errors: str = ...) -> TextIO: ...
16+
def read_binary(package: Package, resource: Resource) -> bytes: ...
17+
def read_text(package: Package,
18+
resource: Resource,
19+
encoding: str = ...,
20+
errors: str = ...) -> str: ...
21+
def path(package: Package, resource: Resource) -> ContextManager[Path]: ...
22+
def is_resource(package: Package, name: str) -> bool: ...
23+
def contents(package: Package) -> Iterator[str]: ...

0 commit comments

Comments
 (0)