diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 088a066..6f5511c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,12 +8,12 @@ on: jobs: main-windows: - uses: asottile/workflows/.github/workflows/tox.yml@v1.5.0 + uses: asottile/workflows/.github/workflows/tox.yml@v1.7.0 with: - env: '["py38"]' + env: '["py39"]' os: windows-latest main-linux: - uses: asottile/workflows/.github/workflows/tox.yml@v1.5.0 + uses: asottile/workflows/.github/workflows/tox.yml@v1.7.0 with: - env: '["py38", "py39", "py310", "py311"]' + env: '["py39", "py310", "py311", "py312"]' os: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 315c420..fedfab3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: rev: v3.13.0 hooks: - id: reorder-python-imports - 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: @@ -26,7 +26,7 @@ repos: rev: v3.17.0 hooks: - id: pyupgrade - args: [--py38-plus] + args: [--py39-plus] - repo: https://github.com/hhatto/autopep8 rev: v2.3.1 hooks: diff --git a/pre_commit_hooks/check_added_large_files.py b/pre_commit_hooks/check_added_large_files.py index 9e0619b..e674162 100644 --- a/pre_commit_hooks/check_added_large_files.py +++ b/pre_commit_hooks/check_added_large_files.py @@ -4,7 +4,7 @@ import argparse import math import os import subprocess -from typing import Sequence +from collections.abc import Sequence from pre_commit_hooks.util import added_files from pre_commit_hooks.util import zsplit diff --git a/pre_commit_hooks/check_ast.py b/pre_commit_hooks/check_ast.py index fdac361..c1f165b 100644 --- a/pre_commit_hooks/check_ast.py +++ b/pre_commit_hooks/check_ast.py @@ -5,7 +5,7 @@ import ast import platform import sys import traceback -from typing import Sequence +from collections.abc import Sequence def main(argv: Sequence[str] | None = None) -> int: diff --git a/pre_commit_hooks/check_builtin_literals.py b/pre_commit_hooks/check_builtin_literals.py index d3054aa..16d59b5 100644 --- a/pre_commit_hooks/check_builtin_literals.py +++ b/pre_commit_hooks/check_builtin_literals.py @@ -2,8 +2,8 @@ from __future__ import annotations import argparse import ast +from collections.abc import Sequence from typing import NamedTuple -from typing import Sequence BUILTIN_TYPES = { diff --git a/pre_commit_hooks/check_byte_order_marker.py b/pre_commit_hooks/check_byte_order_marker.py index 59cc561..4fba4b3 100644 --- a/pre_commit_hooks/check_byte_order_marker.py +++ b/pre_commit_hooks/check_byte_order_marker.py @@ -1,7 +1,7 @@ from __future__ import annotations import argparse -from typing import Sequence +from collections.abc import Sequence def main(argv: Sequence[str] | None = None) -> int: diff --git a/pre_commit_hooks/check_case_conflict.py b/pre_commit_hooks/check_case_conflict.py index 33a13f1..475c91c 100644 --- a/pre_commit_hooks/check_case_conflict.py +++ b/pre_commit_hooks/check_case_conflict.py @@ -1,9 +1,9 @@ from __future__ import annotations import argparse -from typing import Iterable -from typing import Iterator -from typing import Sequence +from collections.abc import Iterable +from collections.abc import Iterator +from collections.abc import Sequence from pre_commit_hooks.util import added_files from pre_commit_hooks.util import cmd_output diff --git a/pre_commit_hooks/check_docstring_first.py b/pre_commit_hooks/check_docstring_first.py index d55f08a..42fbd15 100644 --- a/pre_commit_hooks/check_docstring_first.py +++ b/pre_commit_hooks/check_docstring_first.py @@ -3,8 +3,8 @@ from __future__ import annotations import argparse import io import tokenize +from collections.abc import Sequence from tokenize import tokenize as tokenize_tokenize -from typing import Sequence NON_CODE_TOKENS = frozenset(( tokenize.COMMENT, tokenize.ENDMARKER, tokenize.NEWLINE, tokenize.NL, diff --git a/pre_commit_hooks/check_executables_have_shebangs.py b/pre_commit_hooks/check_executables_have_shebangs.py index 7c984d3..707863b 100644 --- a/pre_commit_hooks/check_executables_have_shebangs.py +++ b/pre_commit_hooks/check_executables_have_shebangs.py @@ -4,9 +4,9 @@ from __future__ import annotations import argparse import shlex import sys -from typing import Generator +from collections.abc import Generator +from collections.abc import Sequence from typing import NamedTuple -from typing import Sequence from pre_commit_hooks.util import cmd_output from pre_commit_hooks.util import zsplit diff --git a/pre_commit_hooks/check_json.py b/pre_commit_hooks/check_json.py index 6a679fe..612111c 100644 --- a/pre_commit_hooks/check_json.py +++ b/pre_commit_hooks/check_json.py @@ -2,8 +2,8 @@ from __future__ import annotations import argparse import json +from collections.abc import Sequence from typing import Any -from typing import Sequence def raise_duplicate_keys( diff --git a/pre_commit_hooks/check_merge_conflict.py b/pre_commit_hooks/check_merge_conflict.py index 15ec284..54a083e 100644 --- a/pre_commit_hooks/check_merge_conflict.py +++ b/pre_commit_hooks/check_merge_conflict.py @@ -2,7 +2,7 @@ from __future__ import annotations import argparse import os.path -from typing import Sequence +from collections.abc import Sequence from pre_commit_hooks.util import cmd_output diff --git a/pre_commit_hooks/check_shebang_scripts_are_executable.py b/pre_commit_hooks/check_shebang_scripts_are_executable.py index 621696c..aca0f77 100644 --- a/pre_commit_hooks/check_shebang_scripts_are_executable.py +++ b/pre_commit_hooks/check_shebang_scripts_are_executable.py @@ -4,7 +4,7 @@ from __future__ import annotations import argparse import shlex import sys -from typing import Sequence +from collections.abc import Sequence from pre_commit_hooks.check_executables_have_shebangs import EXECUTABLE_VALUES from pre_commit_hooks.check_executables_have_shebangs import git_ls_files diff --git a/pre_commit_hooks/check_symlinks.py b/pre_commit_hooks/check_symlinks.py index a85c82a..be8a800 100644 --- a/pre_commit_hooks/check_symlinks.py +++ b/pre_commit_hooks/check_symlinks.py @@ -2,7 +2,7 @@ from __future__ import annotations import argparse import os.path -from typing import Sequence +from collections.abc import Sequence def main(argv: Sequence[str] | None = None) -> int: diff --git a/pre_commit_hooks/check_toml.py b/pre_commit_hooks/check_toml.py index 0407371..2105b07 100644 --- a/pre_commit_hooks/check_toml.py +++ b/pre_commit_hooks/check_toml.py @@ -2,7 +2,7 @@ from __future__ import annotations import argparse import sys -from typing import Sequence +from collections.abc import Sequence if sys.version_info >= (3, 11): # pragma: >=3.11 cover import tomllib diff --git a/pre_commit_hooks/check_vcs_permalinks.py b/pre_commit_hooks/check_vcs_permalinks.py index 68639bd..108656a 100644 --- a/pre_commit_hooks/check_vcs_permalinks.py +++ b/pre_commit_hooks/check_vcs_permalinks.py @@ -3,8 +3,8 @@ from __future__ import annotations import argparse import re import sys -from typing import Pattern -from typing import Sequence +from collections.abc import Sequence +from re import Pattern def _get_pattern(domain: str) -> Pattern[bytes]: diff --git a/pre_commit_hooks/check_xml.py b/pre_commit_hooks/check_xml.py index c256af9..ff5536b 100644 --- a/pre_commit_hooks/check_xml.py +++ b/pre_commit_hooks/check_xml.py @@ -2,7 +2,7 @@ from __future__ import annotations import argparse import xml.sax.handler -from typing import Sequence +from collections.abc import Sequence def main(argv: Sequence[str] | None = None) -> int: diff --git a/pre_commit_hooks/check_yaml.py b/pre_commit_hooks/check_yaml.py index 0187392..c94ea71 100644 --- a/pre_commit_hooks/check_yaml.py +++ b/pre_commit_hooks/check_yaml.py @@ -1,10 +1,10 @@ from __future__ import annotations import argparse +from collections.abc import Generator +from collections.abc import Sequence from typing import Any -from typing import Generator from typing import NamedTuple -from typing import Sequence import ruamel.yaml diff --git a/pre_commit_hooks/debug_statement_hook.py b/pre_commit_hooks/debug_statement_hook.py index cf544c7..7e6be95 100644 --- a/pre_commit_hooks/debug_statement_hook.py +++ b/pre_commit_hooks/debug_statement_hook.py @@ -3,8 +3,8 @@ from __future__ import annotations import argparse import ast import traceback +from collections.abc import Sequence from typing import NamedTuple -from typing import Sequence DEBUG_STATEMENTS = { diff --git a/pre_commit_hooks/destroyed_symlinks.py b/pre_commit_hooks/destroyed_symlinks.py index f256908..9bc2589 100644 --- a/pre_commit_hooks/destroyed_symlinks.py +++ b/pre_commit_hooks/destroyed_symlinks.py @@ -3,7 +3,7 @@ from __future__ import annotations import argparse import shlex import subprocess -from typing import Sequence +from collections.abc import Sequence from pre_commit_hooks.util import cmd_output from pre_commit_hooks.util import zsplit diff --git a/pre_commit_hooks/detect_aws_credentials.py b/pre_commit_hooks/detect_aws_credentials.py index 4f59d9c..8582288 100644 --- a/pre_commit_hooks/detect_aws_credentials.py +++ b/pre_commit_hooks/detect_aws_credentials.py @@ -3,8 +3,8 @@ from __future__ import annotations import argparse import configparser import os +from collections.abc import Sequence from typing import NamedTuple -from typing import Sequence class BadFile(NamedTuple): diff --git a/pre_commit_hooks/detect_private_key.py b/pre_commit_hooks/detect_private_key.py index cd51f90..9ad703a 100644 --- a/pre_commit_hooks/detect_private_key.py +++ b/pre_commit_hooks/detect_private_key.py @@ -1,7 +1,7 @@ from __future__ import annotations import argparse -from typing import Sequence +from collections.abc import Sequence BLACKLIST = [ b'BEGIN RSA PRIVATE KEY', diff --git a/pre_commit_hooks/end_of_file_fixer.py b/pre_commit_hooks/end_of_file_fixer.py index a30dce9..a88425c 100644 --- a/pre_commit_hooks/end_of_file_fixer.py +++ b/pre_commit_hooks/end_of_file_fixer.py @@ -2,8 +2,8 @@ from __future__ import annotations import argparse import os +from collections.abc import Sequence from typing import IO -from typing import Sequence def fix_file(file_obj: IO[bytes]) -> int: diff --git a/pre_commit_hooks/file_contents_sorter.py b/pre_commit_hooks/file_contents_sorter.py index 02bdbcc..bfbeb25 100644 --- a/pre_commit_hooks/file_contents_sorter.py +++ b/pre_commit_hooks/file_contents_sorter.py @@ -12,11 +12,11 @@ conflicts and keep the file nicely ordered. from __future__ import annotations import argparse +from collections.abc import Iterable +from collections.abc import Sequence from typing import Any from typing import Callable from typing import IO -from typing import Iterable -from typing import Sequence PASS = 0 FAIL = 1 diff --git a/pre_commit_hooks/fix_byte_order_marker.py b/pre_commit_hooks/fix_byte_order_marker.py index 22a4990..100ffea 100644 --- a/pre_commit_hooks/fix_byte_order_marker.py +++ b/pre_commit_hooks/fix_byte_order_marker.py @@ -1,7 +1,7 @@ from __future__ import annotations import argparse -from typing import Sequence +from collections.abc import Sequence def main(argv: Sequence[str] | None = None) -> int: diff --git a/pre_commit_hooks/fix_encoding_pragma.py b/pre_commit_hooks/fix_encoding_pragma.py index eee6705..5354104 100644 --- a/pre_commit_hooks/fix_encoding_pragma.py +++ b/pre_commit_hooks/fix_encoding_pragma.py @@ -2,9 +2,9 @@ from __future__ import annotations import argparse import sys +from collections.abc import Sequence from typing import IO from typing import NamedTuple -from typing import Sequence DEFAULT_PRAGMA = b'# -*- coding: utf-8 -*-' diff --git a/pre_commit_hooks/forbid_new_submodules.py b/pre_commit_hooks/forbid_new_submodules.py index b806cad..b7a63cd 100644 --- a/pre_commit_hooks/forbid_new_submodules.py +++ b/pre_commit_hooks/forbid_new_submodules.py @@ -2,7 +2,7 @@ from __future__ import annotations import argparse import os -from typing import Sequence +from collections.abc import Sequence from pre_commit_hooks.util import cmd_output diff --git a/pre_commit_hooks/mixed_line_ending.py b/pre_commit_hooks/mixed_line_ending.py index 0328e86..2fbf067 100644 --- a/pre_commit_hooks/mixed_line_ending.py +++ b/pre_commit_hooks/mixed_line_ending.py @@ -2,7 +2,7 @@ from __future__ import annotations import argparse import collections -from typing import Sequence +from collections.abc import Sequence CRLF = b'\r\n' diff --git a/pre_commit_hooks/no_commit_to_branch.py b/pre_commit_hooks/no_commit_to_branch.py index 741f726..b0b8b23 100644 --- a/pre_commit_hooks/no_commit_to_branch.py +++ b/pre_commit_hooks/no_commit_to_branch.py @@ -2,8 +2,8 @@ from __future__ import annotations import argparse import re +from collections.abc import Sequence from typing import AbstractSet -from typing import Sequence from pre_commit_hooks.util import CalledProcessError from pre_commit_hooks.util import cmd_output diff --git a/pre_commit_hooks/pretty_format_json.py b/pre_commit_hooks/pretty_format_json.py index 5c0292b..501f37f 100644 --- a/pre_commit_hooks/pretty_format_json.py +++ b/pre_commit_hooks/pretty_format_json.py @@ -3,9 +3,9 @@ from __future__ import annotations import argparse import json import sys +from collections.abc import Mapping +from collections.abc import Sequence from difflib import unified_diff -from typing import Mapping -from typing import Sequence def _get_pretty_format( diff --git a/pre_commit_hooks/removed.py b/pre_commit_hooks/removed.py index 6f6c7b7..fb2b6d9 100644 --- a/pre_commit_hooks/removed.py +++ b/pre_commit_hooks/removed.py @@ -1,7 +1,7 @@ from __future__ import annotations import sys -from typing import Sequence +from collections.abc import Sequence def main(argv: Sequence[str] | None = None) -> int: diff --git a/pre_commit_hooks/requirements_txt_fixer.py b/pre_commit_hooks/requirements_txt_fixer.py index 07b57e1..8ce8ec6 100644 --- a/pre_commit_hooks/requirements_txt_fixer.py +++ b/pre_commit_hooks/requirements_txt_fixer.py @@ -2,8 +2,8 @@ from __future__ import annotations import argparse import re +from collections.abc import Sequence from typing import IO -from typing import Sequence PASS = 0 diff --git a/pre_commit_hooks/sort_simple_yaml.py b/pre_commit_hooks/sort_simple_yaml.py index 116b5c1..65e6b7a 100644 --- a/pre_commit_hooks/sort_simple_yaml.py +++ b/pre_commit_hooks/sort_simple_yaml.py @@ -20,7 +20,7 @@ complicated YAML files. from __future__ import annotations import argparse -from typing import Sequence +from collections.abc import Sequence QUOTES = ["'", '"'] diff --git a/pre_commit_hooks/string_fixer.py b/pre_commit_hooks/string_fixer.py index d1b1c4a..76eb352 100644 --- a/pre_commit_hooks/string_fixer.py +++ b/pre_commit_hooks/string_fixer.py @@ -5,7 +5,7 @@ import io import re import sys import tokenize -from typing import Sequence +from collections.abc import Sequence if sys.version_info >= (3, 12): # pragma: >=3.12 cover FSTRING_START = tokenize.FSTRING_START diff --git a/pre_commit_hooks/tests_should_end_in_test.py b/pre_commit_hooks/tests_should_end_in_test.py index e7842af..07af277 100644 --- a/pre_commit_hooks/tests_should_end_in_test.py +++ b/pre_commit_hooks/tests_should_end_in_test.py @@ -3,7 +3,7 @@ from __future__ import annotations import argparse import os.path import re -from typing import Sequence +from collections.abc import Sequence def main(argv: Sequence[str] | None = None) -> int: diff --git a/pre_commit_hooks/trailing_whitespace_fixer.py b/pre_commit_hooks/trailing_whitespace_fixer.py index 84f5067..dab8b14 100644 --- a/pre_commit_hooks/trailing_whitespace_fixer.py +++ b/pre_commit_hooks/trailing_whitespace_fixer.py @@ -2,7 +2,7 @@ from __future__ import annotations import argparse import os -from typing import Sequence +from collections.abc import Sequence def _fix_file( diff --git a/setup.cfg b/setup.cfg index a0d67f8..3b7e5ee 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,7 +21,7 @@ packages = find: install_requires = ruamel.yaml>=0.15 tomli>=1.1.0;python_version<"3.11" -python_requires = >=3.8 +python_requires = >=3.9 [options.packages.find] exclude =