From b57407a03a4d4e96e08bffd2babc88db16d11a0d Mon Sep 17 00:00:00 2001 From: askiiart Date: Wed, 31 Jan 2024 12:57:36 -0600 Subject: [PATCH] make instances, not just use static methods --- checker_template.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/checker_template.py b/checker_template.py index b43c5d3..bddd7e7 100644 --- a/checker_template.py +++ b/checker_template.py @@ -2,10 +2,12 @@ import random class CheckerTemplate: - def __init__(arguments): + # has `self` since checkers *should* have instances + # it's not actually needed here though since it's just static methods + def __init__(self, arguments): pass - def get_status(): + def get_status(self): latency = int(random.random() * 3000) if latency > 2500: # "simulate" a timeout return 0 @@ -14,5 +16,5 @@ class CheckerTemplate: else: return 100 - def get_return_codes(): + def get_return_codes(self): return {0: "Down", 50: "Partial outage", 100: "Up"}