From 492f99cbcd6cf633d355be686372415392cf381c Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Fri, 19 Nov 2021 22:03:50 +0100 Subject: [PATCH] Minor documentation and code review corrections (7) --- bin/AdaoCatalogGenerator.py | 4 ++-- src/daComposant/daCore/Aidsm.py | 7 ++++--- src/daComposant/daCore/Templates.py | 8 ++------ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/bin/AdaoCatalogGenerator.py b/bin/AdaoCatalogGenerator.py index f8ee7ce..90de8a1 100644 --- a/bin/AdaoCatalogGenerator.py +++ b/bin/AdaoCatalogGenerator.py @@ -174,7 +174,7 @@ def F_{data_name}(statut, fv=NoCheckInNS) : return FACT( ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')[-1]\\nf='/tmp/analysis.txt'\\nprint('Analysis saved in \\"%s\\"'%f)\\nnumpy.savetxt(f,xa)" ), ), AnalysisPrinterAndSaver = BLOC (condition = " Template == 'AnalysisPrinterAndSaver' ", - ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')[-1]\\nprint 'Analysis:',xa\\nf='/tmp/analysis.txt'\\nprint('Analysis saved in \\"%s\\"'%f)\\nnumpy.savetxt(f,xa)" ), + ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')[-1]\\nprint('Analysis:',xa)\\nf='/tmp/analysis.txt'\\nprint('Analysis saved in \\"%s\\"'%f)\\nnumpy.savetxt(f,xa)" ), ), AnalysisSeriePrinter = BLOC (condition = " Template == 'AnalysisSeriePrinter' ", ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')\\nprint('Analysis:',xa)" ), @@ -183,7 +183,7 @@ def F_{data_name}(statut, fv=NoCheckInNS) : return FACT( ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')\\nf='/tmp/analysis.txt'\\nprint('Analysis saved in \\"%s\\"'%f)\\nnumpy.savetxt(f,xa)" ), ), AnalysisSeriePrinterAndSaver = BLOC (condition = " Template == 'AnalysisSeriePrinterAndSaver' ", - ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')\\nprint 'Analysis:',xa\\nf='/tmp/analysis.txt'\\nprint('Analysis saved in \\"%s\\"'%f)\\nnumpy.savetxt(f,xa)" ), + ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')\\nprint('Analysis:',xa)\\nf='/tmp/analysis.txt'\\nprint('Analysis saved in \\"%s\\"'%f)\\nnumpy.savetxt(f,xa)" ), ), ), ) diff --git a/src/daComposant/daCore/Aidsm.py b/src/daComposant/daCore/Aidsm.py index a10ac11..2dfe0f3 100644 --- a/src/daComposant/daCore/Aidsm.py +++ b/src/daComposant/daCore/Aidsm.py @@ -626,6 +626,7 @@ class Aidsm(object): asString = String, asScript = self.__with_directory(Script), ))) + return 0 # ----------------------------------------------------------- @@ -767,9 +768,9 @@ class Aidsm(object): self.__adaoObject["AlgorithmParameters"].executePythonScheme( self.__adaoObject ) if "UserPostAnalysis" in self.__adaoObject and len(self.__adaoObject["UserPostAnalysis"])>0: self.__objname = self.__retrieve_objname() - __Upa = map(str, self.__adaoObject["UserPostAnalysis"]) - __Upa = eval("\n".join(__Upa)) - exec(__Upa, {}, {'self':self, 'ADD':self, 'case':self, 'adaopy':self, self.__objname:self}) + for __UpaOne in self.__adaoObject["UserPostAnalysis"]: + __UpaOne = eval(str(__UpaOne)) + exec(__UpaOne, {}, {'self':self, 'ADD':self, 'case':self, 'adaopy':self, self.__objname:self}) return 0 def __executeYACSScheme(self, FileName=None): diff --git a/src/daComposant/daCore/Templates.py b/src/daComposant/daCore/Templates.py index 294cfd3..c92da5c 100644 --- a/src/daComposant/daCore/Templates.py +++ b/src/daComposant/daCore/Templates.py @@ -59,10 +59,6 @@ class TemplateStorage(object): __keys = sorted(self.__values.keys()) return __keys - # def has_key(self, name): - # "D.has_key(k) -> True if D has a key k, else False" - # return name in self.__values - def __contains__(self, name): "D.__contains__(k) -> True if D has a key k, else False" return name in self.__values @@ -244,7 +240,7 @@ UserPostAnalysisTemplates.store( ) UserPostAnalysisTemplates.store( name = "AnalysisPrinterAndSaver", - content = """print('# Post-analysis')\nimport numpy\nxa=ADD.get('Analysis')[-1]\nprint 'Analysis',xa\nf='/tmp/analysis.txt'\nprint('Analysis saved in \"%s\"'%f)\nnumpy.savetxt(f,xa)""", + content = """print('# Post-analysis')\nimport numpy\nxa=ADD.get('Analysis')[-1]\nprint('Analysis',xa)\nf='/tmp/analysis.txt'\nprint('Analysis saved in \"%s\"'%f)\nnumpy.savetxt(f,xa)""", fr_FR = "Imprime sur la sortie standard et, en même temps enregistre dans un fichier du répertoire '/tmp', la valeur optimale", en_EN = "Print on standard output and, in the same time save in a file of the '/tmp' directory, the optimal value", order = "next", @@ -265,7 +261,7 @@ UserPostAnalysisTemplates.store( ) UserPostAnalysisTemplates.store( name = "AnalysisSeriePrinterAndSaver", - content = """print('# Post-analysis')\nimport numpy\nxa=ADD.get('Analysis')\nprint 'Analysis',xa\nf='/tmp/analysis.txt'\nprint('Analysis saved in \"%s\"'%f)\nnumpy.savetxt(f,xa)""", + content = """print('# Post-analysis')\nimport numpy\nxa=ADD.get('Analysis')\nprint('Analysis',xa)\nf='/tmp/analysis.txt'\nprint('Analysis saved in \"%s\"'%f)\nnumpy.savetxt(f,xa)""", fr_FR = "Imprime sur la sortie standard et, en même temps enregistre dans un fichier du répertoire '/tmp', la série des valeurs optimales", en_EN = "Print on standard output and, in the same time save in a file of the '/tmp' directory, the optimal value series", order = "next", -- 2.39.2