diff mbox series

[06/17] rt-tests: get_cyclictest_snapshot: print_warning should be a classmethod

Message ID 20211111204207.10167-6-jkacur@redhat.com
State New
Headers show
Series [01/17] rt-tests:hwlatdetect: Remove useless object in class declaration | expand

Commit Message

John Kacur Nov. 11, 2021, 8:41 p.m. UTC
Make print_warning a class method since it only references a class
variable and doesn't require self

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/cyclictest/get_cyclictest_snapshot.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/src/cyclictest/get_cyclictest_snapshot.py b/src/cyclictest/get_cyclictest_snapshot.py
index aed9681e4cc5..aedc72001fb2 100755
--- a/src/cyclictest/get_cyclictest_snapshot.py
+++ b/src/cyclictest/get_cyclictest_snapshot.py
@@ -21,10 +21,11 @@  class Snapshot:
 
     warned = False
 
-    def print_warning():
+    @classmethod
+    def print_warning(cls):
         """ print a warning one time only even if called multiple times """
-        if not Snapshot.warned:
-            Snapshot.warned = True
+        if not cls.warned:
+            cls.warned = True
             print("No cyclictest instance found")
 
     def __init__(self):