|
|
70cd8c0 |
--- examples/convert.py.orig 2019-02-26 06:33:35.000000000 -0700
|
|
|
70cd8c0 |
+++ examples/convert.py 2019-03-27 21:06:59.365046783 -0600
|
|
|
70cd8c0 |
@@ -1,4 +1,4 @@
|
|
|
70cd8c0 |
-#!/usr/bin/python
|
|
|
70cd8c0 |
+#!/usr/bin/python3
|
|
|
70cd8c0 |
|
|
|
70cd8c0 |
# This is a simple python script to convert a short markdown
|
|
|
70cd8c0 |
# document into a jupyter notebook that can be run to show the
|
|
|
70cd8c0 |
@@ -85,7 +85,7 @@ image = """
|
|
|
70cd8c0 |
def process_file ( mdfile ):
|
|
|
70cd8c0 |
# "Verify" the file is an .md file
|
|
|
70cd8c0 |
if mdfile[-3:] != '.md':
|
|
|
70cd8c0 |
- print "Input file must have extension .md: " + mdfile
|
|
|
70cd8c0 |
+ print("Input file must have extension .md: " + mdfile)
|
|
|
70cd8c0 |
sys.exit()
|
|
|
70cd8c0 |
|
|
|
70cd8c0 |
# Read the input file and store it in this format:
|
|
|
70cd8c0 |
@@ -96,8 +96,8 @@ def process_file ( mdfile ):
|
|
|
70cd8c0 |
# [ "code", [ "G := Group((1,2),(3,4));\n" ] ],
|
|
|
70cd8c0 |
# ...
|
|
|
70cd8c0 |
# ]
|
|
|
70cd8c0 |
- print "Processing: " + mdfile
|
|
|
70cd8c0 |
- print "\tReading file..."
|
|
|
70cd8c0 |
+ print("Processing: " + mdfile)
|
|
|
70cd8c0 |
+ print("\tReading file...")
|
|
|
70cd8c0 |
lines = [ ]
|
|
|
70cd8c0 |
mode = 'markdown'
|
|
|
70cd8c0 |
inf = open( mdfile, 'r' )
|
|
|
70cd8c0 |
@@ -152,7 +152,7 @@ def process_file ( mdfile ):
|
|
|
70cd8c0 |
# Write the .ipynb output file in this same folder.
|
|
|
70cd8c0 |
outfile = mdfile[:-3] + '.ipynb'
|
|
|
70cd8c0 |
seen_code_yet = False
|
|
|
70cd8c0 |
- print "\tWriting " + outfile + "..."
|
|
|
70cd8c0 |
+ print("\tWriting " + outfile + "...")
|
|
|
70cd8c0 |
outf = open( outfile, 'w' )
|
|
|
70cd8c0 |
outf.write( header )
|
|
|
70cd8c0 |
for index, line in enumerate( lines ):
|
|
|
70cd8c0 |
@@ -174,7 +174,7 @@ def process_file ( mdfile ):
|
|
|
70cd8c0 |
# Replace markdown headings with AutoDoc headings,
|
|
|
70cd8c0 |
# then write the .gd output file in the ../lib/ folder.
|
|
|
70cd8c0 |
outfname = "../lib/ch2-examples-" + mdfile[:-3] + ".gd"
|
|
|
70cd8c0 |
- print "\tWriting " + outfname + "..."
|
|
|
70cd8c0 |
+ print("\tWriting " + outfname + "...")
|
|
|
70cd8c0 |
outf = open( outfname, 'w' )
|
|
|
70cd8c0 |
outf.write( "#! @Chapter Examples\n" );
|
|
|
70cd8c0 |
for line in lines:
|
|
|
70cd8c0 |
@@ -199,11 +199,11 @@ for fname in os.listdir( "." ):
|
|
|
70cd8c0 |
if fname[-3:] == ".md":
|
|
|
70cd8c0 |
process_file( fname )
|
|
|
70cd8c0 |
converted += [ fname ]
|
|
|
70cd8c0 |
-print "Done."
|
|
|
70cd8c0 |
-print "Don't forget to open each X.ipynb file generated this " + \
|
|
|
70cd8c0 |
+print("Done.")
|
|
|
70cd8c0 |
+print("Don't forget to open each X.ipynb file generated this " + \
|
|
|
70cd8c0 |
"way, run all cells, and save the final image created " + \
|
|
|
70cd8c0 |
- "as ../doc/X.png so that it can be included in the docs."
|
|
|
70cd8c0 |
-print "You can copy and paste these commands to make it easier:"
|
|
|
70cd8c0 |
+ "as ../doc/X.png so that it can be included in the docs.")
|
|
|
70cd8c0 |
+print("You can copy and paste these commands to make it easier:")
|
|
|
70cd8c0 |
for name in converted:
|
|
|
70cd8c0 |
- print "jupyter notebook " + name
|
|
|
70cd8c0 |
+ print("jupyter notebook " + name)
|
|
|
70cd8c0 |
|
|
|
70cd8c0 |
--- extract_examples.py.orig 2019-02-26 06:33:35.000000000 -0700
|
|
|
70cd8c0 |
+++ extract_examples.py 2019-03-27 21:06:59.378046751 -0600
|
|
|
70cd8c0 |
@@ -1,4 +1,4 @@
|
|
|
70cd8c0 |
-#!/usr/bin/python
|
|
|
70cd8c0 |
+#!/usr/bin/python3
|
|
|
70cd8c0 |
|
|
|
70cd8c0 |
# This is a simple python script to look through all the GAP code
|
|
|
70cd8c0 |
# and documentation in the lib/ folder of this repository, find
|
|
|
70cd8c0 |
@@ -70,7 +70,7 @@ codecell = """
|
|
|
70cd8c0 |
snippets = [ ]
|
|
|
70cd8c0 |
def process_file ( gdfile ):
|
|
|
70cd8c0 |
global snippets
|
|
|
70cd8c0 |
- print "Processing " + gdfile + "..."
|
|
|
70cd8c0 |
+ print("Processing " + gdfile + "...")
|
|
|
70cd8c0 |
mode = "not in a snippet"
|
|
|
70cd8c0 |
inf = open( gdfile, "r" )
|
|
|
70cd8c0 |
for line in inf.readlines():
|
|
|
70cd8c0 |
@@ -87,7 +87,7 @@ def process_file ( gdfile ):
|
|
|
70cd8c0 |
outfile = "extracted_snippets.ipynb"
|
|
|
70cd8c0 |
def write_all ():
|
|
|
70cd8c0 |
global snippets, outfile
|
|
|
70cd8c0 |
- print "Writing " + outfile + "..."
|
|
|
70cd8c0 |
+ print("Writing " + outfile + "...")
|
|
|
70cd8c0 |
outf = open( outfile, "w" )
|
|
|
70cd8c0 |
outf.write( header )
|
|
|
70cd8c0 |
outf.write( mdcell % ( json.dumps( [ \
|
|
|
70cd8c0 |
@@ -109,6 +109,6 @@ for fname in os.listdir( "lib" ):
|
|
|
70cd8c0 |
if fname[-3:] == ".gd":
|
|
|
70cd8c0 |
process_file( "lib/" + fname )
|
|
|
70cd8c0 |
write_all()
|
|
|
70cd8c0 |
-print "Done. You can open the resulting file with this command:"
|
|
|
70cd8c0 |
-print "jupyter notebook " + outfile
|
|
|
70cd8c0 |
+print("Done. You can open the resulting file with this command:")
|
|
|
70cd8c0 |
+print("jupyter notebook " + outfile)
|
|
|
70cd8c0 |
|