Skip to content
Merged
Changes from 5 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
38 changes: 31 additions & 7 deletions stdlib/importlib/metadata/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ from pathlib import Path
from typing import Any, ClassVar, Iterable, NamedTuple, Pattern, overload

if sys.version_info >= (3, 10):
from importlib.metadata._meta import PackageMetadata as PackageMetadata
from importlib.metadata._meta import PackageMetadata
Comment thread
itaisteinherz marked this conversation as resolved.
Outdated
def packages_distributions() -> Mapping[str, list[str]]: ...

if sys.version_info >= (3, 8):
Expand All @@ -35,6 +35,16 @@ if sys.version_info >= (3, 8):
dist: ClassVar[Distribution | None]
def matches(self, **params: Any) -> bool: ... # undocumented

if sys.version_info >= (3, 10):
class SelectableGroups(dict): # use as list is deprecated since 3.10
@classmethod
def load(cls, eps: SelectableGroups) -> SelectableGroups: ...
Comment thread
itaisteinherz marked this conversation as resolved.
Outdated
Comment thread
srittau marked this conversation as resolved.
Outdated
@property
def groups(self) -> set[str]: ...
@property
def names(self) -> set[str]: ...
def select(self, **params: Any) -> SelectableGroups: ...
Comment thread
itaisteinherz marked this conversation as resolved.
Outdated
Comment thread
itaisteinherz marked this conversation as resolved.
Outdated

class PackagePath(pathlib.PurePosixPath):
def read_text(self, encoding: str = ...) -> str: ...
def read_binary(self) -> bytes: ...
Expand Down Expand Up @@ -66,13 +76,21 @@ if sys.version_info >= (3, 8):
) -> Iterable[Distribution]: ...
@staticmethod
def at(path: StrPath) -> PathDistribution: ...
@property
def metadata(self) -> Message: ...

if sys.version_info >= (3, 10):
@property
def metadata(self) -> PackageMetadata: ...
@property
def entry_points(self) -> SelectableGroups: ...
else:
@property
def metadata(self) -> Message: ...
@property
def entry_points(self) -> list[EntryPoint]: ...

@property
def version(self) -> str: ...
@property
def entry_points(self) -> list[EntryPoint]: ...
@property
def files(self) -> list[PackagePath] | None: ...
@property
def requires(self) -> list[str] | None: ...
Expand Down Expand Up @@ -109,8 +127,14 @@ if sys.version_info >= (3, 8):
def distributions(
*, context: None = ..., name: str | None = ..., path: list[str] = ..., **kwargs: Any
) -> Iterable[Distribution]: ...
def metadata(distribution_name: str) -> Message: ...

if sys.version_info >= (3, 10):
def metadata(distribution_name: str) -> PackageMetadata: ...
def entry_points() -> SelectableGroups: ...
Comment thread
srittau marked this conversation as resolved.
Outdated
else:
def metadata(distribution_name: str) -> Message: ...
def entry_points() -> dict[str, tuple[EntryPoint, ...]]: ...

def version(distribution_name: str) -> str: ...
def entry_points() -> dict[str, tuple[EntryPoint, ...]]: ...
def files(distribution_name: str) -> list[PackagePath] | None: ...
def requires(distribution_name: str) -> list[str] | None: ...