Salome HOME
Improvement and extension of EnKF algorithm (EnKS)
[modules/adao.git] / src / daComposant / daCore / Aidsm.py
index 28a515abdea542576d375589205a027e4034222e..a981db1b3330e1a1e0e4af1020af85a952e71c4e 100644 (file)
@@ -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