Skip to content

Commit 650319c

Browse files
committed
drop python3.6 support
python 3.6 reached end of life on 2021-12-23 Committed via https://github.com/asottile/all-repos
1 parent 1d9666f commit 650319c

7 files changed

+21
-19
lines changed

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ repos:
2222
rev: v2.6.0
2323
hooks:
2424
- id: reorder-python-imports
25-
args: [--py3-plus]
25+
args: [--py37-plus, --add-import, 'from __future__ import annotations']
2626
- repo: https://github.com/asottile/pyupgrade
2727
rev: v2.31.0
2828
hooks:
2929
- id: pyupgrade
30-
args: [--py36-plus]
30+
args: [--py37-plus]
3131
- repo: https://github.com/asottile/add-trailing-comma
3232
rev: v2.2.1
3333
hooks:

astpretty.py

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
from __future__ import annotations
2+
13
import argparse
24
import ast
35
import contextlib
46
import sys
57
from typing import Any
68
from typing import Generator
7-
from typing import Optional
89
from typing import Sequence
9-
from typing import Tuple
10-
from typing import Type
1110
from typing import TYPE_CHECKING
1211
from typing import Union
1312

@@ -16,8 +15,8 @@
1615
from typed_ast import ast3
1716
ASTType = Union[ast.AST, ast27.AST, ast3.AST]
1817

19-
AST: Tuple[Type[Any], ...] = (ast.AST,)
20-
expr_context: Tuple[Type[Any], ...] = (ast.expr_context,)
18+
AST: tuple[type[Any], ...] = (ast.AST,)
19+
expr_context: tuple[type[Any], ...] = (ast.expr_context,)
2120
try: # pragma: no cover (with typed-ast)
2221
from typed_ast import ast27
2322
from typed_ast import ast3
@@ -33,7 +32,7 @@ def _is_sub_node(node: object) -> bool:
3332
return isinstance(node, AST) and not isinstance(node, expr_context)
3433

3534

36-
def _is_leaf(node: 'ASTType') -> bool:
35+
def _is_leaf(node: ASTType) -> bool:
3736
for field in node._fields:
3837
attr = getattr(node, field)
3938
if _is_sub_node(attr):
@@ -46,14 +45,14 @@ def _is_leaf(node: 'ASTType') -> bool:
4645
return True
4746

4847

49-
def _fields(n: 'ASTType', show_offsets: bool = True) -> Tuple[str, ...]:
48+
def _fields(n: ASTType, show_offsets: bool = True) -> tuple[str, ...]:
5049
if show_offsets:
5150
return n._attributes + n._fields
5251
else:
5352
return n._fields
5453

5554

56-
def _leaf(node: 'ASTType', show_offsets: bool = True) -> str:
55+
def _leaf(node: ASTType, show_offsets: bool = True) -> str:
5756
if isinstance(node, AST):
5857
return '{}({})'.format(
5958
type(node).__name__,
@@ -74,8 +73,8 @@ def _leaf(node: 'ASTType', show_offsets: bool = True) -> str:
7473

7574

7675
def pformat(
77-
node: Union['ASTType', None, str],
78-
indent: Union[str, int] = ' ',
76+
node: ASTType | None | str,
77+
indent: str | int = ' ',
7978
show_offsets: bool = True,
8079
_indent: int = 0,
8180
) -> str:
@@ -103,7 +102,7 @@ def indented() -> Generator[None, None, None]:
103102
def indentstr() -> str:
104103
return state.indent * indent_s
105104

106-
def _pformat(el: Union['ASTType', None, str], _indent: int = 0) -> str:
105+
def _pformat(el: ASTType | None | str, _indent: int = 0) -> str:
107106
return pformat(
108107
el, indent=indent, show_offsets=show_offsets,
109108
_indent=_indent,
@@ -143,7 +142,7 @@ def pprint(*args: Any, **kwargs: Any) -> None:
143142
print(pformat(*args, **kwargs))
144143

145144

146-
def main(argv: Optional[Sequence[str]] = None) -> int:
145+
def main(argv: Sequence[str] | None = None) -> int:
147146
parser = argparse.ArgumentParser()
148147
parser.add_argument('filename')
149148
parser.add_argument(

azure-pipelines.yml

+2-2
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, py39]
18+
toxenvs: [py37, py38, py39]
1919
os: linux

setup.cfg

+1-2
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
py_modules = astpretty
26-
python_requires = >=3.6.1
25+
python_requires = >=3.7
2726

2827
[options.entry_points]
2928
console_scripts =

setup.py

+2
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()

tests/astpretty_test.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import ast
24
import sys
35

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py36,py37,py38,pypy3,pre-commit
2+
envlist = py37,py38,pypy3,pre-commit
33

44
[testenv]
55
deps = -rrequirements-dev.txt

0 commit comments

Comments
 (0)