<s> import json <EOL> import mailbox <EOL> import os <EOL> from optparse import OptionParser <EOL> from firetower import config <EOL> from firetower . redis_util import Redis <EOL> """<STR_LIT>""" <EOL> def main ( ) : <EOL> parser = OptionParser ( usage = '<STR_LIT>' ) <EOL> parser . add_option ( <EOL> '<STR_LIT:-c>' , '<STR_LIT>' , action = '<STR_LIT:store>' , dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> ( options , args ) = parser . parse_args ( ) <EOL> conf = config . Config ( options . conf_path ) <EOL> home = os . getenv ( '<STR_LIT>' ) <EOL> maildir_path = '<STR_LIT>' % ( home , ) <EOL> print '<STR_LIT>' , maildir_path <EOL> assert os . path . exists ( maildir_path ) <EOL> inbox = mailbox . Maildir ( maildir_path , factory = None ) <EOL> queue = Redis ( host = conf . redis_host , port = conf . redis_port ) <EOL> for message in inbox : <EOL> ft_dict = { } <EOL> ft_dict [ '<STR_LIT>' ] = message [ '<STR_LIT>' ] . split ( '<STR_LIT:U+0020>' ) [ <NUM_LIT:1> ] or '<STR_LIT>' <EOL> ft_dict [ '<STR_LIT>' ] = message . get_payload ( ) or '<STR_LIT>' <EOL> ft_dict [ '<STR_LIT:date>' ] = message . get_date ( ) <EOL> ft_dict [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if len ( ft_dict [ '<STR_LIT>' ] ) < <NUM_LIT> and isinstance ( ft_dict [ '<STR_LIT>' ] , str ) : <EOL> queue . push ( conf . queue_key , json . dumps ( ft_dict ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
