<s> from __future__ import absolute_import <EOL> import datetime <EOL> from crontab import CronTab <EOL> class Task ( object ) : <EOL> def __init__ ( self , schedule , fn , ** options ) : <EOL> self . schedule = schedule <EOL> self . fn = fn <EOL> self . options = options <EOL> self . next_run = self . get_next_run ( schedule ) <EOL> def get_next_run ( self , schedule ) : <EOL> now = datetime . datetime . now ( ) <EOL> entry = CronTab ( schedule ) <EOL> delta = datetime . timedelta ( <NUM_LIT:0> , entry . next ( ) ) <EOL> return now + delta <EOL> def run ( self ) : <EOL> self . fn ( ** self . options ) <EOL> def __repr__ ( self ) : <EOL> return str ( self . next_run ) </s>
