From 87ac297c016743dabe23f6543bdc68255a8bb53a Mon Sep 17 00:00:00 2001 From: "Brandon T. Willard" Date: Thu, 22 Jun 2023 12:38:33 -0500 Subject: [PATCH] Deprecate Python 3.7 and update pre-commit hooks --- .github/workflows/tests.yml | 3 +-- .pre-commit-config.yaml | 22 ++++++++++++++++++---- cons/core.py | 3 --- cons/unify.py | 1 - setup.py | 2 +- tests/test_cons.py | 5 ----- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0389970..190c6e8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -62,11 +62,10 @@ jobs: strategy: matrix: python-version: - - 3.7 - 3.8 - 3.9 - '3.10' - - pypy3 + - '3.11' steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d7093c..246c252 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,16 +6,30 @@ exclude: | bin/.* )$ repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: debug-statements + - id: check-merge-conflict - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 23.3.0 hooks: - id: black language_version: python3 - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 + - repo: https://github.com/pycqa/flake8 + rev: 6.0.0 hooks: - id: flake8 - repo: https://github.com/pycqa/isort - rev: 5.7.0 + rev: 5.12.0 hooks: - id: isort + - repo: https://github.com/humitos/mirrors-autoflake.git + rev: v1.1 + hooks: + - id: autoflake + exclude: | + (?x)^( + .*/?__init__\.py| + )$ + args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable'] diff --git a/cons/core.py b/cons/core.py index a080836..712cef3 100644 --- a/cons/core.py +++ b/cons/core.py @@ -100,7 +100,6 @@ def __new__(cls, *parts): @classmethod def cons_merge(cls, car_part, cdr_part): - if cdr_part is None: cdr_part = default_ConsNull() @@ -108,7 +107,6 @@ def cons_merge(cls, car_part, cdr_part): cdr_part = cdr_part.items() if isinstance(cdr_part, ItemsView): - return OrderedDict(chain((car_part,), cdr_part)) elif hasattr(cdr_part, "__add__") or hasattr(cdr_part, "__radd__"): @@ -142,7 +140,6 @@ def __str__(self): class MaybeConsType(ABCMeta): def __subclasscheck__(self, o): - if issubclass(o, tuple(_cdr.funcs.keys())) and not issubclass(o, NonCons): return True diff --git a/cons/unify.py b/cons/unify.py index d7fec16..02384a7 100644 --- a/cons/unify.py +++ b/cons/unify.py @@ -7,7 +7,6 @@ def _unify_Cons(lcons, rcons, s): - lcons_ = lcons rcons_ = rcons diff --git a/setup.py b/setup.py index 557af57..706179b 100644 --- a/setup.py +++ b/setup.py @@ -30,10 +30,10 @@ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries", diff --git a/tests/test_cons.py b/tests/test_cons.py index 5fe9ef4..f8f4124 100644 --- a/tests/test_cons.py +++ b/tests/test_cons.py @@ -10,7 +10,6 @@ def test_noncons_type(): - with pytest.raises(TypeError): NonCons() @@ -50,7 +49,6 @@ def test_cons_type(): def test_cons_null(): - with pytest.raises(TypeError): ConsNull() @@ -68,7 +66,6 @@ def test_cons_null(): def test_proper_sequence_type(): - with pytest.raises(TypeError): ProperSequence() @@ -87,7 +84,6 @@ def test_proper_sequence_type(): def test_cons_join(): - with pytest.raises(ValueError): cons("a") @@ -138,7 +134,6 @@ def test_cons_class(): def test_car_cdr(): - with pytest.raises(ConsError): car(object())