running libfuturize.fixes.fix_print_with_import
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
# created by Massimo Di Pierro
|
||||
# recreated by Vladyslav Kozlovskyy
|
||||
# license MIT/BSD/GPL
|
||||
from __future__ import print_function
|
||||
import re
|
||||
import urllib
|
||||
from cgi import escape
|
||||
@@ -45,11 +46,11 @@ Example of usage:
|
||||
``
|
||||
m = "Hello **world** [[link http://web2py.com]]"
|
||||
from markmin2html import markmin2html
|
||||
print markmin2html(m)
|
||||
print(markmin2html(m))
|
||||
from markmin2latex import markmin2latex
|
||||
print markmin2latex(m)
|
||||
print(markmin2latex(m))
|
||||
from markmin2pdf import markmin2pdf # requires pdflatex
|
||||
print markmin2pdf(m)
|
||||
print(markmin2pdf(m))
|
||||
``
|
||||
====================
|
||||
# This is a test block
|
||||
@@ -803,7 +804,7 @@ def render(text,
|
||||
>>> render("``aaa``:custom", extra=dict(custom=lambda text: 'x'+text+'x'))
|
||||
'xaaax'
|
||||
|
||||
>>> print render(r"$$\int_a^b sin(x)dx$$")
|
||||
>>> print(render(r"$$\int_a^b sin(x)dx$$"))
|
||||
<img src="http://chart.apis.google.com/chart?cht=tx&chl=%5Cint_a%5Eb%20sin%28x%29dx" />
|
||||
|
||||
>>> markmin2html(r"use backslash: \[\[[[mess\[[ag\]]e link]]\]]")
|
||||
@@ -1494,17 +1495,17 @@ if __name__ == '__main__':
|
||||
pre { background-color: #E0E0E0; padding: 5px; }
|
||||
</style>""")[1:]
|
||||
|
||||
print html % dict(title="Markmin markup language",
|
||||
print(html % dict(title="Markmin markup language",
|
||||
style=style,
|
||||
body=markmin2html(__doc__, pretty_print=True))
|
||||
body=markmin2html(__doc__, pretty_print=True)))
|
||||
elif sys.argv[1:2] == ['-t']:
|
||||
from timeit import Timer
|
||||
|
||||
loops = 1000
|
||||
ts = Timer("markmin2html(__doc__)", "from markmin2html import markmin2html")
|
||||
print 'timeit "markmin2html(__doc__)":'
|
||||
print('timeit "markmin2html(__doc__)":')
|
||||
t = min([ts.timeit(loops) for i in range(3)])
|
||||
print "%s loops, best of 3: %.3f ms per loop" % (loops, t / 1000 * loops)
|
||||
print("%s loops, best of 3: %.3f ms per loop" % (loops, t / 1000 * loops))
|
||||
elif len(sys.argv) > 1:
|
||||
fargv = open(sys.argv[1], 'r')
|
||||
try:
|
||||
@@ -1523,15 +1524,15 @@ if __name__ == '__main__':
|
||||
else:
|
||||
markmin_style = ""
|
||||
|
||||
print html % dict(title=sys.argv[1], style=markmin_style,
|
||||
body=markmin2html(markmin_text, pretty_print=True))
|
||||
print(html % dict(title=sys.argv[1], style=markmin_style,
|
||||
body=markmin2html(markmin_text, pretty_print=True)))
|
||||
finally:
|
||||
fargv.close()
|
||||
|
||||
else:
|
||||
print "Usage: " + sys.argv[0] + " -h | -t | file.markmin [file.css|@path_to/css]"
|
||||
print "where: -h - print __doc__"
|
||||
print " -t - timeit __doc__ (for testing purpuse only)"
|
||||
print " file.markmin [file.css] - process file.markmin + built in file.css (optional)"
|
||||
print " file.markmin [@path_to/css] - process file.markmin + link path_to/css (optional)"
|
||||
print("Usage: " + sys.argv[0] + " -h | -t | file.markmin [file.css|@path_to/css]")
|
||||
print("where: -h - print __doc__")
|
||||
print(" -t - timeit __doc__ (for testing purpuse only)")
|
||||
print(" file.markmin [file.css] - process file.markmin + built in file.css (optional)")
|
||||
print(" file.markmin [@path_to/css] - process file.markmin + link path_to/css (optional)")
|
||||
run_doctests()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# created my Massimo Di Pierro
|
||||
# license MIT/BSD/GPL
|
||||
from __future__ import print_function
|
||||
import re
|
||||
import cgi
|
||||
import sys
|
||||
@@ -309,4 +310,4 @@ if __name__ == '__main__':
|
||||
output = markmin2latex(content,
|
||||
wrapper=wrapper,
|
||||
chapters=options.chapters)
|
||||
print output
|
||||
print(output)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Created by Massimo Di Pierro
|
||||
License BSD
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
@@ -22,7 +23,7 @@ def removeall(path):
|
||||
__func__(path)
|
||||
except OSError as xxx_todo_changeme:
|
||||
(errno, strerror) = xxx_todo_changeme.args
|
||||
print ERROR_STR % {'path': path, 'error': strerror}
|
||||
print(ERROR_STR % {'path': path, 'error': strerror})
|
||||
|
||||
files = [path]
|
||||
|
||||
@@ -113,10 +114,10 @@ if __name__ == '__main__':
|
||||
if sys.argv[1:2] == ['-h']:
|
||||
data, warnings, errors = markmin2pdf(markmin2html.__doc__)
|
||||
if errors:
|
||||
print 'ERRORS:' + '\n'.join(errors)
|
||||
print 'WARNGINS:' + '\n'.join(warnings)
|
||||
print('ERRORS:' + '\n'.join(errors))
|
||||
print('WARNGINS:' + '\n'.join(warnings))
|
||||
else:
|
||||
print data
|
||||
print(data)
|
||||
elif len(sys.argv) > 1:
|
||||
fargv = open(sys.argv[1], 'rb')
|
||||
try:
|
||||
@@ -124,9 +125,9 @@ if __name__ == '__main__':
|
||||
finally:
|
||||
fargv.close()
|
||||
if errors:
|
||||
print 'ERRORS:' + '\n'.join(errors)
|
||||
print 'WARNGINS:' + '\n'.join(warnings)
|
||||
print('ERRORS:' + '\n'.join(errors))
|
||||
print('WARNGINS:' + '\n'.join(warnings))
|
||||
else:
|
||||
print data
|
||||
print(data)
|
||||
else:
|
||||
doctest.testmod()
|
||||
|
||||
Reference in New Issue
Block a user