From 4b2aff970bd34dbb19dd168a1f04899130ff7e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Thu, 26 Aug 2021 02:01:23 +0100 Subject: [PATCH] _meta: fix SimplePath protocol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe LaĆ­ns --- importlib_metadata/_meta.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/importlib_metadata/_meta.py b/importlib_metadata/_meta.py index 37ee43e6..a58dccf6 100644 --- a/importlib_metadata/_meta.py +++ b/importlib_metadata/_meta.py @@ -1,5 +1,7 @@ +import os + from ._compat import Protocol -from typing import Any, Dict, Iterator, List, TypeVar, Union +from typing import Any, Dict, Iterator, List, Optional, TypeVar, Union _T = TypeVar("_T") @@ -35,14 +37,17 @@ class SimplePath(Protocol): A minimal subset of pathlib.Path required by PathDistribution. """ - def joinpath(self) -> 'SimplePath': + def joinpath(self, *other: Union[str, 'os.PathLike[str]']) -> 'SimplePath': ... # pragma: no cover - def __truediv__(self) -> 'SimplePath': + def __truediv__(self, other: Union[str, 'os.PathLike[str]']) -> 'SimplePath': ... # pragma: no cover + @property def parent(self) -> 'SimplePath': ... # pragma: no cover - def read_text(self) -> str: + def read_text( + self, encoding: Optional[str] = None, errors: Optional[str] = None + ) -> str: ... # pragma: no cover