python3.9+

This commit is contained in:
Anthony Sottile 2023-10-28 14:20:37 -04:00
parent 61cc55a59c
commit 7f15dc75ee
50 changed files with 84 additions and 85 deletions

View file

@ -6,4 +6,4 @@ runs:
using: composite
steps:
- uses: asottile/workflows/.github/actions/latest-git@v1.4.0
if: inputs.env == 'py38' && runner.os == 'Linux'
if: inputs.env == 'py39' && runner.os == 'Linux'

View file

@ -21,7 +21,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9
- name: install deps
run: python -mpip install -e . -r requirements-dev.txt
- name: vars
@ -39,7 +39,7 @@ jobs:
- uses: asottile/workflows/.github/actions/fast-checkout@v1.4.0
- uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9
- run: echo "$CONDA\Scripts" >> "$GITHUB_PATH"
shell: bash

View file

@ -12,12 +12,12 @@ concurrency:
jobs:
main-windows:
uses: asottile/workflows/.github/workflows/tox.yml@v1.4.0
uses: asottile/workflows/.github/workflows/tox.yml@v1.6.0
with:
env: '["py38"]'
env: '["py39"]'
os: windows-latest
main-linux:
uses: asottile/workflows/.github/workflows/tox.yml@v1.4.0
uses: asottile/workflows/.github/workflows/tox.yml@v1.6.0
with:
env: '["py38", "py39", "py310"]'
env: '["py39", "py310", "py311"]'
os: ubuntu-latest

View file

@ -18,7 +18,7 @@ repos:
hooks:
- id: reorder-python-imports
exclude: ^(pre_commit/resources/|testing/resources/python3_hooks_repo/)
args: [--py38-plus, --add-import, 'from __future__ import annotations']
args: [--py39-plus, --add-import, 'from __future__ import annotations']
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
@ -27,7 +27,7 @@ repos:
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
- repo: https://github.com/hhatto/autopep8
rev: v2.0.4
hooks:

View file

@ -5,9 +5,9 @@ import logging
import re
import shlex
import sys
from collections.abc import Sequence
from typing import Any
from typing import NamedTuple
from typing import Sequence
import cfgv
from identify.identify import ALL_TAGS

View file

@ -4,9 +4,9 @@ import concurrent.futures
import os.path
import re
import tempfile
from collections.abc import Sequence
from typing import Any
from typing import NamedTuple
from typing import Sequence
import pre_commit.constants as C
from pre_commit import git

View file

@ -4,7 +4,7 @@ import argparse
import os.path
import subprocess
import sys
from typing import Sequence
from collections.abc import Sequence
from pre_commit.commands.run import run
from pre_commit.envcontext import envcontext

View file

@ -9,11 +9,11 @@ import re
import subprocess
import time
import unicodedata
from collections.abc import Generator
from collections.abc import Iterable
from collections.abc import MutableMapping
from collections.abc import Sequence
from typing import Any
from typing import Generator
from typing import Iterable
from typing import MutableMapping
from typing import Sequence
from identify.identify import tags_from_path
@ -74,7 +74,7 @@ class Classifier:
def __init__(self, filenames: Iterable[str]) -> None:
self.filenames = [f for f in filenames if os.path.lexists(f)]
@functools.lru_cache(maxsize=None)
@functools.cache
def _types_for_file(self, filename: str) -> set[str]:
return tags_from_path(filename)

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Sequence
from collections.abc import Sequence
from pre_commit import clientlib

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Sequence
from collections.abc import Sequence
from pre_commit import clientlib

View file

@ -3,10 +3,9 @@ from __future__ import annotations
import contextlib
import enum
import os
from typing import Generator
from typing import MutableMapping
from collections.abc import Generator
from collections.abc import MutableMapping
from typing import NamedTuple
from typing import Tuple
from typing import Union
_Unset = enum.Enum('_Unset', 'UNSET')
@ -18,9 +17,9 @@ class Var(NamedTuple):
default: str = ''
SubstitutionT = Tuple[Union[str, Var], ...]
SubstitutionT = tuple[Union[str, Var], ...]
ValueT = Union[str, _Unset, SubstitutionT]
PatchesT = Tuple[Tuple[str, ValueT], ...]
PatchesT = tuple[tuple[str, ValueT], ...]
def format_env(parts: SubstitutionT, env: MutableMapping[str, str]) -> str:

View file

@ -5,7 +5,7 @@ import functools
import os.path
import sys
import traceback
from typing import Generator
from collections.abc import Generator
from typing import IO
import pre_commit.constants as C

