summaryrefslogtreecommitdiff
path: root/coverage/debug.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2023-02-11 17:59:25 -0500
committerNed Batchelder <ned@nedbatchelder.com>2023-02-11 17:59:25 -0500
commit6bc043981f6548852844ea6b16d5ef7d37c0417d (patch)
tree5d10b3c3063feae47d909d2b722d3ff8624a49ae /coverage/debug.py
parent151d3a74857b174ee4d852b98a0e1a7ef4f73427 (diff)
downloadpython-coveragepy-git-6bc043981f6548852844ea6b16d5ef7d37c0417d.tar.gz
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
Diffstat (limited to 'coverage/debug.py')
-rw-r--r--coverage/debug.py8
1 files changed, 6 insertions, 2 deletions
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