X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FdaComposant%2FdaCore%2FAidsm.py;h=a981db1b3330e1a1e0e4af1020af85a952e71c4e;hb=c3059023647feca54ad621b0af00ef55127b59fa;hp=28a515abdea542576d375589205a027e4034222e;hpb=b22b4930c8b7598282046738afe49d955509c4d8;p=modules%2Fadao.git diff --git a/src/daComposant/daCore/Aidsm.py b/src/daComposant/daCore/Aidsm.py index 28a515a..a981db1 100644 --- a/src/daComposant/daCore/Aidsm.py +++ b/src/daComposant/daCore/Aidsm.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2008-2020 EDF R&D +# Copyright (C) 2008-2021 EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -507,12 +507,14 @@ class Aidsm(object): Parameters = None, Script = None): "Mise a jour d'un concept de calcul" - if "AlgorithmParameters" not in self.__adaoObject or self.__adaoObject["AlgorithmParameters"] is None: + Concept = "AlgorithmParameters" + if Concept not in self.__adaoObject or self.__adaoObject[Concept] is None: raise ValueError("\n\nNo algorithm registred, set one before updating parameters or executing\n") - self.__adaoObject["AlgorithmParameters"].updateParameters( + self.__adaoObject[Concept].updateParameters( asDict = Parameters, asScript = self.__with_directory(Script), ) + # RaJ du register return 0 def setRegulationParameters(self, @@ -704,10 +706,10 @@ class Aidsm(object): if os.path.isfile(os.path.join(trypath,fname)): root, ext = os.path.splitext(fname) if ext != ".py": continue - fc = open(os.path.join(trypath,fname)).read() - iselal = bool("class ElementaryAlgorithm" in fc) - if iselal and ext == '.py' and root != '__init__': - files.append(root) + with open(os.path.join(trypath,fname)) as fc: + iselal = bool("class ElementaryAlgorithm" in fc.read()) + if iselal and ext == '.py' and root != '__init__': + files.append(root) files.sort() return files