#NEWLINE# def compound_statements( logical_line ) : #NEWLINE# #INDENT# "\n    Compound statements (multiple statements on the same line) are\n    generally discouraged.\n\n    While sometimes it's okay to put an if/for/while with a small body\n    on the same line, never do this for multi-clause statements. Also\n    avoid folding such long lines!\n\n    Okay: if foo == 'blah':\\n    do_blah_thing()\n    Okay: do_one()\n    Okay: do_two()\n    Okay: do_three()\n\n    E701: if foo == 'blah': do_blah_thing()\n    E701: for x in lst: total += x\n    E701: while t < 10: t = delay()\n    E701: if foo == 'blah': do_blah_thing()\n    E701: else: do_non_blah_thing()\n    E701: try: something()\n    E701: finally: cleanup()\n    E701: if foo == 'blah': one(); two(); three()\n\n    E702: do_one(); do_two(); do_three()\n    " #NEWLINE# line = logical_line #NEWLINE# found = line . find ( ':' ) #NEWLINE# if ( ( - 1 ) < found < ( len ( line ) - 1 ) ) : #NEWLINE# #INDENT# before = line [ : found ] #NEWLINE# if ( ( before . count ( '{' ) <= before . count ( '}' ) ) and ( before . count ( '[' ) <= before . count ( ']' ) ) and ( before . count ( '(' ) <= before . count ( ')' ) ) and ( not LAMBDA_REGEX . search ( before ) ) ) : #NEWLINE# #INDENT# ( yield ( logical_line , 'E701 multiple statements on one line (colon)' ) ) #NEWLINE# #UNINDENT# #UNINDENT# found = line . find ( ';' ) #NEWLINE# if ( ( - 1 ) < found ) : #NEWLINE# #INDENT# ( yield ( found , 'E702 multiple statements on one line (semicolon)' ) )