<s> import sys <EOL> import re <EOL> from argparse import ArgumentParser <EOL> from pyth . plugins . rtf15 . reader import Rtf15Reader <EOL> from pyth . plugins . plaintext . writer import PlaintextWriter <EOL> import itertools <EOL> def parse_arguments ( ) : <EOL> """<STR_LIT>""" <EOL> parser = ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , required = True , help = '<STR_LIT>' ) <EOL> args = parser . parse_args ( ) <EOL> return args <EOL> def extract_terms ( rtffile ) : <EOL> """<STR_LIT>""" <EOL> judges_list = [ ] <EOL> rtf_text = PlaintextWriter . write ( rtffile ) . getvalue ( ) <EOL> lines = re . split ( '<STR_LIT:\n>' , rtf_text ) <EOL> for line in itertools . islice ( lines , <NUM_LIT:0> , None , <NUM_LIT:4> ) : <EOL> judges_list . append ( line ) <EOL> return judges_list <EOL> def main ( ) : <EOL> '''<STR_LIT>''' <EOL> args = parse_arguments ( ) <EOL> if args . url : <EOL> url = args . url <EOL> try : <EOL> with open ( url , '<STR_LIT:rb>' ) as rtffile : <EOL> judges = extract_terms ( Rtf15Reader . read ( rtffile ) ) <EOL> except IOError as e : <EOL> print '<STR_LIT>' % ( url , e . reason ) <EOL> return <NUM_LIT:1> <EOL> f = open ( '<STR_LIT>' , '<STR_LIT:w>' ) <EOL> for i in judges : <EOL> f . write ( ( i ) . encode ( '<STR_LIT:utf8>' ) + '<STR_LIT:\n>' ) <EOL> f . close ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> status = main ( ) <EOL> sys . exit ( status ) </s>
