Skip to content

Commit

Permalink
Merge commit '98196a'
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 22, 2023
2 parents f38e051 + 98196a7 commit e9e9f77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def read_text(self, filename) -> Optional[str]:
"""

@abc.abstractmethod
def locate_file(self, path: os.PathLike[str]) -> SimplePath:
def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
"""
Given a path to a file in this distribution, return a SimplePath
to it.
Expand Down Expand Up @@ -433,7 +433,7 @@ def discover(
)

@staticmethod
def at(path: os.PathLike[str]) -> "Distribution":
def at(path: str | os.PathLike[str]) -> "Distribution":
"""Return a Distribution for the indicated metadata path.
:param path: a string or path-like object
Expand Down Expand Up @@ -841,7 +841,7 @@ def __init__(self, path: SimplePath) -> None:
"""
self._path = path

def read_text(self, filename: os.PathLike[str]) -> Optional[str]:
def read_text(self, filename: str | os.PathLike[str]) -> Optional[str]:
with suppress(
FileNotFoundError,
IsADirectoryError,
Expand All @@ -855,7 +855,7 @@ def read_text(self, filename: os.PathLike[str]) -> Optional[str]:

read_text.__doc__ = Distribution.read_text.__doc__

def locate_file(self, path: os.PathLike[str]) -> SimplePath:
def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
return self._path.parent / path

@property
Expand Down
1 change: 1 addition & 0 deletions newsfragments/+e563b690.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed type annotations to allow strings.

0 comments on commit e9e9f77

Please sign in to comment.