Add __all__ for modules beginning with 'h' and 'i' (#7327)

This commit is contained in:
Alex Waygood
2022-02-20 22:01:45 +00:00
committed by GitHub
parent 2279c87257
commit 8f2f857ffc
15 changed files with 150 additions and 0 deletions

View File

@@ -2,6 +2,8 @@ from importlib.abc import Loader
from types import ModuleType
from typing import Mapping, Sequence
__all__ = ["__import__", "import_module", "invalidate_caches", "reload"]
# Signature of `builtins.__import__` should be kept identical to `importlib.__import__`
def __import__(
name: str,

View File

@@ -5,6 +5,38 @@ from pathlib import Path
from types import ModuleType
from typing import Any, BinaryIO, Iterator, TextIO, Union
if sys.version_info >= (3, 10):
__all__ = [
"Package",
"Resource",
"ResourceReader",
"as_file",
"contents",
"files",
"is_resource",
"open_binary",
"open_text",
"path",
"read_binary",
"read_text",
]
elif sys.version_info >= (3, 9):
__all__ = [
"Package",
"Resource",
"as_file",
"contents",
"files",
"is_resource",
"open_binary",
"open_text",
"path",
"read_binary",
"read_text",
]
else:
__all__ = ["Package", "Resource", "contents", "is_resource", "open_binary", "open_text", "path", "read_binary", "read_text"]
Package = Union[str, ModuleType]
Resource = Union[str, os.PathLike[Any]]