]> SALOME platform Git repositories - tools/eficas.git/blobdiff - Noyau/strfunc.py
Salome HOME
gestion des listes et label sur 2
[tools/eficas.git] / Noyau / strfunc.py
index 7bdb345e0d867b84431cc8753d63fbe343ead963..edb7b31ef26d1f3be81022a51007dc953d244d88 100644 (file)
@@ -1,4 +1,4 @@
-# -*- coding: iso-8859-1 -*-
+# coding=utf-8
 # Copyright (C) 2007-2013   EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
 
+"""Module rassemblant des fonctions utilitaires de manipulations
+de chaines de caractères
 """
-Module rassemblant des fonctions utilitaires de manipulations
-de chaines de caractères
-"""
-# module identique à Execution/strfunc.py pour usage dans Eficas
+# module identique à Execution/strfunc.py pour usage dans Eficas
 
 import locale
 
 _encoding = None
+
+
 def get_encoding():
     """Return local encoding
     """
@@ -63,6 +63,7 @@ def to_unicode(string):
             pass
     return unicode(string, 'utf-8', 'replace')
 
+
 def from_unicode(ustring, encoding, errors='replace'):
     """Try to encode a unicode string using encoding."""
     try:
@@ -71,6 +72,7 @@ def from_unicode(ustring, encoding, errors='replace'):
         pass
     return ustring.encode(encoding, errors)
 
+
 def convert(content, encoding=None, errors='replace'):
     """Convert content using encoding or default encoding if None."""
     if type(content) not in (str, unicode):
@@ -79,6 +81,7 @@ def convert(content, encoding=None, errors='replace'):
         content = to_unicode(content)
     return from_unicode(content, encoding or get_encoding(), errors)
 
+
 def ufmt(uformat, *args):
     """Helper function to format a string by converting all its arguments to unicode"""
     if type(uformat) is not unicode: