drop python3.6 support

python 3.6 reached end of life on 2021-12-23

Committed via https://github.com/asottile/all-repos
This commit is contained in:
Anthony Sottile 2022-01-15 19:24:05 -05:00
parent 2aef4c777f
commit 8f6152921e
76 changed files with 229 additions and 145 deletions

View file

@ -1,13 +1,12 @@
"""Check that executable text files have a shebang."""
from __future__ import annotations
import argparse
import shlex
import sys
from typing import Generator
from typing import List
from typing import NamedTuple
from typing import Optional
from typing import Sequence
from typing import Set
from pre_commit_hooks.util import cmd_output
from pre_commit_hooks.util import zsplit
@ -15,7 +14,7 @@ from pre_commit_hooks.util import zsplit
EXECUTABLE_VALUES = frozenset(('1', '3', '5', '7'))
def check_executables(paths: List[str]) -> int:
def check_executables(paths: list[str]) -> int:
if sys.platform == 'win32': # pragma: win32 cover
return _check_git_filemode(paths)
else: # pragma: win32 no cover
@ -42,7 +41,7 @@ def git_ls_files(paths: Sequence[str]) -> Generator[GitLsFile, None, None]:
def _check_git_filemode(paths: Sequence[str]) -> int:
seen: Set[str] = set()
seen: set[str] = set()
for ls_file in git_ls_files(paths):
is_executable = any(b in EXECUTABLE_VALUES for b in ls_file.mode[-3:])
if is_executable and not has_shebang(ls_file.filename):
@ -71,7 +70,7 @@ def _message(path: str) -> None:
)
def main(argv: Optional[Sequence[str]] = None) -> int:
def main(argv: Sequence[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('filenames', nargs='*')
args = parser.parse_args(argv)