X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=utils.py;h=ee321140f3d812909080c78f5af50e83e5f20c93;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=847f242d81ecdce849209e89b79d84495fa556f3;hpb=2f9cc8a307aeb75f6ee8c2c5c97f90acd5f3d53e;p=modules%2Fshaper.git diff --git a/utils.py b/utils.py index 847f242d8..ee321140f 100644 --- a/utils.py +++ b/utils.py @@ -1,24 +1,21 @@ -# coding: utf-8 - -## Copyright (C) 2014-2017 CEA/DEN, 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 -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -## -## See http:##www.salome-platform.org/ or -## email : webmaster.salome@opencascade.com -## +# Copyright (C) 2014-2023 CEA, EDF +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# import os, os.path @@ -26,8 +23,8 @@ import os, os.path SHAPER_SRC = os.environ['PWD'] # VERBOSE_FLAG = os.environ['VERBOSE_FLAG'] VERBOSE_FLAG = "" -ENCODING = u"utf-8" -OPERATORS=[u">", u"<", u"+", u"=", u"-", u"*", u"/"] +ENCODING = "utf-8" +OPERATORS=[">", "<", "+", "=", "-", "*", "/"] def create_warning_generator(fichier): """ @@ -40,14 +37,14 @@ def create_warning_generator(fichier): while ligne.strip("\n") : ligne = ligne.decode(ENCODING) liste = ligne.split(":") - print "Size of liste = ", len(liste) - print "ligne = ", ligne - print "n° ligne = ", i - print "XXX : ", ligne.find(u'Done processing ') + print("Size of liste = ", len(liste)) + print("ligne = ", ligne) + print("n° ligne = ", i) + print("XXX : ", ligne.find('Done processing ')) if len(liste) < 3: - if ligne.find(u'Done processing ') == -1 and ligne.find(u'Category ') == -1 and ligne.find(u'Total errors found: ') == -1: - raise Exception(u"Fichier de log mal formé") + if ligne.find('Done processing ') == -1 and ligne.find('Category ') == -1 and ligne.find('Total errors found: ') == -1: + raise Exception("Fichier de log mal formé") else: ligne = fichier.readline() i += 1 @@ -55,12 +52,12 @@ def create_warning_generator(fichier): elif len(liste) != 3: item1=liste[0] item2=liste[1] - merge = u"" - sep = u"" + merge = "" + sep = "" for item in liste[2:]: merge += sep merge += item - sep = u":" + sep = ":" liste = [item1, item2, merge] ligne = fichier.readline() i += 1 @@ -73,7 +70,7 @@ def get_line_no(path, nol): """retourne la ligne No nol du fichier path (relatif à DST_SRC_PARENT) sous forme d'un unicode""" ligne = "" fic = open(get_src_path(path), "r") - for i in xrange(nol): + for i in range(nol): ligne = fic .readline() fic.close() ligne_u = ligne.decode(ENCODING)