Adding upstream version 3.6.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
3e8db4df26
commit
0e9e0db1eb
55 changed files with 266 additions and 248 deletions
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
import contextlib
|
||||
import os
|
||||
import sys
|
||||
from typing import Generator
|
||||
from typing import Sequence
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.envcontext import envcontext
|
||||
|
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
import contextlib
|
||||
import os.path
|
||||
from typing import Generator
|
||||
from typing import Sequence
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.envcontext import envcontext
|
||||
|
|
|
@ -4,8 +4,8 @@ import contextlib
|
|||
import os.path
|
||||
import shutil
|
||||
import tempfile
|
||||
from typing import Generator
|
||||
from typing import Sequence
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.envcontext import envcontext
|
||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from typing import Sequence
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.prefix import Prefix
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Sequence
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.languages.docker import docker_cmd
|
||||
|
|
|
@ -6,8 +6,8 @@ import re
|
|||
import tempfile
|
||||
import xml.etree.ElementTree
|
||||
import zipfile
|
||||
from typing import Generator
|
||||
from typing import Sequence
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.envcontext import envcontext
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Sequence
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.prefix import Prefix
|
||||
|
|
|
@ -12,11 +12,11 @@ import tempfile
|
|||
import urllib.error
|
||||
import urllib.request
|
||||
import zipfile
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Sequence
|
||||
from typing import ContextManager
|
||||
from typing import Generator
|
||||
from typing import IO
|
||||
from typing import Protocol
|
||||
from typing import Sequence
|
||||
|
||||
import pre_commit.constants as C
|
||||
from pre_commit import lang_base
|
||||
|
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
import contextlib
|
||||
import os.path
|
||||
from typing import Generator
|
||||
from typing import Sequence
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.envcontext import envcontext
|
||||
|
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
import contextlib
|
||||
import os
|
||||
import sys
|
||||
from typing import Generator
|
||||
from typing import Sequence
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.envcontext import envcontext
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
import contextlib
|
||||
import os
|
||||
import shlex
|
||||
from typing import Generator
|
||||
from typing import Sequence
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.envcontext import envcontext
|
||||
|
|
|
@ -3,9 +3,9 @@ from __future__ import annotations
|
|||
import argparse
|
||||
import re
|
||||
import sys
|
||||
from collections.abc import Sequence
|
||||
from re import Pattern
|
||||
from typing import NamedTuple
|
||||
from typing import Pattern
|
||||
from typing import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit import output
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import shlex
|
|||
import shutil
|
||||
import tempfile
|
||||
import textwrap
|
||||
from typing import Generator
|
||||
from typing import Sequence
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.envcontext import envcontext
|
||||
|
|
|
@ -6,9 +6,9 @@ import importlib.resources
|
|||
import os.path
|
||||
import shutil
|
||||
import tarfile
|
||||
from typing import Generator
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Sequence
|
||||
from typing import IO
|
||||
from typing import Sequence
|
||||
|
||||
import pre_commit.constants as C
|
||||
from pre_commit import lang_base
|
||||
|
@ -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)
|
||||
|
|
|
@ -7,8 +7,8 @@ import shutil
|
|||
import sys
|
||||
import tempfile
|
||||
import urllib.request
|
||||
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
|
||||
|
@ -134,7 +134,7 @@ def install_environment(
|
|||
|
||||
packages_to_install: set[tuple[str, ...]] = {('--path', '.')}
|
||||
for cli_dep in cli_deps:
|
||||
cli_dep = cli_dep[len('cli:'):]
|
||||
cli_dep = cli_dep.removeprefix('cli:')
|
||||
package, _, crate_version = cli_dep.partition(':')
|
||||
if crate_version != '':
|
||||
packages_to_install.add((package, '--version', crate_version))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Sequence
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.prefix import Prefix
|
||||
|
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
import contextlib
|
||||
import os
|
||||
from typing import Generator
|
||||
from typing import Sequence
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.envcontext import envcontext
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue