From bedaab654527ba9d8accb307e12dd3004ddfaa30 Mon Sep 17 00:00:00 2001 From: Kate Case Date: Sat, 19 Oct 2024 08:52:44 -0400 Subject: [PATCH] Remove explicit self types (#4300) A few remain, but they are all orphaned instance methods, either mocks or in one case a property wrapper, where the type of self is not implicit. --- src/molecule/command/base.py | 2 +- src/molecule/scenario.py | 4 ++-- tests/unit/command/test_base.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/molecule/command/base.py b/src/molecule/command/base.py index 2ecbc9ac2..d6744966a 100644 --- a/src/molecule/command/base.py +++ b/src/molecule/command/base.py @@ -78,7 +78,7 @@ def __init_subclass__(cls) -> None: @abc.abstractmethod def execute( - self: Base, + self, action_args: list[str] | None = None, ) -> None: # pragma: no cover """Abstract method to execute the command. diff --git a/src/molecule/scenario.py b/src/molecule/scenario.py index bbe1cd832..0ec22baab 100644 --- a/src/molecule/scenario.py +++ b/src/molecule/scenario.py @@ -50,13 +50,13 @@ def __init__(self, config) -> None: # type: ignore[no-untyped-def] # noqa: ANN self.config = config self._setup() # type: ignore[no-untyped-call] - def _remove_scenario_state_directory(self: Scenario) -> None: + def _remove_scenario_state_directory(self) -> None: """Remove scenario cached disk stored state.""" directory = str(Path(self.ephemeral_directory).parent) LOG.info("Removing %s", directory) shutil.rmtree(directory) - def prune(self: Scenario) -> None: + def prune(self) -> None: """Prune the scenario ephemeral directory files and returns None. "safe files" will not be pruned, including the ansible configuration diff --git a/tests/unit/command/test_base.py b/tests/unit/command/test_base.py index 115e8506e..d25056e08 100644 --- a/tests/unit/command/test_base.py +++ b/tests/unit/command/test_base.py @@ -43,7 +43,7 @@ class ExtendedBase(base.Base): """ExtendedBase Class.""" - def execute(self: ExtendedBase, action_args: list[str] | None = None) -> None: + def execute(self, action_args: list[str] | None = None) -> None: """No-op the execute method. Args: