make instances, not just use static methods

This commit is contained in:
askiiart 2024-01-31 12:57:36 -06:00
parent 4cafe56c97
commit b57407a03a
Signed by untrusted user who does not match committer: askiiart
GPG key ID: BC3800E55FB54D67

View file

@ -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"}