def _mod_repo_in_file(alias, repostr, filepath):
 with open(filepath) as fhandle:
  output = []
  for line in fhandle:
   if (alias not in line):
    output.append(line)
   else:
    output.append((repostr + '\n'))
 with open(filepath, 'w') as fhandle:
  fhandle.writelines(output)

def _mod_repo_in_file ( alias , repostr , filepath ) : with open ( filepath ) as fhandle : output = [ ] for line in fhandle : if ( alias not in line ) : output . append ( line ) else : output . append ( ( repostr + '\n' ) ) with open ( filepath , 'w' ) as fhandle : fhandle . writelines ( output )
replace a repo entry in filepath with repostr .