-def replace_file_with_string(target, new_contents, chmod=None, remove_if_empty=False):
+def replace_file_with_string(target, new_contents,
+ chmod=None, remove_if_empty=False):
"""
Replace a target file with a new contents
checks for changes: does not do anything if previous state was already right
"""
Replace a target file with a new contents
checks for changes: does not do anything if previous state was already right
# overwrite target file: create a temp in the same directory
path = os.path.dirname(target) or '.'
fd, name = tempfile.mkstemp('', 'repl', path)
# overwrite target file: create a temp in the same directory
path = os.path.dirname(target) or '.'
fd, name = tempfile.mkstemp('', 'repl', path)