Show More
@@ -75,7 +75,7 b' class Command(BasePasterCommand):' | |||
|
75 | 75 | |
|
76 | 76 | dispatchfile = os.path.join(os.getcwd(), 'dispatch.py') |
|
77 | 77 | print 'Writing %s' % dispatchfile |
|
78 |
with |
|
|
78 | with open(dispatchfile, 'w') as f: | |
|
79 | 79 | f.write(dispath_py_template % { |
|
80 | 80 | 'inifile': config_file.replace('\\', '\\\\'), |
|
81 | 81 | 'virtualdir': args.virtualdir, |
@@ -283,9 +283,9 b' class TestNotifications(TestController):' | |||
|
283 | 283 | |
|
284 | 284 | outfn = os.path.join(os.path.dirname(__file__), 'test_dump_html_mails.out.html') |
|
285 | 285 | reffn = os.path.join(os.path.dirname(__file__), 'test_dump_html_mails.ref.html') |
|
286 |
with |
|
|
286 | with open(outfn, 'w') as f: | |
|
287 | 287 | f.write(out) |
|
288 |
with |
|
|
288 | with open(reffn) as f: | |
|
289 | 289 | ref = f.read() |
|
290 | 290 | assert ref == out # copy test_dump_html_mails.out.html to test_dump_html_mails.ref.html to update expectations |
|
291 | 291 | os.unlink(outfn) |
@@ -32,7 +32,7 b" headermatch = re.compile(r'''\\n*(.+)\\n([" | |||
|
32 | 32 | def main(): |
|
33 | 33 | for fn in subprocess.check_output(['hg', 'loc', 'set:**.rst+kallithea/i18n/how_to']).splitlines(): |
|
34 | 34 | print 'processing %s:' % fn |
|
35 |
s = |
|
|
35 | s = open(fn).read() | |
|
36 | 36 | |
|
37 | 37 | # find levels and their styles |
|
38 | 38 | lastpos = 0 |
@@ -71,7 +71,7 b' def main():' | |||
|
71 | 71 | s = s.strip() + '\n' |
|
72 | 72 | s = re.sub(r'''\n+((?:\.\. _[^\n]*\n)+)$''', r'\n\n\n\1', s) |
|
73 | 73 | |
|
74 |
|
|
|
74 | open(fn, 'w').write(s) | |
|
75 | 75 | print subprocess.check_output(['hg', 'diff', fn]) |
|
76 | 76 | |
|
77 | 77 |
@@ -90,12 +90,12 b' ini_files = [' | |||
|
90 | 90 | def main(): |
|
91 | 91 | # make sure all mako lines starting with '#' (the '##' comments) are marked up as <text> |
|
92 | 92 | print 'reading:', makofile |
|
93 |
mako_org = |
|
|
93 | mako_org = open(makofile).read() | |
|
94 | 94 | mako_no_text_markup = re.sub(r'</?%text>', '', mako_org) |
|
95 | 95 | mako_marked_up = re.sub(r'\n(##.*)', r'\n<%text>\1</%text>', mako_no_text_markup, flags=re.MULTILINE) |
|
96 | 96 | if mako_marked_up != mako_org: |
|
97 | 97 | print 'writing:', makofile |
|
98 |
|
|
|
98 | open(makofile, 'w').write(mako_marked_up) | |
|
99 | 99 | |
|
100 | 100 | # select the right mako conditionals for the other less sophisticated formats |
|
101 | 101 | def sub_conditionals(m): |
@@ -149,7 +149,7 b' def main():' | |||
|
149 | 149 | lines = re.sub(r'^([^#\n].*) = ?(.*)', process_line, lines, flags=re.MULTILINE) |
|
150 | 150 | return sectionname + '\n' + lines |
|
151 | 151 | ini_lines = re.sub(r'^(\[.*\])\n((?:(?:[^[\n].*)?\n)*)', process_section, ini_lines, flags=re.MULTILINE) |
|
152 |
|
|
|
152 | open(fn, 'w').write(ini_lines) | |
|
153 | 153 | |
|
154 | 154 | if __name__ == '__main__': |
|
155 | 155 | main() |
@@ -33,7 +33,7 b' res = [' | |||
|
33 | 33 | ] |
|
34 | 34 | |
|
35 | 35 | for f in sys.argv[1:]: |
|
36 |
s = |
|
|
36 | s = open(f).read() | |
|
37 | 37 | for r, t in res: |
|
38 | 38 | s = r.sub(t, s) |
|
39 |
|
|
|
39 | open(f, 'w').write(s) |
@@ -197,10 +197,10 b' def insert_entries(' | |||
|
197 | 197 | for name, years in name_years.items()] |
|
198 | 198 | l.sort(key=sortkey) |
|
199 | 199 | |
|
200 |
with |
|
|
200 | with open(filename) as f: | |
|
201 | 201 | pre, post = re.split(split_re, f.read()) |
|
202 | 202 | |
|
203 |
with |
|
|
203 | with open(filename, 'w') as f: | |
|
204 | 204 | f.write(pre + |
|
205 | 205 | ''.join(format_f(years, name) for years, name in l) + |
|
206 | 206 | post) |
General Comments 0
You need to be logged in to leave comments.
Login now