+def strvect2liststr( __strvect ):
+ """
+ Fonction de secours, conversion d'une chaîne de caractères de
+ représentation de vecteur en une liste de chaînes de caractères de
+ représentation de flottants
+ """
+ for s in ("array", "matrix", "list", "tuple", "[", "]", "(", ")"):
+ __strvect = __strvect.replace(s,"") # Rien
+ for s in (",", ";"):
+ __strvect = __strvect.replace(s," ") # Blanc
+ return __strvect.split()
+
+def strmatrix2liststr( __strvect ):
+ """
+ Fonction de secours, conversion d'une chaîne de caractères de
+ représentation de matrice en une liste de chaînes de caractères de
+ représentation de flottants
+ """
+ for s in ("array", "matrix", "list", "tuple", "[", "(", "'", '"'):
+ __strvect = __strvect.replace(s,"") # Rien
+ __strvect = __strvect.replace(","," ") # Blanc
+ for s in ("]", ")"):
+ __strvect = __strvect.replace(s,";") # "]" et ")" par ";"
+ __strvect = re.sub(';\s*;',';',__strvect)
+ __strvect = __strvect.rstrip(";") # Après ^ et avant v
+ __strmat = [l.split() for l in __strvect.split(";")]
+ return __strmat
+
+def checkFileNameConformity( __filename, __warnInsteadOfPrint=True ):
+ if sys.platform.startswith("win") and len(__filename) > 256:
+ __conform = False
+ __msg = (" For some shared or older file systems on Windows, a file "+\
+ "name longer than 256 characters can lead to access problems."+\
+ "\n The name of the file in question is the following:"+\
+ "\n %s")%(__filename,)
+ if __warnInsteadOfPrint: logging.warning(__msg)
+ else: print(__msg)
+ else:
+ __conform = True
+ #
+ return __conform
+
+def checkFileNameImportability( __filename, __warnInsteadOfPrint=True ):
+ if str(__filename).count(".") > 1:
+ __conform = False
+ __msg = (" The file name contains %i point(s) before the extension "+\
+ "separator, which can potentially lead to problems when "+\
+ "importing this file into Python, as it can then be recognized "+\
+ "as a sub-module (generating a \"ModuleNotFoundError\"). If it "+\
+ "is intentional, make sure that there is no module with the "+\
+ "same name as the part before the first point, and that there is "+\
+ "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 is None: pass
+ elif __warnInsteadOfPrint: logging.warning(__msg)
+ else: print(__msg)
+ else:
+ __conform = True
+ #
+ return __conform
+