Move assignment of backoff.x to the base class.

This commit is contained in:
voussoir 2021-05-03 18:31:58 -07:00
parent 7bfe0a48ef
commit 60abcbc8e3
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -18,6 +18,7 @@ calling end. For example, `bo.next() + (random.random() - 0.5)`.
'''
class Backoff:
def __init__(self, max):
self.x = 0
if max is None:
pass
elif max <= 0:
@ -49,7 +50,6 @@ class Exponential(Backoff):
'''
def __init__(self, a, b, *, max):
super().__init__(max)
self.x = 0
self.a = a
self.b = b
self.max = max
@ -63,7 +63,6 @@ class Linear(Backoff):
'''
def __init__(self, m, b, *, max):
super().__init__(max)
self.x = 0
self.m = m
self.b = b
self.max = max
@ -77,7 +76,6 @@ class Quadratic(Backoff):
'''
def __init__(self, a, b, c, *, max):
super().__init__(max)
self.x = 0
self.a = a
self.b = b
self.c = c