From 34c90985fa88c1c63da817f663eed072173d625c Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Tue, 12 Nov 2024 16:47:34 +0000 Subject: [PATCH] Remove self type --- .github/workflows/tox.yml | 2 ++ .pre-commit-config.yaml | 18 +++++++++++------- pyproject.toml | 6 +++++- .../module_dispatcher/__init__.py | 2 +- src/pytest_ansible/module_dispatcher/v213.py | 2 +- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index e5c303b..4cac0f3 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -8,6 +8,8 @@ on: pull_request: branches: - "main" + schedule: + - cron: "0 0 * * *" workflow_call: concurrency: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7e1adf6..16c187d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,11 +44,6 @@ repos: - prettier-plugin-toml - prettier-plugin-sort-json - - repo: https://github.com/psf/black - rev: 24.10.0 - hooks: - - id: black - - repo: https://github.com/pappasam/toml-sort rev: v0.23.1 hooks: @@ -60,14 +55,23 @@ repos: - id: tox-ini-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.2 + rev: v0.7.3 hooks: - id: ruff args: + - --fix - --exit-non-zero-on-fix + types_or: [python, pyi] + - id: ruff-format # must be after ruff + types_or: [python, pyi] + + - repo: https://github.com/psf/black # must be after ruff + rev: 24.10.0 + hooks: + - id: black - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v8.15.2 + rev: v8.16.0 hooks: - id: cspell name: Spell check with cspell diff --git a/pyproject.toml b/pyproject.toml index e3fde75..97ec52d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -336,13 +336,17 @@ line-length = 100 target-version = "py310" [tool.ruff.lint] +ignore = [ + "COM812", # conflicts with ISC001 on format + "ISC001" # conflicts with COM812 on format +] select = ["ALL"] [tool.ruff.lint.flake8-pytest-style] parametrize-values-type = "tuple" [tool.ruff.lint.isort] -known-first-party = ["pytest_ansible"] +known-first-party = ["src"] lines-after-imports = 2 # Ensures consistency for cases when there's variable vs function/class definitions after imports lines-between-types = 1 # Separate import/from with 1 line required-imports = ["from __future__ import annotations"] diff --git a/src/pytest_ansible/module_dispatcher/__init__.py b/src/pytest_ansible/module_dispatcher/__init__.py index 2894a3a..accdb0d 100644 --- a/src/pytest_ansible/module_dispatcher/__init__.py +++ b/src/pytest_ansible/module_dispatcher/__init__.py @@ -73,7 +73,7 @@ def check_required_kwargs(self, **kwargs): # type: ignore[no-untyped-def] # no raise TypeError(msg) @abc.abstractmethod - def has_module(self: BaseModuleDispatcher, name: str) -> str: + def has_module(self, name: str) -> str: """Return whether ansible provides the requested module. Must be implemented by a sub-class. diff --git a/src/pytest_ansible/module_dispatcher/v213.py b/src/pytest_ansible/module_dispatcher/v213.py index 3d6d6bf..a2b33dc 100644 --- a/src/pytest_ansible/module_dispatcher/v213.py +++ b/src/pytest_ansible/module_dispatcher/v213.py @@ -84,7 +84,7 @@ def __init__(self, **kwargs) -> None: # type: ignore[no-untyped-def] # noqa: A msg = "Only supported with ansible-2.13 and newer" raise ImportError(msg) - def has_module(self: ModuleDispatcherV213, name: str) -> str: + def has_module(self, name: str) -> str: """Determine if a module exists and return the full name or "". Attributes: