de toutes les classes de definition d'EFICAS.
"""
+from __future__ import absolute_import
+from __future__ import print_function
+try :
+ from builtins import str
+ from builtins import object
+except :
+ pass
import re
-import N_CR
-import N_OPS
-import N_VALIDATOR
-from strfunc import ufmt
+from . import N_CR
+from . import N_OPS
+from . import N_VALIDATOR
-from determine import monEnvQT5
-if monEnvQT5:
- stringTypes = (str, unicode)
-else :
- try:
- from PyQt4 import QtCore
- stringTypes = (str, unicode, QtCore.QString)
- except ImportError:
- stringTypes = (str, unicode)
+import six
+stringTypes = (str, six.text_type)
-class ENTITE:
+class ENTITE(object):
"""
Classe de base pour tous les objets de definition : mots cles et commandes
directement
Il s'agit principalement des mots cles
"""
- for k, v in self.entites.items():
+ for k, v in list(self.entites.items()):
v.pere = self
v.nom = k
"""
self.cr = self.CR()
self.verif_cata()
- for k, v in self.entites.items():
+ for k, v in list(self.entites.items()):
try:
cr = v.report()
cr.debut = u"Début " + v.__class__.__name__ + ' : ' + k
cr.fin = u"Fin " + v.__class__.__name__ + ' : ' + k
self.cr.add(cr)
except:
- self.cr.fatal(
- _(u"Impossible d'obtenir le rapport de %s %s"), k, `v`)
- print "Impossible d'obtenir le rapport de %s %s" % (k, `v`)
- print "père =", self
+ self.cr.fatal("Impossible d'obtenir le rapport de %s %s" % (k, repr(v)))
+ print(("Impossible d'obtenir le rapport de %s %s" % (k, repr(v))))
+ print(("père =", self))
return self.cr
def verif_cata_regles(self):
for regle in self.regles:
l = []
for mc in regle.mcs:
- if not self.entites.has_key(mc):
+ if not mc in self.entites :
l.append(mc)
if l != []:
txt = str(regle)
"""Verifie la definition d'un objet composite (commande, fact, bloc)."""
args = self.entites.copy()
mcs = set()
- for nom, val in args.items():
+ for nom, val in list(args.items()):
if val.label == 'SIMP':
mcs.add(nom)
# XXX
del args[nom]
# seuls les blocs peuvent entrer en conflit avec les mcs du plus haut
# niveau
- for nom, val in args.items():
+ for nom, val in list(args.items()):
if val.label == 'BLOC':
mcbloc = val.check_definition(parent)
# XXX
def check_min_max(self):
"""Vérifie les attributs min/max."""
if type(self.min) != int:
- if self.min != '**':
+ if self.min != '**'and self.min != float('-inf'):
self.cr.fatal(
_(u"L'attribut 'min' doit être un entier : %r"), self.min)
if type(self.max) != int:
- if self.max != '**':
+ if self.max != '**' and self.max != float('inf'):
self.cr.fatal(
_(u"L'attribut 'max' doit être un entier : %r"), self.max)
if self.min > self.max:
def check_into(self):
"""Vérifie l'attribut into."""
if self.into != None:
- if type(self.into) not in (list, tuple):
+ if (type(self.into) not in (list, tuple)) and (type(self.into) != types.FunctionType) :
self.cr.fatal(
_(u"L'attribut 'into' doit être un tuple : %r"), self.into)