Skip to content

Commit

Permalink
Use print_function in docs subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom committed Mar 11, 2011
1 parent 341c568 commit 2bc5b5e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
4 changes: 3 additions & 1 deletion doc/make.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env python

from __future__ import print_function
import fileinput
import glob
import os
Expand Down Expand Up @@ -58,7 +60,7 @@ def latex():

os.chdir('../..')
else:
print 'latex build has not been tested on windows'
print('latex build has not been tested on windows')

def clean():
shutil.rmtree("build", ignore_errors=True)
Expand Down
12 changes: 7 additions & 5 deletions doc/pyplots/make.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env python

from __future__ import print_function
import sys, os, glob
import matplotlib
import IPython.Shell
Expand All @@ -12,7 +14,7 @@
('pdf', 72)]

def figs():
print 'making figs'
print('making figs')
import matplotlib.pyplot as plt
for fname in glob.glob('*.py'):
if fname.split('/')[-1] == __file__.split('/')[-1]: continue
Expand All @@ -26,9 +28,9 @@ def figs():
break

if all_exists:
print ' already have %s'%fname
print(' already have %s'%fname)
else:
print ' building %s'%fname
print(' building %s'%fname)
plt.close('all') # we need to clear between runs
mplshell.magic_run(basename)
for imagefile, dpi in imagefiles.iteritems():
Expand All @@ -37,7 +39,7 @@ def figs():
# iles preventing them from getting built successfully
# later
plt.savefig(imagefile, dpi=dpi)
print 'all figures made'
print('all figures made')


def clean():
Expand All @@ -46,7 +48,7 @@ def clean():
for pattern in patterns:
for fname in glob.glob(pattern):
os.remove(fname)
print 'all clean'
print('all clean')



Expand Down
3 changes: 2 additions & 1 deletion doc/sphinxext/gen_rst.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
generate the rst files for the examples by iterating over the pylab examples
"""
from __future__ import print_function
import os, glob

import os
Expand Down Expand Up @@ -152,7 +153,7 @@ def generate_example_rst(app):

fhindex.close()

print
print()

def setup(app):
app.connect('builder-inited', generate_example_rst)
9 changes: 5 additions & 4 deletions doc/sphinxext/math_symbol_table.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import print_function
symbols = [
["Lower-case Greek",
5,
Expand Down Expand Up @@ -141,7 +142,7 @@ def setup(app):
# Do some verification of the tables
from matplotlib import _mathtext_data

print "SYMBOLS NOT IN STIX:"
print("SYMBOLS NOT IN STIX:")
all_symbols = {}
for category, columns, syms in symbols:
if category == "Standard Function Names":
Expand All @@ -151,9 +152,9 @@ def setup(app):
if len(sym) > 1:
all_symbols[sym[1:]] = None
if sym[1:] not in _mathtext_data.tex2uni:
print sym
print(sym)

print "SYMBOLS NOT IN TABLE:"
print("SYMBOLS NOT IN TABLE:")
for sym in _mathtext_data.tex2uni:
if sym not in all_symbols:
print sym
print(sym)
23 changes: 12 additions & 11 deletions doc/utils/pylab_names.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import print_function
"""
autogenerate some tables for pylab namespace
"""
Expand All @@ -14,7 +15,7 @@
doc = getattr(o, '__doc__', None)
if doc is not None:
doc = ' - '.join([line for line in doc.split('\n') if line.strip()][:2])

mod = getattr(o, '__module__', None)
if mod is None:
mod = 'unknown'
Expand All @@ -25,7 +26,7 @@
k = ':class:`~%s.%s`'%(mod, k)
else:
k = ':func:`~%s.%s`'%(mod, k)
mod = ':mod:`%s`'%mod
mod = ':mod:`%s`'%mod
elif mod.startswith('numpy'):
#k = '`%s <%s>`_'%(k, 'http://scipy.org/Numpy_Example_List_With_Doc#%s'%k)
k = '`%s <%s>`_'%(k, 'http://sd-2116.dedibox.fr/pydocweb/doc/%s.%s'%(mod, k))
Expand All @@ -40,21 +41,21 @@
mods.sort()
for mod in mods:
border = '*'*len(mod)
print mod
print border
print(mod)
print(border)

print
print()
funcs, docs = zip(*modd[mod])
maxfunc = max([len(f) for f in funcs])
maxdoc = max(40, max([len(d) for d in docs]) )
border = ' '.join(['='*maxfunc, '='*maxdoc])
print border
print ' '.join(['symbol'.ljust(maxfunc), 'description'.ljust(maxdoc)])
print border
print(border)
print(' '.join(['symbol'.ljust(maxfunc), 'description'.ljust(maxdoc)]))
print(border)
for func, doc in modd[mod]:
row = ' '.join([func.ljust(maxfunc), doc.ljust(maxfunc)])
print row
print(row)

print border
print
print(border)
print()
#break

0 comments on commit 2bc5b5e

Please sign in to comment.