Skip to content

Commit

Permalink
Merge pull request #3043 from pre-commit/jaraco
Browse files Browse the repository at this point in the history
3.13 removed the simpler importlib.resources api
  • Loading branch information
asottile committed Oct 28, 2023
2 parents 762e681 + 75f2710 commit 14169eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pre_commit/languages/ruby.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@


def _resource_bytesio(filename: str) -> IO[bytes]:
return importlib.resources.open_binary('pre_commit.resources', filename)
files = importlib.resources.files('pre_commit.resources')
return files.joinpath(filename).open('rb')


@functools.lru_cache(maxsize=1)
Expand Down
3 changes: 2 additions & 1 deletion pre_commit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def clean_path_on_failure(path: str) -> Generator[None, None, None]:


def resource_text(filename: str) -> str:
return importlib.resources.read_text('pre_commit.resources', filename)
files = importlib.resources.files('pre_commit.resources')
return files.joinpath(filename).read_text()


def make_executable(filename: str) -> None:
Expand Down

0 comments on commit 14169eb

Please sign in to comment.