#NEWLINE# def generate( full_path ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# chosen = random . sample ( set ( common . sentences ) , 10 ) #NEWLINE# for i in range ( 10 ) : #NEWLINE# #INDENT# sentence = chosen [ i ] #NEWLINE# newsentence = '' #NEWLINE# for j in range ( len ( sentence ) ) : #NEWLINE# #INDENT# if ( ( sentence [ j ] in ( string . ascii_uppercase + string . ascii_lowercase ) ) and ( random . randint ( 1 , 2 ) == 2 ) ) : #NEWLINE# #INDENT# newsentence += chr ( ( ord ( sentence [ j ] ) ^ 32 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# newsentence += sentence [ j ] #NEWLINE# #UNINDENT# #UNINDENT# sentence = full_path #NEWLINE# inverted = '' #NEWLINE# for j in range ( len ( sentence ) ) : #NEWLINE# #INDENT# c = sentence [ j ] #NEWLINE# if ( c in ( string . ascii_uppercase + string . ascii_lowercase ) ) : #NEWLINE# #INDENT# inverted += chr ( ( ord ( c ) ^ 32 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# inverted += sentence [ j ] #NEWLINE# #UNINDENT# #UNINDENT# f = open ( ( ( ( ( full_path + os . sep ) + 'test' ) + str ( i ) ) + '.in' ) , 'w' ) #NEWLINE# f . write ( ( '%s\n' % inverted ) ) #NEWLINE# f . close ( ) #NEWLINE# f = open ( ( ( ( ( full_path + os . sep ) + 'test' ) + str ( i ) ) + '.out' ) , 'w' ) #NEWLINE# f . write ( ( '%s\n' % sentence ) ) #NEWLINE# f . close ( ) #NEWLINE# #UNINDENT# return 1 #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# traceback . print_exc ( ) #NEWLINE# return 0