Index: compile_rules_graph.py ================================================================== --- compile_rules_graph.py +++ compile_rules_graph.py @@ -8,10 +8,11 @@ import time import concurrent.futures import darg import compile_rules_js_convert as jsconv +import helpers #### PROCESS POOL EXECUTOR #### xProcessPoolExecutor = None @@ -575,11 +576,11 @@ dAllGraph[sGraphName] = dGraph dAllActions.update(dActions) sPyCallables += sPy sJSCallables += sJS # create a dictionary of URL - dTempURL = {} + dTempURL = { "": 0 } i = 1 for sKey, lValue in dAllActions.items(): if lValue[3] == "-": if lValue[-1]: if lValue[-1] not in dTempURL: @@ -587,20 +588,20 @@ i += 1 lValue[-1] = dTempURL[lValue[-1]] else: lValue[-1] = 0 dURL = { v: k for k, v in dTempURL.items() } # reversing key and values - dURL[0] = "" # end print(" Total: ", nRule, "rules, ", len(dAllActions), "actions") print(" Build time: {:.2f} s".format(time.time() - fStartTimer)) return { # the graphs describe paths of tokens to actions which eventually execute callables - "rules_graphs": str(dAllGraph), + "rules_graphs": str(dAllGraph), # helpers.convertDictToString(dAllGraph) + "rules_actions": helpers.convertDictToString(dAllActions), # str(dAllActions) + "rules_graph_URL": helpers.convertDictToString(dURL), # str(dURL) "rules_graphsJS": str(dAllGraph), - "rules_actions": str(dAllActions), "rules_actionsJS": jsconv.pyActionsToString(dAllActions), - "rules_graph_URL": str(dURL), + "rules_graph_URLJS": str(dURL), "graph_callables": sPyCallables, "graph_callablesJS": sJSCallables } Index: gc_core/js/lang_core/gc_rules_graph.js ================================================================== --- gc_core/js/lang_core/gc_rules_graph.js +++ gc_core/js/lang_core/gc_rules_graph.js @@ -12,14 +12,14 @@ var gc_rules_graph = { dAllGraph: ${rules_graphsJS}, dRule: ${rules_actionsJS}, - dURL: ${rules_graph_URL} + dURL: ${rules_graph_URLJS} }; if (typeof(exports) !== 'undefined') { exports.dAllGraph = gc_rules_graph.dAllGraph; exports.dRule = gc_rules_graph.dRule; exports.dURL = gc_rules_graph.dURL; } Index: gc_lang/fr/rules.grx ================================================================== --- gc_lang/fr/rules.grx +++ gc_lang/fr/rules.grx @@ -7463,11 +7463,11 @@ # m’a tuer __conf_m_a_tuer__ m’ a tuer <<- /conf/ -3>> tué|tuée - # Cliché. Évitez cette erreur de grammaire délibérée, faite d’innombrables fois, pour mimer l’affaire Omar Raddad.|https://fr.wikipedia.org/wiki/Omar_m'a_tuer + # Cliché. Évitez cette erreur de grammaire délibérée, faite d’innombrables fois, pour mimer l’affaire Omar Raddad.|https://fr.wikipedia.org/wiki/Omar_m%27a_tuer TEST: la réalité m’a {{tuer}} # après avoir Index: helpers.py ================================================================== --- helpers.py +++ helpers.py @@ -7,10 +7,25 @@ import errno import zipfile from string import Template + +def convertDictToString (dDict, nDepth=1, nIndent=2): + "returns as a indented string" + sResult = "{\n" + sIndent = " " * nIndent + for key, val in dDict.items(): + sKey = f"'{key}'" if type(key) is str else str(key) + if nDepth > 0 and type(val) is dict: + sVal = convertDictToString(val, nDepth-1, nIndent+nIndent) + else: + sVal = f"'{val}'" if type(val) is str else str(val) + sResult += f'{sIndent}{sKey}: {sVal},\n' + sResult = sResult + sIndent[:-2] + "}" + return sResult + class CD: "Context manager for changing the current working directory" def __init__ (self, newPath): self.newPath = os.path.expanduser(newPath)