View file

@ -3,8 +3,8 @@ from __future__ import annotations
import contextlib
import errno
import sys
from collections.abc import Generator
from typing import Callable
from typing import Generator
if sys.platform == 'win32': # pragma: no cover (windows)

View file

@ -3,7 +3,7 @@ from __future__ import annotations
import logging
import os.path
import sys
from typing import Mapping
from collections.abc import Mapping
from pre_commit.errors import FatalError
from pre_commit.util import CalledProcessError

View file

@ -1,9 +1,9 @@
from __future__ import annotations
import logging
from collections.abc import Sequence
from typing import Any
from typing import NamedTuple
from typing import Sequence
from pre_commit.prefix import Prefix

View file

@ -5,12 +5,12 @@ import os
import random
import re
import shlex
from collections.abc import Generator
from collections.abc import Sequence
from typing import Any
from typing import ContextManager
from typing import Generator
from typing import NoReturn
from typing import Protocol
from typing import Sequence
import pre_commit.constants as C
from pre_commit import parse_shebang

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -2,7 +2,7 @@ from __future__ import annotations
import contextlib
import logging
from typing import Generator
from collections.abc import Generator
from pre_commit import color
from pre_commit import output

View file

@ -4,7 +4,7 @@ import argparse
import logging
import os
import sys
from typing import Sequence
from collections.abc import Sequence
import pre_commit.constants as C
from pre_commit import clientlib

View file

@ -1,7 +1,7 @@
from __future__ import annotations
import argparse
from typing import Sequence
from collections.abc import Sequence
import pre_commit.constants as C
from pre_commit import git

View file

@ -2,8 +2,8 @@ from __future__ import annotations
import argparse
import re
from typing import Iterable
from typing import Sequence
from collections.abc import Iterable
from collections.abc import Sequence
from cfgv import apply_defaults

View file

@ -1,7 +1,7 @@
from __future__ import annotations
import sys
from typing import Sequence
from collections.abc import Sequence
from pre_commit import output

View file

@ -1,7 +1,7 @@
from __future__ import annotations
import os.path
from typing import Mapping
from collections.abc import Mapping
from typing import NoReturn
from identify.identify import parse_shebang_from_file

View file

@ -4,8 +4,8 @@ import json
import logging
import os
import shlex
from collections.abc import Sequence
from typing import Any
from typing import Sequence
import pre_commit.constants as C
from pre_commit.all_languages import languages

View file

@ -4,7 +4,7 @@ import contextlib
import logging
import os.path
import time
from typing import Generator
from collections.abc import Generator
from pre_commit import git
from pre_commit.errors import FatalError

View file

@ -5,9 +5,9 @@ import logging
import os.path
import sqlite3
import tempfile
from collections.abc import Generator
from collections.abc import Sequence
from typing import Callable
from typing import Generator
from typing import Sequence
import pre_commit.constants as C
from pre_commit import file_lock

View file

@ -8,10 +8,10 @@ import shutil
import stat
import subprocess
import sys
from collections.abc import Generator
from types import TracebackType
from typing import Any
from typing import Callable
from typing import Generator
from pre_commit import parse_shebang

View file

@ -7,12 +7,12 @@ import multiprocessing
import os
import subprocess
import sys
from collections.abc import Generator
from collections.abc import Iterable
from collections.abc import MutableMapping
from collections.abc import Sequence
from typing import Any
from typing import Callable
from typing import Generator
from typing import Iterable
from typing import MutableMapping
from typing import Sequence
from typing import TypeVar
from pre_commit import parse_shebang

View file

@ -24,7 +24,7 @@ install_requires =
nodeenv>=0.11.1
pyyaml>=5.1
virtualenv>=20.10.0
python_requires = >=3.8
python_requires = >=3.9
[options.packages.find]
exclude =

View file

@ -1,7 +1,7 @@
from __future__ import annotations
import os
from typing import Sequence
from collections.abc import Sequence
from pre_commit.lang_base import Language
from pre_commit.prefix import Prefix

View file

@ -8,7 +8,7 @@ import shutil
import subprocess
import tarfile
import tempfile
from typing import Sequence
from collections.abc import Sequence
# This is a script for generating the tarred resources for git repo

View file

@ -4,7 +4,7 @@ import os.path
import shlex
import sys
import time
from typing import MutableMapping
from collections.abc import MutableMapping
from unittest import mock
import pytest