diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5ca837d..7feb1ad 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,12 +22,12 @@ repos: rev: v2.6.0 hooks: - id: reorder-python-imports - args: [--py3-plus] + args: [--py37-plus, --add-import, 'from __future__ import annotations'] - repo: https://github.com/asottile/pyupgrade rev: v2.31.0 hooks: - id: pyupgrade - args: [--py3-plus] + args: [--py37-plus] - repo: https://github.com/asottile/add-trailing-comma rev: v2.2.1 hooks: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 692b375..a592ea9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,10 +10,10 @@ resources: type: github endpoint: github name: asottile/azure-pipeline-templates - ref: refs/tags/v2.1.0 + ref: refs/tags/v2.4.0 jobs: - template: job--python-tox.yml@asottile parameters: - toxenvs: [py36, py37] + toxenvs: [py37, py38, py39, py310] os: linux diff --git a/blacken_docs.py b/blacken_docs.py index 5b31d51..ba6f39e 100644 --- a/blacken_docs.py +++ b/blacken_docs.py @@ -1,14 +1,13 @@ +from __future__ import annotations + import argparse import contextlib import re import textwrap from typing import Generator -from typing import List from typing import Match from typing import NamedTuple -from typing import Optional from typing import Sequence -from typing import Tuple import black @@ -85,8 +84,8 @@ class CodeBlockError(NamedTuple): def format_str( src: str, black_mode: black.FileMode, -) -> Tuple[str, Sequence[CodeBlockError]]: - errors: List[CodeBlockError] = [] +) -> tuple[str, Sequence[CodeBlockError]]: + errors: list[CodeBlockError] = [] @contextlib.contextmanager def _collect_error(match: Match[str]) -> Generator[None, None, None]: @@ -214,7 +213,7 @@ def format_file( return 0 -def main(argv: Optional[Sequence[str]] = None) -> int: +def main(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser() parser.add_argument( '-l', '--line-length', type=int, default=black.DEFAULT_LINE_LENGTH, diff --git a/setup.cfg b/setup.cfg index d02ef86..0bde279 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,7 +13,6 @@ classifiers = License :: OSI Approved :: MIT License Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: Implementation :: CPython @@ -23,7 +22,7 @@ classifiers = py_modules = blacken_docs install_requires = black>=19.3b0 -python_requires = >=3.6.1 +python_requires = >=3.7 [options.entry_points] console_scripts = diff --git a/setup.py b/setup.py index 8bf1ba9..3d93aef 100644 --- a/setup.py +++ b/setup.py @@ -1,2 +1,4 @@ +from __future__ import annotations + from setuptools import setup setup() diff --git a/tests/blacken_docs_test.py b/tests/blacken_docs_test.py index a94afd3..5bacc66 100644 --- a/tests/blacken_docs_test.py +++ b/tests/blacken_docs_test.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import black import blacken_docs diff --git a/tox.ini b/tox.ini index 894a3ea..7964894 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36,py37,pre-commit +envlist = py37,pre-commit [testenv] deps = -rrequirements-dev.txt