From 6bc043981f6548852844ea6b16d5ef7d37c0417d Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 11 Feb 2023 17:59:25 -0500 Subject: refactor: use placebos instead of non-existent attributes Details of the problem and thought process: https://nedbatchelder.com/blog/202302/late_initialization_with_mypy.html --- coverage/debug.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'coverage/debug.py') diff --git a/coverage/debug.py b/coverage/debug.py index 12233959..d56a66bb 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -105,9 +105,13 @@ class DebugControlString(DebugControl): return cast(str, self.raw_output.getvalue()) # type: ignore -class NoDebugging: +class NoDebugging(DebugControl): """A replacement for DebugControl that will never try to do anything.""" - def should(self, option: str) -> bool: # pylint: disable=unused-argument + def __init__(self) -> None: + # pylint: disable=super-init-not-called + ... + + def should(self, option: str) -> bool: """Should we write debug messages? Never.""" return False -- cgit v1.2.1