mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
function name included in generator instance variables and genList[3]
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# NOTE: not anymore. but still leaving this comment in.
|
||||
from mathgenerator.mathgen import *
|
||||
|
||||
|
||||
def array2markdown_table(string):
|
||||
string = string.replace("[[", "<table><tr><td>")
|
||||
string = string.replace("[", "<tr><td>")
|
||||
@@ -20,29 +21,31 @@ with open('mathgenerator/mathgen.py', 'r') as f:
|
||||
|
||||
allRows = []
|
||||
# get the first line of the functions in mathgen.py
|
||||
line = lines.index('# Funcs_start - DO NOT REMOVE!\n') + 1
|
||||
# line = lines.index('# Funcs_start - DO NOT REMOVE!\n') + 1
|
||||
for item in wList:
|
||||
myGen = item[2]
|
||||
# NOTE: renamed 'sol' to 'solu' to make it look nicer
|
||||
# print(item[3])
|
||||
prob, solu = myGen()
|
||||
prob = str(prob).rstrip("\n")
|
||||
solu = str(solu).rstrip("\n")
|
||||
# edge case for matrixMultiplication
|
||||
if item[0] == 46:
|
||||
prob, solu = myGen(10, 4)
|
||||
prob, solu = myGen(maxVal=10, max_dim=4)
|
||||
prob = str(prob).rstrip("\n")
|
||||
solu = str(solu).rstrip("\n")
|
||||
prob = array2markdown_table(prob)
|
||||
solu = array2markdown_table(solu)
|
||||
|
||||
instName = lines[line]
|
||||
# instName = lines[line]
|
||||
# NOTE: renamed 'def_name' to 'func_name' because it suits it more
|
||||
func_name = instName[:instName.find('=')].strip()
|
||||
#func_name = instName[:instName.find('=')].strip()
|
||||
func_name = item[3]
|
||||
row = [myGen.id, myGen.title, prob, solu, func_name]
|
||||
print('added', item[1],'-', func_name, 'to the README.md')
|
||||
line += 1
|
||||
if line > len(lines):
|
||||
break
|
||||
print('added', item[1], '-', func_name, 'to the README.md')
|
||||
# line += 1
|
||||
# if line > len(lines):
|
||||
# break
|
||||
allRows.append(row)
|
||||
|
||||
with open('README.md', "r") as g:
|
||||
|
||||
Reference in New Issue
Block a user