from celery.task import Task
class Decayer(Task):
def calc_decay_value(self, x):
y = (1.0/(2^x))
return y
def calc_decay_time(self, x):
y = 2^x
return y
def run(self, d, **kwargs):
#do stuff.
return 0
>>> decayer = tasks.Decayer(r)
Traceback (most recent call last):
File "scanDecay.py", line 31, in <module>
decayer = tasks.Decayer(r)
TypeError: object.__new__() takes no parameters
from celery.task import Task class Decayer(Task): def calc_decay_value(self, x): y = (1.0/(2^x)) return y
Share
Two errors
1) Your class doesn’t have an
__init__function. Either add one, or use this instead:2) You are trying to raise an integer to the power of a float, but
^means xor and cannot be used on floats. Use**instead of^: