~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to docs/_ext/literals_to_xrefs.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (1.1.21) (4.4.27 sid)
  • Revision ID: package-import@ubuntu.com-20130509151047-aqv8d71oj9wvcv8c
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
]
39
39
 
40
40
def fixliterals(fname):
41
 
    data = open(fname).read()
 
41
    with open(fname) as fp:
 
42
        data = fp.read()
42
43
    
43
44
    last = 0
44
45
    new = []
101
102
        lastvalues[m.group(1)] = replace_value
102
103
    
103
104
    new.append(data[last:])
104
 
    open(fname, "w").write("".join(new))
 
105
    with open(fname, "w") as fp:
 
106
        fp.write("".join(new))
105
107
    
106
108
    storage["lastvalues"] = lastvalues
107
109
    storage.close()
136
138
        colorize('hello', fg='red', bg='blue', opts=('blink',))
137
139
        colorize()
138
140
        colorize('goodbye', opts=('underscore',))
139
 
        print colorize('first line', fg='red', opts=('noreset',))
140
 
        print 'this should be red too'
141
 
        print colorize('and so should this')
142
 
        print 'this should not be red'
 
141
        print(colorize('first line', fg='red', opts=('noreset',)))
 
142
        print('this should be red too')
 
143
        print(colorize('and so should this'))
 
144
        print('this should not be red')
143
145
    """
144
146
    color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
145
147
    foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
168
170
    try:
169
171
        fixliterals(sys.argv[1])
170
172
    except (KeyboardInterrupt, SystemExit):
171
 
        print
 
 
b'\\ No newline at end of file'
 
173
        print('')