def fix_empty_methods(source):
def_indentation_level = <NUM_LIT:0><EOL>output = "<STR_LIT>"<EOL>just_matched = False<EOL>previous_line = None<EOL>method = re.compile(r'<STR_LIT>')<EOL>for line in source.split('<STR_LIT:\n>'):<EOL><INDENT>if len(line.strip()) > <NUM_LIT:0>: <EOL><INDENT>if just_matched == True:<EOL><INDENT>this_indentation_level = len(line.rstrip()) - len(line.strip())<EOL>if def_indentation_level == this_indentation_level:<EOL><INDENT>indent = "<STR_LIT:U+0020>" * (def_indentation_level + <NUM_LIT:1>)<EOL>output += "<STR_LIT>" % (previous_line, indent, line)<EOL><DEDENT>else:<EOL><INDENT>output += "<STR_LIT>" % (previous_line, line)<EOL><DEDENT>just_matched = False<EOL><DEDENT>elif method.match(line):<EOL><INDENT>def_indentation_level = len(line) - len(line.strip())<EOL>just_matched = True<EOL>previous_line = line<EOL><DEDENT>else:<EOL><INDENT>output += "<STR_LIT>" % line <EOL><DEDENT><DEDENT>else:<EOL><INDENT>output += "<STR_LIT:\n>"<EOL><DEDENT><DEDENT>return output<EOL>
Appends 'pass' to empty methods/functions (i.e. where there was nothing but
a docstring before we removed it =).

Example::

    # Note: This triple-single-quote inside a triple-double-quote is also a
    # pyminifier self-test
    def myfunc():
        '''This is just a placeholder function.'''

Will become::

    def myfunc(): pass