make instances, not just use static methods
This commit is contained in:
parent
4cafe56c97
commit
b57407a03a
1 changed files with 5 additions and 3 deletions
|
@ -2,10 +2,12 @@ import random
|
||||||
|
|
||||||
|
|
||||||
class CheckerTemplate:
|
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
|
pass
|
||||||
|
|
||||||
def get_status():
|
def get_status(self):
|
||||||
latency = int(random.random() * 3000)
|
latency = int(random.random() * 3000)
|
||||||
if latency > 2500: # "simulate" a timeout
|
if latency > 2500: # "simulate" a timeout
|
||||||
return 0
|
return 0
|
||||||
|
@ -14,5 +16,5 @@ class CheckerTemplate:
|
||||||
else:
|
else:
|
||||||
return 100
|
return 100
|
||||||
|
|
||||||
def get_return_codes():
|
def get_return_codes(self):
|
||||||
return {0: "Down", 50: "Partial outage", 100: "Up"}
|
return {0: "Down", 50: "Partial outage", 100: "Up"}
|
||||||
|
|
Loading…
Reference in a new issue