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