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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make print_warning a class method since it only references a class
variable and doesn't require self

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

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):
-- 
2.31.1




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux