Skip to content

Commit

Permalink
Rely on read_text and read_bytes from located paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 16, 2023
1 parent 6202787 commit fc4df51
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,10 @@ class PackagePath(pathlib.PurePosixPath):
dist: "Distribution"

def read_text(self, encoding: str = 'utf-8') -> str: # type: ignore[override]
with self.locate().open(encoding=encoding) as stream:
return stream.read()
return self.locate().read_text(encoding=encoding)

def read_binary(self) -> bytes:
with self.locate().open('rb') as stream:
return stream.read()
return self.locate().read_bytes()

def locate(self) -> pathlib.Path:
"""Return a path-like object for this path"""
Expand Down

0 comments on commit fc4df51

Please sign in to comment.