From c9a2b54c722f80bf295c512657b143f1d5127246 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 21:33:46 +0000 Subject: [PATCH 1/3] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.10 → v0.5.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.10...v0.5.0) - [github.com/python-jsonschema/check-jsonschema: 0.28.5 → 0.28.6](https://github.com/python-jsonschema/check-jsonschema/compare/0.28.5...0.28.6) - [github.com/tox-dev/pyproject-fmt: 1.8.0 → 2.1.3](https://github.com/tox-dev/pyproject-fmt/compare/1.8.0...2.1.3) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f78f4ac..8cd514f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.10 + rev: v0.5.0 hooks: - id: ruff args: [--exit-non-zero-on-fix] @@ -27,7 +27,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.5 + rev: 0.28.6 hooks: - id: check-github-workflows - id: check-renovate @@ -38,7 +38,7 @@ repos: - id: actionlint - repo: https://github.com/tox-dev/pyproject-fmt - rev: 1.8.0 + rev: 2.1.3 hooks: - id: pyproject-fmt additional_dependencies: [tox] From 5f28369357e38a6939421cbc71f2d2970988501c Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:17:29 +0300 Subject: [PATCH 2/3] Configure pyproject-fmt to add Python 3.13 classifier --- .pre-commit-config.yaml | 1 - pyproject.toml | 44 ++++++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8cd514f..74a9157 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,6 @@ repos: rev: 2.1.3 hooks: - id: pyproject-fmt - additional_dependencies: [tox] - repo: https://github.com/abravalheri/validate-pyproject rev: v0.18 diff --git a/pyproject.toml b/pyproject.toml index 24b212d..d783d04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,9 +15,13 @@ keywords = [ "keyboard", "search", ] -license = {text = "ISC"} -maintainers = [{name = "Hugo van Kemenade"}] -authors = [{name = "Kenneth Reitz", email = "me@kennethreitz.org"}] +license = { text = "ISC" } +maintainers = [ + { name = "Hugo van Kemenade" }, +] +authors = [ + { name = "Kenneth Reitz", email = "me@kennethreitz.org" }, +] requires-python = ">=3.8" classifiers = [ "Development Status :: 5 - Production/Stable", @@ -39,20 +43,16 @@ dynamic = [ "version", ] dependencies = [ - 'pyperclip; platform_system == "Darwin"', - 'pyperclip; platform_system == "Windows"', + "pyperclip; platform_system=='Windows'", ] -[project.optional-dependencies] -tests = [ +optional-dependencies.tests = [ "pytest", "pytest-cov", ] -[project.urls] -Changelog = "https://github.com/hugovk/em-keyboard/releases" -Homepage = "https://github.com/hugovk/em-keyboard" -Source = "https://github.com/hugovk/em-keyboard" -[project.scripts] -em = "em_keyboard:cli" +urls.Changelog = "https://github.com/hugovk/em-keyboard/releases" +urls.Homepage = "https://github.com/hugovk/em-keyboard" +urls.Source = "https://github.com/hugovk/em-keyboard" +scripts.em = "em_keyboard:cli" [tool.hatch] version.source = "vcs" @@ -63,8 +63,7 @@ local_scheme = "no-local-version" [tool.ruff] fix = true -[tool.ruff.lint] -select = [ +lint.select = [ "C4", # flake8-comprehensions "E", # pycodestyle errors "EM", # flake8-errmsg @@ -74,19 +73,24 @@ select = [ "LOG", # flake8-logging "PGH", # pygrep-hooks "PYI", # flake8-pyi - "RUF100", # unused noqa (yesqa) "RUF022", # unsorted-dunder-all + "RUF100", # unused noqa (yesqa) "UP", # pyupgrade "W", # pycodestyle warnings "YTT", # flake8-2020 ] -ignore = [ +lint.ignore = [ "E203", # Whitespace before ':' "E221", # Multiple spaces before operator "E226", # Missing whitespace around arithmetic operator "E241", # Multiple spaces after ',' ] +lint.isort.known-first-party = [ + "em_keyboard", +] +lint.isort.required-imports = [ + "from __future__ import annotations", +] -[tool.ruff.lint.isort] -known-first-party = ["em_keyboard"] -required-imports = ["from __future__ import annotations"] +[tool.pyproject-fmt] +max_supported_python = "3.13" From 039a846c614392af310276ab61de4097a8903032 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:20:53 +0300 Subject: [PATCH 3/3] Fix E721 --- tests/test_em.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_em.py b/tests/test_em.py index d4cee9d..6127114 100644 --- a/tests/test_em.py +++ b/tests/test_em.py @@ -35,7 +35,7 @@ def test_star(mock_print: MagicMock, mock_argparse: MagicMock, test_name: str) - mock_print.assert_called_once_with("Copied! ⭐") else: mock_print.assert_called_once_with("⭐") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -52,7 +52,7 @@ def test_not_found(mock_print: MagicMock, mock_argparse: MagicMock) -> None: # Assert mock_print.assert_called_once_with("") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 1 @@ -70,7 +70,7 @@ def test_no_copy(mock_print: MagicMock, mock_argparse: MagicMock) -> None: # Assert mock_print.assert_called_once_with("⭐") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -94,7 +94,7 @@ def test_search_star(mock_print: MagicMock, mock_argparse: MagicMock) -> None: # Assert for arg in expected: assert call(arg) in mock_print.call_args_list - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -117,7 +117,7 @@ def test_search_single_result_is_copied( mock_print.assert_called_once_with("Copied! 🇺🇦 flag_ukraine") else: mock_print.assert_called_once_with("🇺🇦 flag_ukraine") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -135,7 +135,7 @@ def test_search_not_found(mock_print: MagicMock, mock_argparse: MagicMock) -> No # Assert mock_print.assert_not_called() - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 1 @@ -157,7 +157,7 @@ def test_random(mock_print: MagicMock, mock_argparse: MagicMock) -> None: mock_print.assert_called_once_with("Copied! 😽 kissing_cat") else: mock_print.assert_called_once_with("😽 kissing_cat") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -176,7 +176,7 @@ def test_random_no_copy(mock_print: MagicMock, mock_argparse: MagicMock) -> None # Assert mock_print.assert_called_once_with("😽 kissing_cat") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -194,5 +194,5 @@ def test_no_name(mock_print: MagicMock, mock_argparse: MagicMock) -> None: # Assert mock_print.assert_not_called() - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == "Error: the 'name' argument is required"