From bfb804ed317bbbd1e0089c80c1b1d3510185bca6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 11 Dec 2023 09:29:45 +0100 Subject: Adding upstream version 3.6.0. Signed-off-by: Daniel Baumann --- pre_commit/languages/python.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'pre_commit/languages/python.py') diff --git a/pre_commit/languages/python.py b/pre_commit/languages/python.py index 3ef3436..9f4bf69 100644 --- a/pre_commit/languages/python.py +++ b/pre_commit/languages/python.py @@ -4,8 +4,8 @@ import contextlib import functools import os import sys -from typing import Generator -from typing import Sequence +from collections.abc import Generator +from collections.abc import Sequence import pre_commit.constants as C from pre_commit import lang_base @@ -24,7 +24,7 @@ ENVIRONMENT_DIR = 'py_env' run_hook = lang_base.basic_run_hook -@functools.lru_cache(maxsize=None) +@functools.cache def _version_info(exe: str) -> str: prog = 'import sys;print(".".join(str(p) for p in sys.version_info))' try: @@ -65,7 +65,7 @@ def _find_by_py_launcher( version: str, ) -> str | None: # pragma: no cover (windows only) if version.startswith('python'): - num = version[len('python'):] + num = version.removeprefix('python') cmd = ('py', f'-{num}', '-c', 'import sys; print(sys.executable)') env = dict(os.environ, PYTHONIOENCODING='UTF-8') try: @@ -124,7 +124,7 @@ def _sys_executable_matches(version: str) -> bool: return False try: - info = tuple(int(p) for p in version[len('python'):].split('.')) + info = tuple(int(p) for p in version.removeprefix('python').split('.')) except ValueError: return False -- cgit v1.2.3