# coding=utf-8
-# Copyright (C) 2007-2017 EDF R&D
+# Copyright (C) 2007-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
from __future__ import print_function
from __future__ import division
try :
- from builtins import str
- from builtins import object
+ from builtins import str
+ from builtins import object
except :
- pass
+ pass
import sys
# Modules EFICAS
from .N_Exception import AsException
-from .N_types import is_int, is_float, is_complex, is_str, is_sequence, is_assd
-from .strfunc import get_encoding
-import six
+from .N_types import isInt, isFloat, isComplex, isStr, isSequence, isASSD
+from .strfunc import getEncoding
SEP = '_'
try :
- cur_frame = sys._getframe
+ cur_frame = sys._getframe
except :
- print ('pb avec la version de python pour cur_frame = sys._getframe')
+ print ('pb avec la version de python pour cur_frame = sys._getframe')
-def callee_where(niveau=4):
+def calleeWhere(niveau=4):
"""
recupere la position de l appel
"""
# Python 2.7 compile function does not accept unicode filename, so we encode it
# with the current locale encoding in order to have a correct traceback.
# Here, we convert it back to unicode.
- filename = six.text_type(frame.f_code.co_filename, get_encoding())
- return frame.f_lineno, filename, frame.f_code.co_firstlineno, frame.f_locals
+ import six
+ filename = six.text_type(frame.f_code.co_filename, getEncoding())
+ return frame.fLineNo, filename, frame.f_code.co_firstlineno, frame.f_locals
except:
return 0, "inconnu", 0, {}
Retourne le type d'un concept (a) Ã partir
des caractéristiques de l'objet Python
"""
- if is_sequence(a):
+ if isSequence(a):
return AsType(a[0])
- if is_assd(a):
+ if isASSD(a):
return type(a)
- if is_float(a):
+ if isFloat(a):
return "R"
- if is_int(a):
+ if isInt(a):
return "I"
- if is_str(a):
+ if isStr(a):
return "TXM"
if a == None:
return None
return s
-def import_object(uri):
+def importObject(uri):
"""Load and return a python object (class, function...).
Its `uri` looks like "mainpkg.subpkg.module.object", this means
that "mainpkg.subpkg.module" is imported and "object" is
def exists(self, value):
"""Tell if value is in the enumeration"""
- return self.get_id(value) is not None
+ return self.getId(value) is not None
- def get_id(self, value):
+ def getId(self, value):
"""Return the key associated to the given value"""
return self._dict_keys.get(value, None)