Salome HOME
Fixing iterating observation use (4)
[modules/adao.git] / src / daComposant / daCore / PlatformInfo.py
index f08b80a57659ec7b0cbb9007425ef8563e96b5ef..950e0bbb53fb528dba60d61ebab5bb2a642e3509 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
@@ -116,6 +116,12 @@ class PlatformInfo(object):
         __msg += "\n%s%30s : %s" %(__prefix,"sys.getfilesystemencoding",str(sys.getfilesystemencoding()))
         __msg += "\n%s%30s : %s" %(__prefix,"locale.getdefaultlocale",str(locale.getdefaultlocale()))
         __msg += "\n"
+        __msg += "\n%s%30s : %s" %(__prefix,"os.cpu_count",os.cpu_count())
+        if hasattr(os, 'sched_getaffinity'):
+            __msg += "\n%s%30s : %s" %(__prefix,"len(os.sched_getaffinity(0))",len(os.sched_getaffinity(0)))
+        else:
+            __msg += "\n%s%30s : %s" %(__prefix,"len(os.sched_getaffinity(0))","Unsupported on this platform")
+        __msg += "\n"
         __msg += "\n%s%30s : %s" %(__prefix,"platform.node",platform.node())
         __msg += "\n%s%30s : %s" %(__prefix,"os.path.expanduser",os.path.expanduser('~'))
         return __msg
@@ -253,9 +259,12 @@ def uniq( __sequence ):
 
 def isIterable( __sequence, __check = False, __header = "" ):
     """
-    Vérification que l'argument est un itérable
+    Vérification que l'argument est un itérable interne.
+    Remarque : pour permettre le test correct en MultiFonctions,
+    - Ne pas accepter comme itérable un "numpy.ndarray"
+    - Ne pas accepter comme itérable avec hasattr(__sequence, "__iter__")
     """
-    if  isinstance( __sequence, (list, tuple, map) ):
+    if  isinstance( __sequence, (list, tuple, map, dict) ):
         __isOk = True
     elif type(__sequence).__name__ in ('generator','range'):
         __isOk = True
@@ -310,8 +319,9 @@ def checkFileNameImportability( __filename, __warnInsteadOfPrint=True ):
             "no \"__init__.py\" file in the same directory."+\
             "\n  The name of the file in question is the following:"+\
             "\n  %s")%(int(str(__filename).count(".")-1), __filename)
-        if __warnInsteadOfPrint: logging.warning(__msg)
-        else:                    print(__msg)
+        if __warnInsteadOfPrint is None: pass
+        elif __warnInsteadOfPrint:       logging.warning(__msg)
+        else:                            print(__msg)
     else:
         __conform = True
     #