From df21f38cf67e1534aa403f943c4aa2f2c812d8c4 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Fri, 11 Oct 2024 19:04:12 -0400 Subject: [PATCH] py39+ Committed via https://github.com/asottile/all-repos --- .github/workflows/main.yml | 8 ++++---- .pre-commit-config.yaml | 4 ++-- classify_imports.py | 14 +++++++------- setup.cfg | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) 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/classify_imports.py b/classify_imports.py index 7068cf3..2028d12 100644 --- a/classify_imports.py +++ b/classify_imports.py @@ -7,9 +7,9 @@ import os.path import stat import sys +from collections.abc import Generator +from collections.abc import Iterable from typing import Callable -from typing import Generator -from typing import Iterable from typing import NamedTuple @@ -65,7 +65,7 @@ def _find_local(path: tuple[str, ...], base: str) -> bool: if sys.version_info >= (3, 10): # pragma: >=3.10 cover - @functools.lru_cache(maxsize=None) + @functools.cache def _get_app(app_dirs: tuple[str, ...]) -> tuple[str, ...]: app_dirs_ret = [] filtered_stats = set() @@ -81,7 +81,7 @@ def _get_app(app_dirs: tuple[str, ...]) -> tuple[str, ...]: return tuple(app_dirs_ret) - @functools.lru_cache(maxsize=None) + @functools.cache def classify_base(base: str, settings: Settings = Settings()) -> str: try: return _STATIC_CLASSIFICATIONS[base] @@ -103,7 +103,7 @@ def classify_base(base: str, settings: Settings = Settings()) -> str: _BUILTIN_MODS = frozenset(sys.builtin_module_names) - @functools.lru_cache(maxsize=None) + @functools.cache def _get_path( sys_path: tuple[str, ...], app_dirs: tuple[str, ...], @@ -149,7 +149,7 @@ def _get_path( ) return finder, tuple(app_dirs_ret) - @functools.lru_cache(maxsize=None) + @functools.cache def classify_base(base: str, settings: Settings = Settings()) -> str: try: return _STATIC_CLASSIFICATIONS[base] @@ -298,7 +298,7 @@ def __repr__(self) -> str: _import_type = {ast.Import: Import, ast.ImportFrom: ImportFrom} -@functools.lru_cache(maxsize=None) +@functools.cache def import_obj_from_str(s: str) -> Import | ImportFrom: node = ast.parse(s, mode='single').body[0] return _import_type[type(node)](node) diff --git a/setup.cfg b/setup.cfg index 3961021..9c73ad1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,7 +18,7 @@ classifiers = [options] py_modules = classify_imports -python_requires = >=3.8 +python_requires = >=3.9 [bdist_wheel] universal = True