Skip to content

Commit d2a8a98

Browse files
authored
Merge pull request #270 from pre-commit/all-repos_autofix_drop-py36
drop python3.6 support
2 parents 416900a + 7f27633 commit d2a8a98

File tree

14 files changed

+33
-22
lines changed

14 files changed

+33
-22
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repos:
2828
rev: v2.6.0
2929
hooks:
3030
- id: reorder-python-imports
31-
args: [--py3-plus]
31+
args: [--py37-plus, --add-import, 'from __future__ import annotations']
3232
- repo: https://github.com/asottile/add-trailing-comma
3333
rev: v2.2.1
3434
hooks:
@@ -38,7 +38,7 @@ repos:
3838
rev: v2.31.0
3939
hooks:
4040
- id: pyupgrade
41-
args: [--py36-plus]
41+
args: [--py37-plus]
4242
- repo: https://github.com/pre-commit/mirrors-mypy
4343
rev: v0.931
4444
hooks:

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ resources:
1010
type: github
1111
endpoint: github
1212
name: asottile/azure-pipeline-templates
13-
ref: refs/tags/v2.1.0
13+
ref: refs/tags/v2.4.0
1414

1515
jobs:
1616
- template: job--python-tox.yml@asottile
1717
parameters:
18-
toxenvs: [pypy3, py36, py37, py38]
18+
toxenvs: [py37, py38]
1919
os: linux

bin/vendor-licenses

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
44
./bin/vendor-licenses > identify/vendor/licenses.py
55
"""
6+
from __future__ import annotations
7+
68
import argparse
79
import os.path
810
import subprocess

identify/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
from __future__ import annotations
2+
13
import argparse
24
import json
3-
from typing import Optional
45
from typing import Sequence
56

67
from identify import identify
78

89

9-
def main(argv: Optional[Sequence[str]] = None) -> int:
10+
def main(argv: Sequence[str] | None = None) -> int:
1011
parser = argparse.ArgumentParser()
1112
parser.add_argument('--filename-only', action='store_true')
1213
parser.add_argument('path')

identify/extensions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import annotations
12
EXTENSIONS = {
23
'adoc': {'text', 'asciidoc'},
34
'ai': {'binary', 'adobe-illustrator'},

identify/identify.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import errno
24
import math
35
import os.path
@@ -7,10 +9,6 @@
79
import string
810
import sys
911
from typing import IO
10-
from typing import List
11-
from typing import Optional
12-
from typing import Set
13-
from typing import Tuple
1412

1513
from identify import extensions
1614
from identify import interpreters
@@ -39,7 +37,7 @@
3937
ALL_TAGS = frozenset(_ALL_TAGS)
4038

4139

42-
def tags_from_path(path: str) -> Set[str]:
40+
def tags_from_path(path: str) -> set[str]:
4341
try:
4442
sr = os.lstat(path)
4543
except (OSError, ValueError): # same error-handling as `os.lexists()`
@@ -85,7 +83,7 @@ def tags_from_path(path: str) -> Set[str]:
8583
return tags
8684

8785

88-
def tags_from_filename(path: str) -> Set[str]:
86+
def tags_from_filename(path: str) -> set[str]:
8987
_, filename = os.path.split(path)
9088
_, ext = os.path.splitext(filename)
9189

@@ -107,7 +105,7 @@ def tags_from_filename(path: str) -> Set[str]:
107105
return ret
108106

109107

110-
def tags_from_interpreter(interpreter: str) -> Set[str]:
108+
def tags_from_interpreter(interpreter: str) -> set[str]:
111109
_, _, interpreter = interpreter.rpartition('/')
112110

113111
# Try "python3.5.2" => "python3.5" => "python3" until one matches.
@@ -141,7 +139,7 @@ def file_is_text(path: str) -> bool:
141139
return is_text(f)
142140

143141

144-
def _shebang_split(line: str) -> List[str]:
142+
def _shebang_split(line: str) -> list[str]:
145143
try:
146144
# shebangs aren't supposed to be quoted, though some tools such as
147145
# setuptools will write them with quotes so we'll best-guess parse
@@ -155,8 +153,8 @@ def _shebang_split(line: str) -> List[str]:
155153

156154
def _parse_nix_shebang(
157155
bytesio: IO[bytes],
158-
cmd: Tuple[str, ...],
159-
) -> Tuple[str, ...]:
156+
cmd: tuple[str, ...],
157+
) -> tuple[str, ...]:
160158
while bytesio.read(2) == b'#!':
161159
next_line_b = bytesio.readline()
162160
try:
@@ -177,7 +175,7 @@ def _parse_nix_shebang(
177175
return cmd
178176

179177

180-
def parse_shebang(bytesio: IO[bytes]) -> Tuple[str, ...]:
178+
def parse_shebang(bytesio: IO[bytes]) -> tuple[str, ...]:
181179
"""Parse the shebang from a file opened for reading binary."""
182180
if bytesio.read(2) != b'#!':
183181
return ()
@@ -204,7 +202,7 @@ def parse_shebang(bytesio: IO[bytes]) -> Tuple[str, ...]:
204202
return cmd
205203

206204

207-
def parse_shebang_from_file(path: str) -> Tuple[str, ...]:
205+
def parse_shebang_from_file(path: str) -> tuple[str, ...]:
208206
"""Parse the shebang given a file path."""
209207
if not os.path.lexists(path):
210208
raise ValueError(f'{path} does not exist.')
@@ -231,7 +229,7 @@ def _norm_license(s: str) -> str:
231229
return s.strip()
232230

233231

234-
def license_id(filename: str) -> Optional[str]:
232+
def license_id(filename: str) -> str | None:
235233
"""Return the spdx id for the license contained in `filename`. If no
236234
license is detected, returns `None`.
237235

identify/interpreters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import annotations
12
INTERPRETERS = {
23
'ash': {'shell', 'ash'},
34
'awk': {'awk'},

identify/vendor/licenses.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import annotations
12
LICENSES = (
23
(
34
'0BSD',

setup.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ classifiers =
1313
License :: OSI Approved :: MIT License
1414
Programming Language :: Python :: 3
1515
Programming Language :: Python :: 3 :: Only
16-
Programming Language :: Python :: 3.6
1716
Programming Language :: Python :: 3.7
1817
Programming Language :: Python :: 3.8
1918
Programming Language :: Python :: 3.9
@@ -23,7 +22,7 @@ classifiers =
2322

2423
[options]
2524
packages = find:
26-
python_requires = >=3.6.1
25+
python_requires = >=3.7
2726

2827
[options.packages.find]
2928
exclude =

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
from __future__ import annotations
2+
13
from setuptools import setup
24
setup()

0 commit comments

Comments
 (0)