mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
3.13 removed the simpler importlib.resources api
This commit is contained in:
parent
c4042d0a58
commit
4bb30d6e0b
2 changed files with 4 additions and 2 deletions
|
|
@ -25,7 +25,8 @@ run_hook = lang_base.basic_run_hook
|
|||
|
||||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue