X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FdaComposant%2FdaCore%2FPlatformInfo.py;h=533e729ee408a06a6097c4d141801152d0aaf72d;hb=0dcf34aa02ea5c2319204fbca51f6bc860406fde;hp=9101abe8ebf89f121e8c528be6e508d40ebd903f;hpb=44f76651d9b8e83d196d710205de80900f206472;p=modules%2Fadao.git diff --git a/src/daComposant/daCore/PlatformInfo.py b/src/daComposant/daCore/PlatformInfo.py index 9101abe..533e729 100644 --- a/src/daComposant/daCore/PlatformInfo.py +++ b/src/daComposant/daCore/PlatformInfo.py @@ -49,6 +49,7 @@ import sys import platform import locale import logging +import re # ============================================================================== class PlatformInfo(object): @@ -293,6 +294,34 @@ def date2int( __date, __lang="FR" ): raise ValueError("Cannot convert \"%s\" as a D/M/Y H:M date"%d) return __number +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