<s> from __future__ import print_function <EOL> import os <EOL> import pickle <EOL> outputs = [ ] <EOL> crontabs = [ ] <EOL> tasks = { } <EOL> FILE = "<STR_LIT>" <EOL> if os . path . isfile ( FILE ) : <EOL> tasks = pickle . load ( open ( FILE , '<STR_LIT:rb>' ) ) <EOL> def process_message ( data ) : <EOL> global tasks <EOL> channel = data [ "<STR_LIT>" ] <EOL> text = data [ "<STR_LIT:text>" ] <EOL> if channel . startswith ( "<STR_LIT:D>" ) : <EOL> if channel not in tasks . keys ( ) : <EOL> tasks [ channel ] = [ ] <EOL> if text . startswith ( "<STR_LIT>" ) : <EOL> tasks [ channel ] . append ( text [ <NUM_LIT:5> : ] ) <EOL> outputs . append ( [ channel , "<STR_LIT>" ] ) <EOL> if text == "<STR_LIT>" : <EOL> output = "<STR_LIT>" <EOL> counter = <NUM_LIT:1> <EOL> for task in tasks [ channel ] : <EOL> output += "<STR_LIT>" % ( counter , task ) <EOL> counter += <NUM_LIT:1> <EOL> outputs . append ( [ channel , output ] ) <EOL> if text == "<STR_LIT>" : <EOL> tasks [ channel ] = [ ] <EOL> if text . startswith ( "<STR_LIT>" ) : <EOL> num = int ( text . split ( ) [ <NUM_LIT:1> ] ) - <NUM_LIT:1> <EOL> tasks [ channel ] . pop ( num ) <EOL> if text == "<STR_LIT>" : <EOL> print ( tasks ) <EOL> pickle . dump ( tasks , open ( FILE , "<STR_LIT:wb>" ) ) </s>
