-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2007-2021 EDF R&D
#
#
-import sys,os
+import sys, os
import types
import Accas
import imp
# CONTEXT est accessible (__init__.py de Noyau)
-#import raw.efficas as efficas
-sys.path.insert(0,os.path.abspath(os.path.join(os.getcwd(),'..')))
+# import raw.efficas as efficas
+sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "..")))
# ds l init du SIMP il manque siValide et fenetreIhm
from .balisesXSD import *
+
# -----------------
class X_definition:
-# -----------------
+ # -----------------
def adjoint(self, liste1, liste2):
- #print ('adjoint', liste1, liste2)
- l=[]
+ # print ('adjoint', liste1, liste2)
+ l = []
for elt1 in liste1:
for elt2 in liste2:
- newListe=deepcopy(elt1)
- if elt2 != []: newListe.append(elt2)
+ newListe = deepcopy(elt1)
+ if elt2 != []:
+ newListe.append(elt2)
l.append(newListe)
return l
def adjointUnMot(self, liste1, mot):
- l=[]
+ l = []
for elt1 in liste1:
- newListe=deepcopy(elt1)
+ newListe = deepcopy(elt1)
newListe.append(mot)
l.append(newListe)
return l
def remplaceListeParContenuEtVide(self, liste1, liste2):
- listeFinale=[]
- for elt1 in liste1 :
+ listeFinale = []
+ for elt1 in liste1:
for eltListe in liste2:
- newListe=deepcopy(elt1)
- if eltListe!=[] :newListe+=eltListe
- if newListe not in listeFinale : listeFinale.append(newListe)
+ newListe = deepcopy(elt1)
+ if eltListe != []:
+ newListe += eltListe
+ if newListe not in listeFinale:
+ listeFinale.append(newListe)
return listeFinale
-
- def fusionne2Listes(self, liste1, liste2):
- #print ('fusionne2Liste', liste1, liste2)
- listeFinale=[]
- for elt1 in liste1 :
+ def fusionne2Listes(self, liste1, liste2, debug=False):
+ if debug:
+ print("fusionne2Liste", liste1, liste2)
+ listeFinale = []
+ for elt1 in liste1:
for eltListe in liste2:
- newListe=deepcopy(elt1)
- if eltListe!=[] :newListe.append(eltListe)
+ newListe = deepcopy(elt1)
+ # newListe=elt1
+ if eltListe != []:
+ newListe.append(eltListe)
listeFinale.append(newListe)
- #print (listeFinale)
+ # if debug : print (listeFinale)
return listeFinale
def getNomDuCodeDumpe(self):
- if hasattr(self,'nomDuCodeDumpe') : return
- obj=self
- while ( not hasattr(obj,'nomDuCodeDumpe') ): obj=obj.pere
+ if hasattr(self, "nomDuCodeDumpe"):
+ return
+ obj = self
+ while not hasattr(obj, "nomDuCodeDumpe"):
+ obj = obj.pere
self.nomDuCodeDumpe = obj.nomDuCodeDumpe
- self.code=obj.code
+ self.code = obj.code
def getXPathComplet(self):
- obj=self
- textePath='/'+self.code+":"+self.nom
- while ( hasattr(obj,'pere') ):
- obj=obj.pere
- if isinstance(obj, X_BLOC) : continue
- textePath= '/'+ self.code + ":" + obj.nom + textePath
- textePath='.' + textePath
+ obj = self
+ textePath = "/" + self.code + ":" + self.nom
+ while hasattr(obj, "pere"):
+ obj = obj.pere
+ if isinstance(obj, X_BLOC):
+ continue
+ textePath = "/" + self.code + ":" + obj.nom + textePath
+ textePath = "." + textePath
return textePath
def getXPathSansSelf(self):
- obj=self
- textePath=''
- while ( hasattr(obj,'pere') ):
- obj=obj.pere
- if isinstance(obj, X_BLOC) : continue
- textePath= self.code + ":" + obj.nom + '/' + textePath
- textePath='./'+ self.code + ":" + textePath
+ obj = self
+ textePath = ""
+ while hasattr(obj, "pere"):
+ obj = obj.pere
+ if isinstance(obj, X_BLOC):
+ continue
+ textePath = self.code + ":" + obj.nom + "/" + textePath
+ textePath = "./" + self.code + ":" + textePath
return textePath
def getNomCompletAvecBloc(self):
- obj=self
- texteNom=self.nom
- while ( hasattr(obj,'pere') ):
- texteNom=obj.pere.nom+'_'+texteNom
- obj=obj.pere
+ obj = self
+ texteNom = self.nom
+ while hasattr(obj, "pere"):
+ texteNom = obj.pere.nom + "_" + texteNom
+ obj = obj.pere
return texteNom
- def metAJourPyxb(self,nomDuTypePyxb) :
- self.aCreer=False
- self.nomDuTypePyxb=nomDuTypePyxb
+ def metAJourPyxb(self, nomDuTypePyxb, debug=False):
+ # if self.nom == 'A' : debug = True
+ self.aCreer = False
+ self.nomDuTypePyxb = nomDuTypePyxb
cata = CONTEXT.getCurrentCata()
- nom='T_'+self.nom
- if (hasattr (self, 'nomXML')) and self.nomXML != None : nom='T_'+self.nomXML
- if not (nom in cata.dictTypesXSD.keys()) :
- cata.dictTypesXSD[nom] = [self,]
- else :
- cata.dictTypesXSD[nom].append(self)
-
- def definitNomDuTypePyxb(self,forceACreer=False,debug=False):
- #if self.nom == 'SubgridScaleModel' : debug=True
- #print ('definitNomDuTypePyxb', self, self.nom,self.nomComplet(),forceACreer)
- #PNPN
- if hasattr(self,'nomDuTypePyxb') : self.aCreer = False; return self.nomDuTypePyxb
- #debug=False
- if debug : print ('definitNomDuTypePyxb traitement pour ', self.nom)
+ nom = "T_" + self.nom
+ if (hasattr(self, "nomXML")) and self.nomXML != None:
+ nom = "T_" + self.nomXML
+ if not (nom in cata.dictTypesXSD.keys()):
+ cata.dictTypesXSD[nom] = [
+ self,
+ ]
+ if debug:
+ print(
+ "creation de cata.dictTypesXSD ", nom, self.getNomCompletAvecBloc()
+ )
+ # if nom == 'T_MuN' : print ('ligne 136')
+ else:
+ if not self in cata.dictTypesXSD[nom]:
+ cata.dictTypesXSD[nom].append(self)
+ if debug:
+ print(
+ "142 ajout de cata.dictTypesXSD ", nom, self.getNomCompletAvecBloc()
+ )
+ # if nom == 'T_MuN' : print ('ligne 138')
+
+ def definitNomDuTypePyxb(self, forceACreer=False, debug=False):
+ # if self.nom == 'A' : debug = True
+ if debug:
+ print("***************************************************")
+ if debug:
+ print(
+ " Traitement definitNomDuTypePyxb",
+ self,
+ self.nom,
+ self.nomComplet(),
+ forceACreer,
+ )
+ if debug:
+ print(self.getNomCompletAvecBloc())
+ if debug:
+ print("***************************************************")
+ if hasattr(self, "nomDuTypePyxb"):
+ self.aCreer = False
+ return self.nomDuTypePyxb
+ if debug:
+ print("definitNomDuTypePyxb traitement pour ", self.nom)
+ if debug:
+ print(self.getNomCompletAvecBloc())
+ # if debug : traceback.print_stack()
self.aCreer = True
cata = CONTEXT.getCurrentCata()
- nom='T_'+self.nom
- if (hasattr (self, 'nomXML')) and self.nomXML != None : nom='T_'+self.nomXML
- if not (nom in cata.dictTypesXSD.keys()) :
- if debug : print ('definitNomDuTypePyxb encore jamais traite ', self.nom , ' a pour type' , nom)
- cata.dictTypesXSD[nom] = [self,]
- self.nomDuTypePyxb=nom
+ nom = "T_" + self.nom
+ if (hasattr(self, "nomXML")) and self.nomXML != None:
+ nom = "T_" + self.nomXML
+ if debug:
+ print("nom in cata.dictTypesXSD.keys", nom in cata.dictTypesXSD.keys())
+ # if debug and (nom in cata.dictTypesXSD.keys()) : print ( cata.dictTypesXSD[nom])
+ if not (nom in cata.dictTypesXSD.keys()) or cata.dictTypesXSD[nom] == []:
+ # il faut tenir compte des re céations des types qui appartenaient a un compo ambigu qu on refusionne
+ if debug:
+ print(
+ "definitNomDuTypePyxb encore jamais traite ",
+ self.nom,
+ " a pour type",
+ nom,
+ )
+ cata.dictTypesXSD[nom] = [
+ self,
+ ]
+ self.nomDuTypePyxb = nom
+ self.indiceDuTypePyxb = 0
+ if debug:
+ print(
+ "************ indiceDuTypePyxb pour",
+ self.getNomCompletAvecBloc(),
+ " mis a ",
+ 0,
+ )
+ if debug:
+ print("indice a ", 0, "pour", self.getNomCompletAvecBloc())
+ return nom
+ if debug:
+ print(
+ " ----------- definitNomDuTypePyxb deja traite ",
+ self.nom,
+ " suite de l algo",
+ )
+ if nom == "T_Consigne":
return nom
- if nom == 'T_Consigne' : return nom
-
- if not forceACreer :
+ # print ('***************************************************', self.getNomCompletAvecBloc())
+ if debug:
+ print("forceACreer : ", forceACreer)
+ # if self.nom == 'A' : debug = True
+ indice = 0
+ if nom in cata.dictTypesXSD.keys():
+ if debug:
+ print("traitement comparaison indice de ", self.getNomCompletAvecBloc())
+ for objAComparer in cata.dictTypesXSD[nom]:
+ if objAComparer == self:
+ continue
+ # debug=1
+ if debug:
+ print("objAComparer", objAComparer.getNomCompletAvecBloc())
+ if debug:
+ print("obj", self.getNomCompletAvecBloc())
+ # debug=0
+ # on peut ne pas avoir de type pyxb
+ # si on reconstruit l arbre aprs des fusions de compo ambigus
+ if not (hasattr(objAComparer, "indiceDuTypePyxb")):
+ continue
+ if objAComparer.indiceDuTypePyxb >= indice:
+ indice = objAComparer.indiceDuTypePyxb + 1
+ if debug:
+ print(
+ "objAComparer.indiceDuTypePyxb",
+ objAComparer.indiceDuTypePyxb,
+ )
+ if not forceACreer:
self.aCreer = False
- listePossible=cata.dictTypesXSD[nom]
- indice=0
- while (indice < len(listePossible)) :
- objAComparer=listePossible[indice]
- if debug : print (self.compare)
- if self.compare(objAComparer) :
- self.nomDuTypePyxb=objAComparer.nomDuTypePyxb
- if debug : print (self, objAComparer)
- if debug : print (type(self), type(objAComparer))
- if debug : print ('definitNomDuTypePyxb', self.nom , 'type identique', objAComparer.nomDuTypePyxb )
- # c est nul pour la comparaison mais cela permet d etre ok dans le dictionnaire passe a Accas
- cata.dictTypesXSD[nom].append(self)
- if self.label != 'SIMP' :
- if objAComparer not in list(cata.dictTypesXSDJumeaux.keys()) : cata.dictTypesXSDJumeaux[objAComparer]=[self,]
- else : cata.dictTypesXSDJumeaux[objAComparer].append(self)
+ listePossible = cata.dictTypesXSD[nom]
+ if debug:
+ print("listePossible : ", listePossible, "pour ", nom, self)
+ for objAComparer in listePossible:
+ if debug:
+ print("comparaison entre ", objAComparer, "et ", self)
+ if objAComparer == self:
+ continue
+ # on peut ne pas avoir de type pyxb
+ # si on reconstruit l arbre aprs des fusions de compo ambigus
+ if not (hasattr(objAComparer, "nomDuTypePyxb")):
+ continue
+ if debug:
+ print(self.compare(objAComparer))
+ if self.compare(objAComparer):
+ self.nomDuTypePyxb = objAComparer.nomDuTypePyxb
+ self.indiceDuTypePyxb = objAComparer.indiceDuTypePyxb
+ if debug:
+ print(self, objAComparer)
+ if debug:
+ print(type(self), type(objAComparer))
+ if debug:
+ print(
+ "definitNomDuTypePyxb",
+ self.nom,
+ "type identique",
+ objAComparer.nomDuTypePyxb,
+ )
+ if debug:
+ print(
+ "indice a ",
+ objAComparer.nomDuTypePyxb,
+ "pour",
+ self.getNomCompletAvecBloc(),
+ )
+ if self not in cata.dictTypesXSD[nom]:
+ cata.dictTypesXSD[nom].append(self)
+ if debug and self not in cata.dictTypesXSD[nom]:
+ print(
+ "ajout ds cata.dictTypesXS",
+ nom,
+ self.getNomCompletAvecBloc(),
+ )
+ if self.label != "SIMP":
+ if objAComparer not in list(cata.dictTypesXSDJumeaux.keys()):
+ cata.dictTypesXSDJumeaux[objAComparer] = [
+ self,
+ ]
+ else:
+ cata.dictTypesXSDJumeaux[objAComparer].append(self)
return objAComparer.nomDuTypePyxb
- indice += 1
+ # if debug : print ('self', self.getNomCompletAvecBloc())
+ # if debug : print ('objAComparer',objAComparer.getNomCompletAvecBloc())
+ # if debug : print ('objAComparer.indiceDuTypePyxb', objAComparer.indiceDuTypePyxb)
+ # if debug : print ('indice', indice )
+ #####if objAComparer.indiceDuTypePyxb >= indice : indice += 1objAComparer.indiceDuTypePyxb
+ if debug:
+ print(" ----------- definitNomDuTypePyxb pas de type identique trouve")
self.aCreer = True
- cata.dictTypesXSD[nom].append(self)
- nomAlter='T_'+self.nom+'_'+str(indice)
- if (hasattr (self, 'nomXML')) and self.nomXML != None :
- nomAlter='T_'+self.nomXML+'_'+str(indice)
- self.nomDuTypePyxb=nomAlter
+ if self not in cata.dictTypesXSD[nom]:
+ cata.dictTypesXSD[nom].append(self)
+ if debug and self not in cata.dictTypesXSD[nom]:
+ print("ajout ds cata.dictTypesXS", nom, self.getNomCompletAvecBloc())
+ if indice != 0:
+ nomAlter = "T_" + self.nom + "_" + str(indice)
+ else:
+ nomAlter = "T_" + self.nom
+ self.indiceDuTypePyxb = indice
+ if debug:
+ print(
+ "************ indiceDuTypePyxb pour",
+ self.getNomCompletAvecBloc(),
+ " mis a ",
+ indice,
+ )
+ if (hasattr(self, "nomXML")) and self.nomXML != None:
+ nomAlter = "T_" + self.nomXML + "_" + str(indice)
+ self.nomDuTypePyxb = nomAlter
+ if debug:
+ print("self.nomDuTypePyxb : ", nomAlter)
return nomAlter
# ----------------------------------------
class X_compoFactoriseAmbigu(X_definition):
-# ----------------------------------------
-
- def __init__(self,nom,listeDeCreation,pere, debug=True):
-
- if debug :
- for i in listeDeCreation : print (i.nom)
- self.label='BlocAmbigu'
- self.nom=nom
- self.pere=pere
- self.statut='f'
- self.entites={}
- self.mcXSD=[]
- self.typesXSDDejaDumpes=[]
- self.ordre_mc=[]
- self.lesConditions = 'Possible Conditions : '
- for mc in listeDeCreation :
- if hasattr(mc, 'condition'):self.lesConditions += '\n\t\t\t\t\t\t' + mc.condition
+ # ----------------------------------------
+
+ def __init__(self, nom, listeDeCreation, pere, debug=False):
+ # if pere.nom == 'Test_Ambigu' : debug = False
+ self.label = "BlocAmbigu"
+ self.nom = nom
+ self.pere = pere
+ self.statut = "f"
+ self.entites = {}
+ self.mcXSD = []
+ self.typesXSDDejaDumpes = []
+ self.ordre_mc = []
+ self.lesConditions = "Possible Conditions : "
+ if debug:
+ print("___________________________________________________________________")
+ print("je suis dans compoFactoriseAmbigu pour", self.pere, self.pere.nom)
+ for i in listeDeCreation:
+ print(i.nom)
+ print(i, type(i))
+ print(i.possedeDejaUnMCFactorise)
+ print("___________________________________________________________________")
+ if hasattr(pere, "listeDesCompoAmbigus"):
+ pere.listeDesCompoAmbigus.append(self)
+ else:
+ pere.listeDesCompoAmbigus = (self,)
+ doitReecrireLesTypes = False
+ for mc in listeDeCreation:
+ if hasattr(mc, "condition"):
+ self.lesConditions += "\n\t\t\t\t\t\t" + mc.condition
+ doitReecrireLesTypes += mc.possedeDejaUnMCFactorise
self.mcXSD.append(mc)
self.ordre_mc.append(mc.nom)
-
- if debug : print (self.mcXSD)
- if debug : print (self.ordre_mc)
- self.construitEntites(self.mcXSD)
- self.constructionArbrePossibles()
- lesPossibles=deepcopy(self.arbrePossibles)
- if debug : print ('lesPossibles ', lesPossibles)
+ # if self.nom == 'B1_B2' : debug = True
+ if debug and doitReecrireLesTypes:
+ print("je dois reecrire pour", self.nom)
+ if debug:
+ print("doitReecrireLesTypes", doitReecrireLesTypes)
+ if debug:
+ print("self.mcXSD", self.mcXSD)
+ if debug:
+ print("self.ordre_mc", self.ordre_mc)
+ self.construitEntites(self.mcXSD, debug=debug)
+ if debug:
+ print("apres de self.construitEntites")
+ self.constructionArbrePossibles(debug=debug)
+ # self.constructionArbrePossibles2(debug=debug)
+
+ lesPossibles = deepcopy(self.arbrePossibles)
+ if debug:
+ print("lesPossibles ", lesPossibles)
self.getNomDuCodeDumpe()
self.nomDuTypePyxb = self.definitNomDuTypePyxb()
- if debug : print (self.nomDuTypePyxb)
- self.texteSimple = ''
- self.texteComplexeVenantDesFils = ''
+ if debug:
+ print("CompoAmbigu : ", self.nomDuTypePyxb)
+ self.texteSimple = ""
+ self.texteComplexeVenantDesFils = ""
self.texteComplexe = debutTypeSubstDsBlocFactorise.format(self.nomDuTypePyxb)
# on enleve [] des possibles puisque l elt sera optionnel
lesPossibles.remove([])
- if debug : print ('________________ init de compoAmbigu',self.nom, lesPossibles)
- if debug : print ('self.entites', self.entites)
- self.mcXSD=self.factoriseEtCreeDump(lesPossibles,nomAppel='Root')
- if debug : print ('self.mcXSD',self.mcXSD)
+ # if self.nom == 'B1_B2' : debug = True
+ if debug:
+ print("________________ init de compoAmbigu", self.nom, lesPossibles)
+ # if debug : print ('self.entites', self.entites)
+ cata = CONTEXT.getCurrentCata()
+ if doitReecrireLesTypes:
+ if debug:
+ print("cata.dictTypesXSD avant la boucle", cata.dictTypesXSD["T_A"])
+ # on n enleve pas de cata.dictTypesXSD les blocs ambigus qui ne servent plus
+ # il faudrait peut-etre gerer la liste de ces blocs et les nettoyer aussi
+ # Oui mais comment faire
+ #
+ if debug:
+ print("doit reecrire les textes pour ", self.nom)
+ for nom in self.entites.keys():
+ if debug:
+ print("dans for pour enlever les nomDuTypePyxb", nom)
+ for mc in self.entites[nom]:
+ if debug:
+ print("traitement de ", nom, "mot clef", mc)
+ if hasattr(mc, "nomDuTypePyxb"):
+ clef = mc.nomDuTypePyxb
+ # if debug : print ('avec la clef ', clef)
+ # PN : comprendre pourquoi certains MC sont en double ???
+ try:
+ if debug:
+ print(
+ "remove ds cata.dictTypesXSD",
+ clef,
+ mc.getNomCompletAvecBloc(),
+ )
+ while mc in cata.dictTypesXSD[clef]:
+ cata.dictTypesXSD[clef].remove(mc)
+ except:
+ print("ds le except pour dicTypeXSD", nom)
+ if hasattr(mc, "nomDuTypePyxb"):
+ delattr(mc, "nomDuTypePyxb")
+ if hasattr(mc, "aDejaEteDumpe"):
+ delattr(mc, "aDejaEteDumpe")
+ if hasattr(mc, "entites"):
+ self.remetSousArbreAVide(mc)
+ if hasattr(mc, "indiceDuTypePyxb"):
+ delattr(mc, "indiceDuTypePyxb")
+ if debug:
+ print(
+ "************ indiceDuTypePyxb pour",
+ self.getNomCompletAvecBloc(),
+ " mis a 0",
+ )
+ # if mc in cata.dictTypesXSDJumeaux.keys() : print (mc.nom, cata.dictTypesXSDJumeaux[mc][0].nom)
+
+ if debug:
+ print("cata.dictTypesXSD apres la boucle", cata.dictTypesXSD["T_A"])
+ if debug:
+ for mc in cata.dictTypesXSD["T_A"]:
+ print(mc.getNomCompletAvecBloc())
+ # if debug : print ('cata.dictTypesXSD apres la boucle', cata.dictTypesXSD)
+ debug = False
+ self.mcXSD = self.factoriseEtCreeDump(
+ lesPossibles, nomAppel=self.nom, debug=debug
+ )
+ if debug:
+ print("self.mcXSD", self.mcXSD)
self.texteComplexe += finTypeSubstDsBlocFactorise
- self.texteComplexe +=self.texteComplexeVenantDesFils
- #print ('fin pour prepareDumpXSD pour', self.nom)
+ self.texteComplexe += self.texteComplexeVenantDesFils
+ # print ('fin pour prepareDumpXSD pour', self.nom)
- def compare(self,autreMC):
- if self.label != autreMC.label : return False
- #PN : le bug est la
+ def compare(self, autreMC):
+ if self.label != autreMC.label:
+ return False
+ # PN : le bug est la
# arbre des possibles identiques mais les types different
# comment faire ?
- #print (self.arbrePossibles)
- #print (autreMC.arbrePossibles)
- #if self.arbrePossibles== autreMC.arbrePossibles : return True
+ # print (self.arbrePossibles)
+ # print (autreMC.arbrePossibles)
+ # if self.arbrePossibles== autreMC.arbrePossibles : return True
return False
- def construitEntites(self, laListe):
- for mc in laListe :
- if mc.nom in self.entites.keys() : self.entites[mc.nom].append(mc)
- else : self.entites[mc.nom] = [mc,]
- if mc.label == 'BLOC' or mc.label == 'BlocAmbigu':
+ def construitEntites(self, laListe, debug=False):
+ # debug = False
+ for mc in laListe:
+ if mc.nom in self.entites.keys():
+ self.entites[mc.nom].append(mc)
+ else:
+ self.entites[mc.nom] = [
+ mc,
+ ]
+ if debug:
+ print("mc.nom", mc.nom, hasattr(mc, "nomDuTypePyxb"))
+ if mc.label == "BLOC" or mc.label == "BlocAmbigu":
self.ajouteLesMCFilsAEntite(mc)
+ if debug:
+ print(mc.nom, " a pour entites ", mc.entites)
+ print(self.nom, " a pour entites ", self.entites)
-
- def ajouteLesMCFilsAEntite(self,blocMc):
+ def ajouteLesMCFilsAEntite(self, blocMc):
for mcFilsNom in blocMc.entites.keys():
- if mcFilsNom == 'Consigne' or mcFilsNom == 'blocConsigne' : continue
- if mcFilsNom not in self.entites.keys(): self.entites[mcFilsNom]=[]
- if blocMc.label == 'BlocAmbigu' :
- for mc in blocMc.entites[mcFilsNom] :
+ if mcFilsNom == "Consigne" or mcFilsNom == "blocConsigne":
+ continue
+ if mcFilsNom not in self.entites.keys():
+ self.entites[mcFilsNom] = []
+ if blocMc.label == "BlocAmbigu":
+ for mc in blocMc.entites[mcFilsNom]:
self.entites[mcFilsNom].append(mc)
- if mc.label == 'BLOC' or mc.label == 'BlocAmbigu':
+ if mc.label == "BLOC" or mc.label == "BlocAmbigu":
self.ajouteLesMCFilsAEntite(mc)
- else :
+ else:
self.entites[mcFilsNom].append(blocMc.entites[mcFilsNom])
- if blocMc.entites[mcFilsNom].label == 'BLOC' or blocMc.entites[mcFilsNom].label == 'BlocAmbigu':
+ if (
+ blocMc.entites[mcFilsNom].label == "BLOC"
+ or blocMc.entites[mcFilsNom].label == "BlocAmbigu"
+ ):
self.ajouteLesMCFilsAEntite(blocMc.entites[mcFilsNom])
-
-
-
- def constructionArbrePossibles(self, debug = False):
- if debug : print ('construction pour FACT ambigu _______________', self.nom)
- toutesLesLignes=[[]]
- for child in self.mcXSD :
- if not hasattr(child, 'arbrePossibles') : child.construitArbrePossibles()
- if child.label != 'BLOC' :
- toutesLesLignes = deepcopy(self.fusionne2Listes(toutesLesLignes, child.arbrePossibles))
- else :
- toutesLesLignes = deepcopy(self.fusionne2Listes(toutesLesLignes, [child.nom, []]))
-
- lignesAGarder=[]
+ def constructionArbrePossibles(self, debug=False):
+ if debug:
+ print("______________________________________")
+ if debug:
+ print("construction pour FACT ambigu _______________", self.nom)
+ toutesLesLignes = [[]]
+ for child in self.mcXSD:
+ if debug and not hasattr(child, "arbrePossibles"):
+ print(
+ "appel construitArbrePossibles pour",
+ child.nom,
+ " à partir de ",
+ self.nom,
+ )
+ if not hasattr(child, "arbrePossibles"):
+ child.construitArbrePossibles()
+ if debug:
+ print("_____________________________")
+ print(child, child.arbrePossibles)
+ print(child, len(child.arbrePossibles))
+ if child.label != "BLOC":
+ toutesLesLignes = deepcopy(
+ self.fusionne2Listes(toutesLesLignes, child.arbrePossibles)
+ )
+ else:
+ toutesLesLignes = deepcopy(
+ self.fusionne2Listes(toutesLesLignes, [child.nom, []])
+ )
+ if debug:
+ print(len(toutesLesLignes))
+ # print (toutesLesLignes)
+ print("_____________________________")
+ if debug:
+ print("apres construitArbrePossibles pour", child.nom)
+ # print (self.nom, len(child.arbrePossibles))
+
+ lignesAGarder = []
for ligne in toutesLesLignes:
- blocContenus=[]
- aAjouter=True
- for mc in ligne :
- objMC=self.entites[mc][0]
- if objMC.label == 'BLOC' :
+ blocContenus = []
+ aAjouter = True
+ for mc in ligne:
+ objMC = self.entites[mc][0]
+ if objMC.label == "BLOC":
blocContenus.append(objMC)
- for b in blocContenus :
- for frere in blocContenus[blocContenus.index(b)+1:]:
- if b.isDisjoint(frere) : continue
- aAjouter=False
+ for b in blocContenus:
+ for frere in blocContenus[blocContenus.index(b) + 1 :]:
+ if b.isDisjoint(frere):
+ continue
+ aAjouter = False
+ break
+ if not aAjouter:
break
- if not aAjouter : break
- if aAjouter and ligne not in lignesAGarder :
+ if aAjouter and ligne not in lignesAGarder:
lignesAGarder.append(ligne)
- #print ("______________________________________")
- #for l in lignesAGarder : print (l)
- #print (len(lignesAGarder))
- #print ("______________________________________")
- self.arbrePossibles=[]
- for ligne in lignesAGarder :
- #print ('lignesAGarder', ligne)
+ if debug:
+ print("\t les lignes à garder")
+ for l in lignesAGarder:
+ print("\t", l)
+ self.arbrePossibles = []
+ for ligne in lignesAGarder:
for newLigne in self.deploye(ligne):
- #print (newLigne)
- if newLigne not in self.arbrePossibles : self.arbrePossibles.append(newLigne)
- #for l in self.arbrePossibles : print (l)
- #print ("______________________________________")
-
-
- def deploye (self, ligne):
- toutesLesLignes=[[]]
- for mc in ligne :
- #print ( 'mc in deploye', mc)
- objMC=self.entites[mc][0]
- #print ( 'nom', objMC.nom, objMC.label)
- if objMC.label == 'BLOC' or objMC.label == 'BlocAmbigu':
- toutesLesLignes = deepcopy(self.remplaceListeParContenuEtVide(toutesLesLignes, objMC.arbrePossibles))
- else :
- toutesLesLignes = deepcopy(self.adjointUnMot(toutesLesLignes,mc ))
+ if newLigne not in self.arbrePossibles:
+ self.arbrePossibles.append(newLigne)
+ if debug:
+ print("\n\t l arbre des possibles")
+ for l in self.arbrePossibles:
+ print("\t", l)
+ print("fin pour ______________________________________", self.nom)
+
+ def remetSousArbreAVide(self, mc, debug=False):
+ # if mc.nom=='F1' : debug=True;
+ if debug:
+ print("remetSousArbreAVide de ", mc.nom, mc.entites)
+ for mcFilsNom in mc.entites:
+ mcFils = mc.entites[mcFilsNom]
+ if debug:
+ print(mcFils)
+ if hasattr(mcFils, "nomDuTypePyxb"):
+ clef = mcFils.nomDuTypePyxb
+ if debug:
+ print("remetSousArbreAVide clef ", mcFils.nomDuTypePyxb)
+ try:
+ if debug:
+ print(
+ "remove ds cata.dictTypesXSD",
+ clef,
+ mcFils.getNomCompletAvecBloc(),
+ )
+ while mcFils in cata.dictTypesXSD[clef]:
+ cata.dictTypesXSD[clef].remove(mcFils)
+ except:
+ pass
+ if hasattr(mcFils, "nomDuTypePyxb"):
+ delattr(mcFils, "nomDuTypePyxb")
+ if hasattr(mcFils, "aDejaEteDumpe"):
+ delattr(mcFils, "aDejaEteDumpe")
+ if hasattr(mcFils, "entites"):
+ self.remetSousArbreAVide(mcFils, debug=debug)
+
+ def deploye(self, ligne):
+ toutesLesLignes = [[]]
+ for mc in ligne:
+ # print ( 'mc in deploye', mc)
+ objMC = self.entites[mc][0]
+ # print ( 'nom', objMC.nom, objMC.label)
+ if objMC.label == "BLOC" or objMC.label == "BlocAmbigu":
+ toutesLesLignes = deepcopy(
+ self.remplaceListeParContenuEtVide(
+ toutesLesLignes, objMC.arbrePossibles
+ )
+ )
+ else:
+ toutesLesLignesRetour = deepcopy(self.adjointUnMot(toutesLesLignes, mc))
return toutesLesLignes
def construitArbrePossibles(self):
- # inutile car on a deja l arbre mais appele parfois
- #print ('dans X_factCompoAmbigu ne fait rien', self.nom, self.arbrePossibles)
+ # inutile car on a deja l arbre mais appele parfois
+ # print ('dans X_factCompoAmbigu ne fait rien', self.nom, self.arbrePossibles)
pass
- def dumpXsd(self, dansFactorisation=False, multiple = False, first=False):
+ def dumpXsd(self, dansFactorisation=False, multiple=False, first=False):
# on ne fait rien, tout a ete fait dans le init
- self.texteElt=substDsSequence.format(self.code,self.nomDuTypePyxb,0,1, self.lesConditions)
-
- def nomComplet(self) :
- print ('dans nomComplet pourquoi ?',self, self.nom)
-
-
- def factoriseEtCreeDump(self, laListe, indent=2 ,nomAppel=None, debug=False):
- if debug : print ('_______________________________ factoriseEtCreeDump')
- if debug : print(self.nom, laListe, indent, nomAppel)
- maListeRetour=[]
- aReduire={}
-
- if [] in laListe :
- declencheChoiceAvecSeqVid=True
- while [] in laListe : laListe.remove([])
- #min=0
- else :
- declencheChoiceAvecSeqVid=False
- #min=1
-
-
-
- for ligne in laListe :
+ self.texteElt = substDsSequence.format(
+ self.code, self.nomDuTypePyxb, 0, 1, self.lesConditions
+ )
+
+ def nomComplet(self):
+ print("dans nomComplet pourquoi ?", self, self.nom)
+
+ def factoriseEtCreeDump(self, laListe, indent=2, nomAppel=None, debug=False):
+ # debug=True
+ # if debug : print('______________ debut factoriseetCreeDump',self.nom, laListe, indent, nomAppel)
+ # if debug : print('______________ ', indent, nomAppel)
+ # debug=False
+ maListeRetour = []
+ aReduire = {}
+
+ if [] in laListe:
+ declencheChoiceAvecSeqVid = True
+ while [] in laListe:
+ laListe.remove([])
+ # min=0
+ else:
+ declencheChoiceAvecSeqVid = False
+ # min=1
+
+ for ligne in laListe:
if ligne[0] in aReduire.keys():
- if len(ligne) == 1 :aReduire[ligne[0]].append([])
- else : aReduire[ligne[0]].append(ligne[1:])
- else :
- if len(ligne) == 1 : aReduire[ligne[0]]=[[]]
- else : aReduire[ligne[0]]=[ligne[1:],]
-
-
- if debug : print ('la Liste', laListe, declencheChoiceAvecSeqVid)
- if debug : print (aReduire)
- if len(aReduire.keys()) == 1 :
- if declencheChoiceAvecSeqVid == False :
- creeChoice=False
- creeSequence=True
- self.texteComplexe += '\t'*(indent) + debSequenceDsBloc; indent=indent+1
- else :
- creeChoice=True
- creeSequence=False
+ if len(ligne) == 1:
+ aReduire[ligne[0]].append([])
+ else:
+ aReduire[ligne[0]].append(ligne[1:])
+ else:
+ if len(ligne) == 1:
+ aReduire[ligne[0]] = [[]]
+ else:
+ aReduire[ligne[0]] = [
+ ligne[1:],
+ ]
+
+ if debug:
+ print(
+ "la Liste",
+ laListe,
+ "declencheChoiceAvecSeqVid : ",
+ declencheChoiceAvecSeqVid,
+ )
+ if debug:
+ print("aReduire", aReduire, "keys", aReduire.keys())
+ if len(aReduire.keys()) == 1:
+ if declencheChoiceAvecSeqVid == False:
+ creeChoice = False
+ creeSequence = True
+ self.texteComplexe += "\t" * (indent) + debSequenceDsBloc
+ indent = indent + 1
+ else:
+ creeChoice = True
+ creeSequence = False
# pour regler le souci du 1er Niveau
- self.texteComplexe += '\t'*indent + debutChoiceDsBloc; indent=indent+1
- #if min == 1 : self.texteComplexe += '\t'*indent + debutChoiceDsBloc; indent=indent+1
- #else : self.texteComplexe += '\t'*indent + debutChoiceDsBlocAvecMin.format(min); indent=indent+1
- else :
- #self.texteComplexe += '\t'*indent + debutChoiceDsBlocAvecMin.format(min); indent=indent+1
- self.texteComplexe += '\t'*indent + debutChoiceDsBloc; indent=indent+1
- creeChoice=True
- creeSequence=False
-
- if debug : print ('creeSequence', creeSequence, aReduire)
+ self.texteComplexe += "\t" * indent + debutChoiceDsBloc
+ indent = indent + 1
+ else:
+ # self.texteComplexe += '\t'*indent + debutChoiceDsBlocAvecMin.format(min); indent=indent+1
+ self.texteComplexe += "\t" * indent + debutChoiceDsBloc
+ indent = indent + 1
+ creeChoice = True
+ creeSequence = False
+
+ if debug:
+ print("creeSequence", creeSequence, "creechoice", creeChoice)
+ # print (aReduire)
for nomMC in aReduire.keys():
- if debug : print (nomMC)
- listeSuivante=aReduire[nomMC]
- if creeChoice and listeSuivante != [[]] :
- self.texteComplexe += '\t'*(indent) + debSequenceDsBloc; indent=indent+1
- self.ajouteAuxTextes(nomMC,indent)
- if listeSuivante == [[]] : continue # Est-ce toujours vrai ?
- if len(listeSuivante) == 1 : self.ajouteAuxTextes(listeSuivante[0],indent)
- else : self.factoriseEtCreeDump(listeSuivante, indent+int(creeSequence),nomMC)
- if creeChoice : indent=indent -1 ; self.texteComplexe += '\t'*(indent) + finSequenceDsBloc
-
- if declencheChoiceAvecSeqVid :
- self.texteComplexe += '\t'*indent + debSequenceDsBloc
- self.texteComplexe += '\t'*indent + finSequenceDsBloc
- if creeChoice : indent=indent -1 ; self.texteComplexe += '\t'*indent + finChoiceDsBloc
- if creeSequence : indent=indent -1 ; self.texteComplexe += '\t'*(indent) + finSequenceDsBloc
-
- #if doitFermerSequence : indent=indent-1;self.texteComplexe += '\t'*(indent) + finSequenceDsBloc
- #print (self.texteSimple)
- #print ('______',' self.texteComplexe')
- #print (self.texteComplexe)
- #print ('_____', 'self.texteComplexeVenantDesFils')
- #print (self.texteComplexeVenantDesFils)
- #print ('fin pour _______________________________', self.nom)
- return (maListeRetour)
-
-
- def ajouteAuxTextes(self,nomMC,indent,debug=False) :
- if debug :
- print ('______________________________________________________')
- print ('ajouteAuxTextes', nomMC, self.nom)
+ if debug:
+ print(
+ "--------------------------------------------- boucle for",
+ nomMC,
+ aReduire[nomMC],
+ )
+ listeSuivante = aReduire[nomMC]
+ if creeChoice and listeSuivante != [[]]:
+ self.texteComplexe += "\t" * (indent) + debSequenceDsBloc
+ indent = indent + 1
+ if debug:
+ print("ajouteAuxTextes de ", nomMC)
+ self.ajouteAuxTextes(nomMC, indent)
+ if listeSuivante == [[]]:
+ continue # Est-ce toujours vrai ?
+ if debug:
+ print("listeSuivante", listeSuivante)
+ aTraiter = listeSuivante
+ if debug:
+ print("aTraiter", aTraiter)
+ if len(listeSuivante) == 1:
+ self.ajouteAuxTextes(listeSuivante[0], indent)
+ else:
+ self.factoriseEtCreeDump(
+ listeSuivante, indent + int(creeSequence), nomMC
+ )
+ # if len(aTraiter) == 1 :
+ # if not(isinstance(aTraiter[0],list)) : self.ajouteAuxTextes(aTraiter[0],indent )
+ # while len(aTraiter) == 1 and isinstance(aTraiter[0],list): aTraiter=aTraiter[0]
+ # for mc in aTraiter : self.ajouteAuxTextes(mc, indent)
+ # else :
+ # self.factoriseEtCreeDump(aTraiter, indent+int(creeSequence),nomMC)
+
+ if creeChoice:
+ indent = indent - 1
+ self.texteComplexe += "\t" * (indent) + finSequenceDsBloc
+ if debug:
+ print(
+ "--------------------------------------------- fin boucle for",
+ nomMC,
+ )
+
+ if declencheChoiceAvecSeqVid:
+ self.texteComplexe += "\t" * indent + debSequenceDsBloc
+ self.texteComplexe += "\t" * indent + finSequenceDsBloc
+ if creeChoice:
+ indent = indent - 1
+ self.texteComplexe += "\t" * indent + finChoiceDsBloc
+ if creeSequence:
+ indent = indent - 1
+ self.texteComplexe += "\t" * (indent) + finSequenceDsBloc
+
+ ##if debug : print (self.texteSimple)
+ if debug:
+ print("______", " self.texteComplexe")
+ if debug:
+ print(self.texteComplexe)
+ # if debug : print ('_____', 'self.texteComplexeVenantDesFils')
+ # if self.nom=='B1_B2' : print ('___________________')
+ # if self.nom=='B1_B2' : print (self.texteComplexeVenantDesFils)
+ if debug:
+ print("ma Liste Retour", maListeRetour)
+ if debug:
+ print("fin pour _______________________________", self.nom)
+ return maListeRetour
+
+ def ajouteAuxTextes(self, nomMC, indent, debug=False):
+ # PNPNPN
+ # debug = True
+ if debug and nomMC != []:
+ print("______________________________________________________")
+ print(
+ "ajouteAuxTextes",
+ nomMC,
+ self.nom,
+ )
+ debug = False
+
# for i in self.entites.keys() : print (self.entites[i][0].nom)
- if (indent > 3) : indent = indent - 3
+ # if (indent > 3) : indent = indent - 3
# PN change le 17 fevrier . Est-ce normal d arriver la ?
# if faut traiter les Blocs exclusifs qui donnent des choices de sequences
# mais celles-ci risquent d etre ambigues
- while (isinstance(nomMC,list)) :
- nomMC=nomMC[0]
- if nomMC == 'Consigne' or nomMC == 'blocConsigne' : return
- if debug : print (nomMC, 'dans ajoute vraiment aux textes', self.entites )
+ if nomMC == []:
+ return
+ # on a un niveau de liste par niveau de bloc imbrique
+ # voir cata_UQ
+ while isinstance(nomMC, list):
+ if nomMC == []:
+ return
+ if len(nomMC) == 1:
+ nomMC = nomMC[0]
+ elif isinstance(nomMC[0], list):
+ nomMC = nomMC[0]
+ else:
+ for mc in nomMC:
+ self.ajouteAuxTextes(mc, indent, debug)
+ return
+
+ while isinstance(nomMC, list):
+ if nomMC == []:
+ return # on garde les [] dans les choix sinon souci sur les sequences/choix
+ nomMC = nomMC[0]
+
+ if debug:
+ print("ajouteAuxTextes apresWhile", nomMC)
+ if nomMC == "Consigne" or nomMC == "blocConsigne":
+ return
+ # if debug : print (nomMC, 'dans ajoute vraiment aux textes', self.entites )
+ if debug:
+ print(nomMC, "dans ajoute vraiment aux textes")
+ if debug:
+ print("avec pour entites ", self.entites[nomMC])
if len(self.entites[nomMC]) == 1:
- mc=self.entites[nomMC][0]
+ mc = self.entites[nomMC][0]
mc.dumpXsd(dansFactorisation=True)
- self.texteComplexe += '\t'*(indent) + mc.texteElt
- if mc.aCreer : self.texteComplexeVenantDesFils += mc.texteComplexe
- if mc.aCreer : self.texteSimple += mc.texteSimple
- if mc.aCreer : mc.aCreer=False
+ self.texteComplexe += "\t" * (indent) + mc.texteElt
+ if debug:
+ print("mc.aCreer ", mc.aCreer)
+ if mc.aCreer:
+ self.texteComplexeVenantDesFils += mc.texteComplexe
+ if mc.aCreer:
+ self.texteSimple += mc.texteSimple
+ if mc.aCreer:
+ mc.aCreer = False
+ if debug:
+ print("self.texteSimple", self.texteSimple)
+ print(
+ "self.texteComplexeVenantDesFils", self.texteComplexeVenantDesFils
+ )
return
- leType=type(self.entites[nomMC][0])
- for e in (self.entites[nomMC][1:]) :
+ leType = type(self.entites[nomMC][0])
+ for e in self.entites[nomMC][1:]:
if type(e) != leType:
- print ('Projection XSD impossible, changez un des ', nomMC)
+ print("Projection XSD impossible, changez un des ", nomMC)
exit()
+ # cas des matrices :
+ if (self.entites[nomMC][0].label == "SIMP") and hasattr(
+ self.entites[nomMC][0].type[0], "typElt"
+ ):
+ typeEltMatrice = self.entites[nomMC][0].type[0].typElt
+ memeElt = 1
+ nbColsMin = self.entites[nomMC][0].type[0].nbCols
+ nbColsMax = self.entites[nomMC][0].type[0].nbCols
+ nbLigsMin = self.entites[nomMC][0].type[0].nbLigs
+ nbLigsMax = self.entites[nomMC][0].type[0].nbLigs
+ for e in self.entites[nomMC][1:]:
+ if not (hasattr(e.type[0], "typElt")):
+ print("Projection XSD impossible, changez un des ", nomMC)
+ print("melange de matrice et de non matrice")
+ exit()
+ if not (e.type[0].typElt == typeEltMatrice):
+ memeElt = O
+ else:
+ if nbColsMin > e.type[0].nbCols:
+ nbColsMin = e.type[0].nbCols
+ if nbColsMax < e.type[0].nbCols:
+ nbColsMax = e.type[0].nbCols
+ if nbLigsMin > e.type[0].nbLigs:
+ nbLigsMin = e.type[0].nbLigs
+ if nbLigsMax < e.type[0].nbLigs:
+ nbLigsMax = e.type[0].nbLigs
+ if debug and memeElt:
+ print("memeElt : ", memeElt)
+ if memeElt:
+ self.fusionneDesMatricesDeMemeType(
+ nomMC, nbColsMin, nbColsMax, nbLigsMin, nbLigsMax
+ )
+ else:
+ self.fusionneDesMatrices(self, nomMC)
+ if debug:
+ print("fin fusion des matrices")
+ return
+
# cette boucle ne fonctionne que pour des SIMP
- resteATraiter=copy(self.entites[nomMC])
- #print ('________resteATraiter', resteATraiter)
- listePourUnion=[]
- first=1
- while resteATraiter != [] :
- nvlListeATraiter=[]
- mc=resteATraiter[0]
+ # if nomMC=='A': debug = False
+ resteATraiter = copy(self.entites[nomMC])
+ if debug:
+ print("________ calcul des unions resteATraiter", resteATraiter, self.nom)
+ print(self.entites[nomMC])
+ # for i in resteATraiter : print (i.nom)
+ listePourUnion = []
+ first = 1
+ while resteATraiter != []:
+ nvlListeATraiter = []
+ mc = resteATraiter[0]
listePourUnion.append(mc)
for autre in resteATraiter[1:]:
- if not (mc.compare(autre)) : nvlListeATraiter.append(autre)
- resteATraiter=copy(nvlListeATraiter)
+ if not (mc.compare(autre)):
+ nvlListeATraiter.append(autre)
+ resteATraiter = copy(nvlListeATraiter)
+ if debug:
+ print("listePourUnion : ", listePourUnion)
+ # on ajoute les fact 6/12/2022 dans le cas de len(listePourUnion =1)
if len(listePourUnion) == 1:
- mc=listePourUnion[0]
- mc.dumpXsd(dansFactorisation=True,multiple=False,first=first)
- self.texteComplexe += '\t'*(indent) + mc.texteElt
- if mc.aCreer : self.texteComplexeVenantDesFils += mc.texteComplexe
- if mc.aCreer : self.texteSimple += mc.texteSimple
- for mcIdent in self.entites[nomMC][1:]: mcIdent.metAJourPyxb(mc.nomDuTypePyxb)
- if mc.aCreer : mc.aCreer=False
+ mc = listePourUnion[0]
+ if debug:
+ print("ajout de ", mc.nom, " pour ", self.nom)
+ mc.dumpXsd(dansFactorisation=True, multiple=False, first=first)
+ if debug:
+ print("mc.aCreer = ", mc.aCreer)
+ # if debug : print ('mc.texteSimple = ', mc.texteSimple)
+ if debug:
+ print("mc.texteComplexe = ", mc.texteComplexe)
+ self.texteComplexe += "\t" * (indent) + mc.texteElt
+ if mc.aCreer:
+ self.texteComplexeVenantDesFils += mc.texteComplexe
+ if mc.aCreer:
+ self.texteSimple += mc.texteSimple
+ for mcIdent in self.entites[nomMC][1:]:
+ mcIdent.metAJourPyxb(mc.nomDuTypePyxb)
+ mcIdent.indiceDuTypePyxb = mc.indiceDuTypePyxb
+ if mc.aCreer:
+ mc.aCreer = False
return
# on ajoute le nom de l element
- if not (isinstance(self.entites[nomMC][0], Accas.SIMP)) :
- sontTousDisjoint=True
- index=1
- if debug : print ('on cherche si ils sont disjoints : ',self.entites[nomMC])
- for mc in self.entites[nomMC] :
- if debug : print ('compare mc' , mc, ' avec :')
+ if not (isinstance(self.entites[nomMC][0], Accas.SIMP)):
+ sontTousDisjoint = True
+ index = 1
+ if debug:
+ print("on cherche si ils sont disjoints : ", self.entites[nomMC])
+ for mc in self.entites[nomMC]:
+ if debug:
+ print("compare mc", mc, " avec :")
for mcFrere in self.entites[nomMC][index:]:
- ok = mc.isDisjoint(mcFrere)
- if not ok :
- sontTousDisjoint=False
- break
- if not(sontTousDisjoint) : break
- index+=1
- if not sontTousDisjoint:
- print ('2 blocs freres ont le meme nom et ne sont pas disjoints : pas encore traite')
- print ('Projection XSD impossible, changez un des ', nomMC)
- exit()
- self.fusionneDsUnChoix(nomMC,indent)
- if debug : print ('self.nom', self.nom)
- if debug : print ('self.texteComplexe' , self.texteComplexe)
- if debug : print ('self.texteSimple' , self.texteSimple)
- if debug : print ('self.texteElt' , self.texteElt)
- if debug : print ('________________________')
+ ok = mc.isDisjoint(mcFrere)
+ if not ok:
+ sontTousDisjoint = False
+ break
+ if not (sontTousDisjoint):
+ break
+ index += 1
+ if not sontTousDisjoint:
+ print(
+ "2 blocs freres ont le meme nom et ne sont pas disjoints : pas encore traite"
+ )
+ print("Projection XSD impossible, changez un des ", nomMC)
+ exit()
+ if debug:
+ print("les 2 blocs sont disjoints")
+ self.fusionneDsUnChoix(nomMC, indent, debug=debug)
+ if debug:
+ print("self.nom", self.nom)
+ if debug:
+ print("self.texteComplexe", self.texteComplexe)
+ if debug:
+ print("self.texteSimple", self.texteSimple)
+ if debug:
+ print("self.texteElt", self.texteElt)
+ if debug:
+ print("________________________")
return
-
-
- if hasattr(self.entites[nomMC][0], 'dejaDumpe') : # on a deja cree le type
- if debug : print (self.entites[nomMC][0].nomDuTypePyxb, ' deja dumpe')
- else :
- if debug : print ('appel de dumpXsd')
- self.entites[nomMC][0].dejaDumpe=True
- self.entites[nomMC][0].dumpXsd(dansFactorisation=True,multiple=True,first=first)
- if debug : print (self.entites[nomMC][0].nomDuTypePyxb)
-
- texteDocUnion='\n'
- i=1
+
+ if hasattr(self.entites[nomMC][0], "aDejaEteDumpe"): # on a deja cree le type
+ if debug:
+ print(self.entites[nomMC][0].nomDuTypePyxb, " deja dumpe")
+ else:
+ if debug:
+ print("appel de dumpXsd")
+ self.entites[nomMC][0].aDejaEteDumpe = True
+ self.entites[nomMC][0].dumpXsd(
+ dansFactorisation=True, multiple=True, first=first
+ )
+ if debug:
+ print(self.entites[nomMC][0].nomDuTypePyxb)
+
+ texteDocUnion = "\n"
+ i = 1
for mc in self.entites[nomMC]:
- if mc.ang != '' : texteDocUnion += str(i) + '- ' + mc.ang + ' or \n'; i=i+1
- elif mc .fr != '' : texteDocUnion += str(i) + '- ' + mc.fr + ' ou \n'; i=i+1
- if texteDocUnion == '\n' :
- self.texteComplexe += '\t'*(indent) + self.entites[nomMC][0].texteElt
- else :
+ if mc.ang != "":
+ texteDocUnion += str(i) + "- " + mc.ang + " or \n"
+ i = i + 1
+ elif mc.fr != "":
+ texteDocUnion += str(i) + "- " + mc.fr + " ou \n"
+ i = i + 1
+ if texteDocUnion == "\n":
+ self.texteComplexe += "\t" * (indent) + self.entites[nomMC][0].texteElt
+ else:
texteDocUnion = texteDocUnion[0:-4]
- debutTexteEltUnion = self.entites[nomMC][0].texteElt.split('maxOccurs=')[0]
- self.texteComplexe += '\t'*(indent)+ reconstitueUnion.format(debutTexteEltUnion,texteDocUnion)
- if self.entites[nomMC][0].nomDuTypePyxb in self.typesXSDDejaDumpes : return
+ debutTexteEltUnion = self.entites[nomMC][0].texteElt.split("maxOccurs=")[0]
+ self.texteComplexe += "\t" * (indent) + reconstitueUnion.format(
+ debutTexteEltUnion, texteDocUnion
+ )
+ if self.entites[nomMC][0].nomDuTypePyxb in self.typesXSDDejaDumpes:
+ return
self.typesXSDDejaDumpes.append(self.entites[nomMC][0].nomDuTypePyxb)
- if debug : print ('et la j ajoute les definitions de type', self.entites[nomMC][0].nomDuTypePyxb)
+ if debug:
+ print(
+ "et la j ajoute les definitions de type",
+ self.entites[nomMC][0].nomDuTypePyxb,
+ )
- nomTypePyxbUnion=self.entites[nomMC][0].nomDuTypePyxb
+ nomTypePyxbUnion = self.entites[nomMC][0].nomDuTypePyxb
texteSimpleUnion = debutSimpleType.format(nomTypePyxbUnion)
texteSimpleUnion += debutUnion
- texteSimpleUnion += '\t'*(indent)+self.entites[nomMC][0].texteSimplePart2
- texteSimplePart1 = self.entites[nomMC][0].texteSimplePart1
- for e in listePourUnion[1:] :
- e.dumpXsd(dansFactorisation=True,multiple=True,first=False)
+ texteSimpleUnion += "\t" * (indent) + self.entites[nomMC][0].texteSimplePart2
+ texteSimplePart1 = self.entites[nomMC][0].texteSimplePart1
+ for e in listePourUnion[1:]:
+ e.dumpXsd(dansFactorisation=True, multiple=True, first=False)
# si on ext un mc simple la ligne suivante est inutile
# en revanche on ajoute le texte a tous les coups
- #self.texteComplexeVenantDesFils += e.texteComplexe
+ # self.texteComplexeVenantDesFils += e.texteComplexe
e.metAJourPyxb(nomTypePyxbUnion)
- texteSimpleUnion += '\t'*(indent) + e.texteSimplePart2
+ texteSimpleUnion += "\t" * (indent) + e.texteSimplePart2
texteSimplePart1 += e.texteSimplePart1
texteSimpleUnion += finUnion
- texteSimpleUnion +=fermeSimpleType
+ texteSimpleUnion += fermeSimpleType
self.texteSimple += texteSimplePart1 + texteSimpleUnion
- if debug :
- print ('______________')
- print (self.texteSimple)
- print ('______________')
- #print ('self.texteSimple', self.texteSimple)
-
- def fusionneDsUnChoix(self, nomMC,indent, debug=False):
- if debug : print ('_________________________________', self.nom, self, nomMC,indent)
- if debug : print (self.texteComplexe)
- texteDocUnion='\n'
- texteComplexe=''
- texteComplexeVenantDesFils=''
- texteSimple=''
- mcRef= self.entites[nomMC][0]
+ # if debug :
+ # print ('______________')
+ # print (self.texteSimple)
+ # print ('______________')
+
+ def fusionneDsUnChoix(self, nomMC, indent, debug=False):
+ if debug:
+ print("______fusionneDsUnChoix ", self.nom, self, nomMC, indent)
+ if debug:
+ print(self.texteComplexe)
+ texteDocUnion = "\n"
+ texteComplexe = ""
+ texteComplexeVenantDesFils = ""
+ texteSimple = ""
+ mcRef = self.entites[nomMC][0]
# max = 1 : a priori les choix sont exclusifs
- if (hasattr (mcRef, 'aDejaEteDumpe')) :
- if debug : print ("je passe la NORMALEMENT car j ai deja ete dumpe")
- return
- leNomDuTypePyxb = mcRef.definitNomDuTypePyxb(forceACreer=True)
- if debug : print ('nomMC', nomMC)
+ if hasattr(mcRef, "aDejaEteDumpe"):
+ self.texteComplexe += "\t" * (indent) + mcRef.texteElt
+ if debug:
+ print(
+ "je passe la NORMALEMENT car j ai deja ete dumpe, j ajoute juste l elt"
+ )
+ return
+ leNomDuTypePyxb = mcRef.definitNomDuTypePyxb(forceACreer=True)
+ if debug:
+ print("nomMC", nomMC)
+ i = 0
+
+ cata = CONTEXT.getCurrentCata()
for mc in self.entites[nomMC]:
- if debug : print ('------------', mc)
- # on laisse dansFactorisation a False car ce n est pas comme une fusion de bloc
- mc.texteComplexe = ''
- mc.texteSimple = ''
- mc.texteElt = ''
+ if debug:
+ print("------------", mc)
+ # on laisse dansFactorisation a False car ce n est pas comme une fusion de bloc
+ mc.texteComplexe = ""
+ mc.texteSimple = ""
+ mc.texteElt = ""
mc.dumpXsd(dansFactorisationDeFusion=True)
- if debug : print ('texteSimple\n', mc.texteSimple, '\n fin\n')
- if debug : print ('texteComplexeVenantDesFils\n',mc.texteComplexeVenantDesFils, '\n fin\n')
- if debug : print ('texteComplexe\n', mc.texteComplexe, '\n fin\n')
- if mc.ang != '' : texteDocUnion += str(i) + '- ' + mc.ang + ' or \n'; i=i+1
- elif mc .fr != '' : texteDocUnion += str(i) + '- ' + mc.fr + ' ou \n'; i=i+1
+ mc.nomDuTypePyxb = leNomDuTypePyxb
+ if debug:
+ print("texteSimple\n", mc.texteSimple, "\n fin\n")
+ if debug:
+ print(
+ "texteComplexeVenantDesFils\n",
+ mc.texteComplexeVenantDesFils,
+ "\n fin\n",
+ )
+ if debug:
+ print("texteComplexe\n", mc.texteComplexe, "\n fin\n")
+ if mc.ang != "":
+ texteDocUnion += str(i) + "- " + mc.ang + " or \n"
+ i = i + 1
+ elif mc.fr != "":
+ texteDocUnion += str(i) + "- " + mc.fr + " ou \n"
+ i = i + 1
texteComplexe += mc.texteComplexe
- texteComplexeVenantDesFils += mc.texteComplexeVenantDesFils
+ texteComplexeVenantDesFils += mc.texteComplexeVenantDesFils
texteSimple += mc.texteSimple
- if debug : print ('______________________________')
- if debug : print ('textecomplexeVenantDesFils : \n' ,texteComplexeVenantDesFils )
- if debug : print ('______________________________')
- if debug : print ('______________________________')
- if debug : print ('textecomplexe : \n' ,texteComplexe )
- if debug : print ('______________________________')
- self.entites[nomMC][0].aDejaEteDumpe=True
-
- self.texteElt = eltCompoDsSequence.format(nomMC, self.nomDuCodeDumpe,mcRef.nomDuTypePyxb,1,1)
+ if debug:
+ print("______________________________")
+ if debug:
+ print("textecomplexeVenantDesFils : \n", texteComplexeVenantDesFils)
+ if debug:
+ print("______________________________")
+ if debug:
+ print("______________________________")
+ if debug:
+ print("textecomplexe : \n", texteComplexe)
+ if debug:
+ print("______________________________")
+ self.entites[nomMC][0].aDejaEteDumpe = True
+
+ self.texteElt = eltCompoDsSequence.format(
+ nomMC, self.nomDuCodeDumpe, mcRef.nomDuTypePyxb, 1, 1
+ )
self.texteDuFact = debutTypeCompo.format(self.entites[nomMC][0].nomDuTypePyxb)
self.texteDuFact += debutChoiceDsBloc
- self.texteDuFact += texteComplexe
+ self.texteDuFact += texteComplexe
self.texteDuFact += finChoiceDsBloc
self.texteDuFact += finTypeCompo
self.texteSimple += texteSimple
- self.texteComplexeVenantDesFils += texteComplexeVenantDesFils
- self.texteComplexeVenantDesFils += self.texteDuFact
- self.texteComplexe += self.texteElt
- if debug : print ('______________________________')
- if debug : print ('texteSimple : \n' ,self.texteSimple )
- if debug : print ('______________________________')
- self.entites[nomMC][0].aDejaEteDumpe=True
-
+ self.texteComplexeVenantDesFils += texteComplexeVenantDesFils
+ self.texteComplexeVenantDesFils += self.texteDuFact
+ self.texteComplexe += self.texteElt
+ if debug:
+ print("______________________________")
+ if debug:
+ print("texteSimple : \n", self.texteSimple)
+ if debug:
+ print("______________________________")
+ self.entites[nomMC][0].aDejaEteDumpe = True
+
+ def fusionneDesMatricesDeMemeType(
+ self, nomMC, nbColsMin, nbColsMax, nbLigsMin, nbLigsMax, debug=False
+ ):
+ if debug:
+ print(
+ "fusionneDesMatricesDeMemeType",
+ nomMC,
+ nbColsMin,
+ nbColsMax,
+ nbLigsMin,
+ nbLigsMax,
+ )
+ elt = self.entites[nomMC][0]
+ typeDeMatrice = elt.type[0]
+ elt.dumpXsd(dansFactorisation=True)
+ if debug:
+ # print ('fusionneDesMatricesDeMemeType self.texteSimple avant', self.texteSimple)
+ print(
+ "fusionneDesMatricesDeMemeType self.texteComplexe avant",
+ self.texteComplexe,
+ )
+ # if
+ self.texteSimple += debutSimpleType.format(elt.nomDuTypePyxb + "_element")
+ self.texteSimple += debutRestrictionBase.format(elt.nomDuTypeDeBase)
+ if typeDeMatrice.typEltInto != None:
+ for val in typeDeMatrice.typEltInto:
+ self.texteSimple += enumeration.format(val)
+ self.texteSimple += fermeRestrictionBase
+ self.texteSimple += fermeSimpleType
+ nom = elt.nomDuTypePyxb
+ self.texteSimple += matriceSimpleType.format(
+ nom,
+ nom,
+ nbColsMin,
+ nbColsMax,
+ nom,
+ self.code,
+ nom,
+ nbLigsMin,
+ nbLigsMax,
+ nom,
+ self.code,
+ nom,
+ 1,
+ 1,
+ )
+ self.texteComplexe += eltMatrice.format(nomMC, self.code, nom, 0, 1)
+ if debug:
+ print("fusionneDesMatricesDeMemeType, self.texteSimple ", self.texteSimple)
+ if debug:
+ print(
+ "fusionneDesMatricesDeMemeType self.texteComplexe", self.texteComplexe
+ )
+ if debug:
+ print("------------------------------------------ ")
+
+ def fusionneDesMatrices(self, nomMC):
+ # print ('______fusionneDesMatrices ', nomMC, ' dans : ', self)
+ # print ('Pas d union des types complexes')
+ # if debug : print (self.texteComplexe)
+ # self.texteComplexe = debutTypeSubstDsBlocFactorise.format(self.nomDuTypePyxb)
+ self.texteComplexe += debutChoiceDsBloc
+ for mc in self.entites[nomMC]:
+ mc.dumpXsd()
+ self.texteComplexe += mc.texteElt
+ self.texteSimple += mc.texteSimple
+ mc.aDejaEteDumpe = True
+ self.texteComplexe += finChoiceDsBloc
# ----------------------------------------
-class X_definitionComposee (X_definition):
-# ------------------------------------------
+class X_definitionComposee(X_definition):
+ # ------------------------------------------
- def creeTexteComplexeVenantDesFils(self,dansFactorisation=False,debug=False):
- texteComplexeVenantDesFils=""
- blocsDejaDumpes=set()
- #for nom in self.ordre_mc:
+ def creeTexteComplexeVenantDesFils(self, dansFactorisation=False, debug=False):
+ texteComplexeVenantDesFils = ""
+ blocsDejaDumpes = set()
+ # for nom in self.ordre_mc:
# mcFils = self.entites[nom]
- if debug : print ('creeTexteComplexeVenantDesFils', self.nom)
- if self.nom == 'LeProc' : debug = True
- for mcFils in self.mcXSD :
- #print (mcFils,mcFils.nom)
- if mcFils.nom == 'B1_B2' :debug=True
- else : debug=False
- if not (isinstance(mcFils, Accas.BLOC)) :
- mcFils.dumpXsd(dansFactorisation)
+ if debug:
+ print("___________________ creeTexteComplexeVenantDesFils", self.nom)
+ for mcFils in self.mcXSD:
+ if debug:
+ print(mcFils, mcFils.nom)
+ else:
+ debug = False
+ if not (isinstance(mcFils, Accas.BLOC)):
+ mcFils.dumpXsd(dansFactorisation=False)
self.texteComplexe += mcFils.texteElt
- if mcFils.aCreer : self.texteSimple += mcFils.texteSimple
- if mcFils.aCreer : texteComplexeVenantDesFils += mcFils.texteComplexe
- else :
- if hasattr(mcFils,'nomXML') and mcFils.nomXML in blocsDejaDumpes and mcFils.nomXML != None : continue
- if hasattr(mcFils,'nomXML') and mcFils.nomXML != None: blocsDejaDumpes.add(mcFils.nomXML)
- mcFils.dumpXsd(dansFactorisation)
+ if mcFils.aCreer:
+ self.texteSimple += mcFils.texteSimple
+ if mcFils.aCreer:
+ texteComplexeVenantDesFils += mcFils.texteComplexe
+ else:
+ if (
+ hasattr(mcFils, "nomXML")
+ and mcFils.nomXML in blocsDejaDumpes
+ and mcFils.nomXML != None
+ ):
+ continue
+ if hasattr(mcFils, "nomXML") and mcFils.nomXML != None:
+ blocsDejaDumpes.add(mcFils.nomXML)
+ mcFils.dumpXsd(dansFactorisation=False)
self.texteComplexe += mcFils.texteElt
- if mcFils.aCreer : self.texteSimple += mcFils.texteSimple
- if mcFils.aCreer : texteComplexeVenantDesFils += mcFils.texteComplexe
+ if mcFils.aCreer:
+ self.texteSimple += mcFils.texteSimple
+ if mcFils.aCreer:
+ texteComplexeVenantDesFils += mcFils.texteComplexe
return texteComplexeVenantDesFils
- def dumpXsd(self, dansFactorisation=False, dansFactorisationDeFusion = False, multiple = False, first=True, debug=False):
- if PourTraduction : print (self.nom)
+ def dumpXsd(
+ self,
+ dansFactorisation=False,
+ dansFactorisationDeFusion=False,
+ multiple=False,
+ first=True,
+ debug=False,
+ avecEltAbstrait=True,
+ ):
+ # PNPN
+ if debug:
+ print(
+ "dumpXsd pour",
+ self.nom,
+ dansFactorisation,
+ dansFactorisationDeFusion,
+ multiple,
+ first,
+ )
+ if PourTraduction:
+ print(self.nom)
# le prepareDump est appele sur les fils
- if not (self.dejaPrepareDump) : self.prepareDumpXSD()
+ if not (self.dejaPrepareDump):
+ self.prepareDumpXSD()
self.getNomDuCodeDumpe()
- if first :
- if multiple : self.nomDuTypePyxb = self.definitNomDuTypePyxb(forceACreer=True)
- else : self.nomDuTypePyxb = self.definitNomDuTypePyxb()
- self.texteSimple = "" # on n ajoute pas de type simple
+ if first:
+ if multiple:
+ self.nomDuTypePyxb = self.definitNomDuTypePyxb(forceACreer=True)
+ else:
+ self.nomDuTypePyxb = self.definitNomDuTypePyxb()
+ if debug:
+ print("dumpXsd pour", self.nom, self.aCreer)
+ self.texteSimple = "" # on n ajoute pas de type simple
self.traduitMinMax()
+ if dansFactorisation:
+ self.minOccurs = 1
# pour accepter les PROC et ...
#
- if debug : print ('dumpXsd', self.nom, self.aCreer)
+ if debug:
+ print("dumpXsd apres traduitMinMax, aCreer", self.nom, self.aCreer)
+ # if self.nom == 'Result' : print ('je suis dans dumpXsd et ', dansFactorisationDeFusion)
if self.aCreer or dansFactorisationDeFusion:
- if not dansFactorisationDeFusion : self.texteComplexe = debutTypeCompo.format(self.nomDuTypePyxb)
- if isinstance(self,X_OPER) or isinstance(self,X_PROC) :
+ if not dansFactorisationDeFusion:
+ self.texteComplexe = debutTypeCompo.format(self.nomDuTypePyxb)
+ if (
+ isinstance(self, X_OPER) or isinstance(self, X_PROC)
+ ) and avecEltAbstrait:
self.texteComplexe += debutTypeCompoEtape.format(self.code)
self.texteComplexe += debutTypeCompoSeq
- texteComplexeVenantDesFils= self.creeTexteComplexeVenantDesFils(dansFactorisation)
- if not dansFactorisationDeFusion :
- self.texteComplexe = texteComplexeVenantDesFils + self.texteComplexe
- self.texteComplexeVenantDesFils = ''
- else :
- self.texteComplexeVenantDesFils = texteComplexeVenantDesFils
+ texteComplexeVenantDesFils = self.creeTexteComplexeVenantDesFils(
+ dansFactorisation
+ )
+ if not dansFactorisationDeFusion:
+ self.texteComplexe = texteComplexeVenantDesFils + self.texteComplexe
+ self.texteComplexeVenantDesFils = ""
+ else:
+ self.texteComplexeVenantDesFils = texteComplexeVenantDesFils
# la fin de l oper est traitee dans le dumpXSD de X_OPER
- if not isinstance(self,X_OPER ) : self.texteComplexe += finTypeCompoSeq
- if isinstance(self,X_PROC) : self.texteComplexe += finTypeCompoEtape
- if not isinstance(self,X_OPER ) and not dansFactorisationDeFusion: self.texteComplexe += finTypeCompo
- else :
+ if not isinstance(self, X_OPER):
+ self.texteComplexe += finTypeCompoSeq
+ if isinstance(self, X_PROC) and avecEltAbstrait:
+ self.texteComplexe += finTypeCompoEtape
+ if not isinstance(self, X_OPER) and not dansFactorisationDeFusion:
+ self.texteComplexe += finTypeCompo
+ else:
self.texteComplexe = ""
- if self.ang != "" : self.texteElt=eltCompoDsSequenceWithHelp.format(self.nom,self.nomDuCodeDumpe,self.nomDuTypePyxb,self.minOccurs,self.maxOccurs, self.ang)
- elif self.fr != "" : self.texteElt=eltCompoDsSequenceWithHelp.format(self.nom,self.nomDuCodeDumpe,self.nomDuTypePyxb,self.minOccurs,self.maxOccurs, self.fr)
- else : self.texteElt=eltCompoDsSequence.format(self.nom,self.nomDuCodeDumpe,self.nomDuTypePyxb,self.minOccurs,self.maxOccurs)
- #print ('------------------------------------------------',self.nom)
- #print (self.texteComplexe)
+ if self.ang != "":
+ self.texteElt = eltCompoDsSequenceWithHelp.format(
+ self.nom,
+ self.nomDuCodeDumpe,
+ self.nomDuTypePyxb,
+ self.minOccurs,
+ self.maxOccurs,
+ self.ang,
+ )
+ elif self.fr != "":
+ self.texteElt = eltCompoDsSequenceWithHelp.format(
+ self.nom,
+ self.nomDuCodeDumpe,
+ self.nomDuTypePyxb,
+ self.minOccurs,
+ self.maxOccurs,
+ self.fr,
+ )
+ else:
+ self.texteElt = eltCompoDsSequence.format(
+ self.nom,
+ self.nomDuCodeDumpe,
+ self.nomDuTypePyxb,
+ self.minOccurs,
+ self.maxOccurs,
+ )
+ if debug:
+ print("------------------------------------------------", self.nom)
+ if debug:
+ print("self.texteComplexe", self.texteComplexe)
def traduitMinMax(self):
- # ______________________
- # valable pour PROC et OPER
+ # ______________________
+ # valable pour PROC et OPER
+ # Attention maxOccurs = unBounded si il y a une seule commande dans le cata
+ # Pas pris en compte ici
self.minOccurs = 0
self.maxOccurs = 1
- def compare(self,autreMC):
- if self.label != autreMC.label : return False
- if hasattr(self,'nomXML') and hasattr(autreMC,'nomXML') and self.nomXML==autreMC.nomXML and self.nomXML != None : return True
- for attr in ( 'regles', 'fr', 'defaut', 'min' ,'max', 'position' , 'docu' ) :
- val1=getattr(self,attr)
- val2=getattr(autreMC,attr)
- if val1 != val2 : return False
- if len(self.entites) != len(autreMC.entites) : return False
+ def compare(self, autreMC):
+ if self.label != autreMC.label:
+ return False
+ if (
+ hasattr(self, "nomXML")
+ and hasattr(autreMC, "nomXML")
+ and self.nomXML == autreMC.nomXML
+ and self.nomXML != None
+ ):
+ return True
+ for attr in ("regles", "fr", "defaut", "min", "max", "position", "docu"):
+ try:
+ val1 = getattr(self, attr)
+ except:
+ val1 = None
+ try:
+ val2 = getattr(autreMC, attr)
+ except:
+ val2 = None
+ if val1 != val2:
+ return False
+ if len(self.entites) != len(autreMC.entites):
+ return False
for defFille in self.entites.keys():
- if defFille not in autreMC.entites.keys() : return False
- if not self.entites[defFille].compare(autreMC.entites[defFille]) : return False
+ if defFille not in autreMC.entites.keys():
+ return False
+ if not self.entites[defFille].compare(autreMC.entites[defFille]):
+ return False
return True
def prepareDumpXSD(self):
- self.dejaPrepareDump=True
- self.inUnion=False
- self.tousLesFils=[]
- self.mcXSD=[]
+ self.dejaPrepareDump = True
+ self.inUnion = False
+ self.tousLesFils = []
+ self.mcXSD = []
for nomMC in self.ordre_mc:
- mc=self.entites[nomMC]
+ mc = self.entites[nomMC]
self.mcXSD.append(mc)
mc.prepareDumpXSD()
self.chercheListesDeBlocsNonDisjoints()
- for l in list(self.listeDesBlocsNonDisjoints) :
- if not(self.besoinDeFactoriserTrivial(l)) : self.listeDesBlocsNonDisjoints.remove(l)
- else : self.factorise(l)
+ for l in list(self.listeDesBlocsNonDisjoints):
+ if not (self.besoinDeFactoriserTrivial(l)):
+ self.listeDesBlocsNonDisjoints.remove(l)
+ else:
+ self.possedeDejaUnMCFactorise = 1
+ self.factorise(l)
def chercheListesDeBlocsNonDisjoints(self):
- self.listeDesBlocsNonDisjoints=[]
- for nomChild in self.ordre_mc :
- child=self.entites[nomChild]
- if child.label != 'BLOC' : continue
- if self.listeDesBlocsNonDisjoints == [] :
+ self.listeDesBlocsNonDisjoints = []
+ for nomChild in self.ordre_mc:
+ child = self.entites[nomChild]
+ if child.label != "BLOC":
+ continue
+ if self.listeDesBlocsNonDisjoints == []:
self.listeDesBlocsNonDisjoints.append([child])
continue
- vraimentIndependant=True
+ vraimentIndependant = True
for liste in list(self.listeDesBlocsNonDisjoints):
- independant=True
- for bloc in liste :
- if bloc.isDisjoint(child) : continue
- if bloc.estLeMemeQue(child) : continue
- independant=False
- vraimentIndependant=False
- if not (independant) :
+ independant = True
+ for bloc in liste:
+ if bloc.isDisjoint(child):
+ continue
+ if bloc.estLeMemeQue(child):
+ continue
+ independant = False
+ vraimentIndependant = False
+ if not (independant):
liste.append(child)
if vraimentIndependant:
self.listeDesBlocsNonDisjoints.append([child])
# on nettoye la liste des blocs tous seuls
- for l in list(self.listeDesBlocsNonDisjoints) :
- if len(l) ==1 : self.listeDesBlocsNonDisjoints.remove(l)
-
- def estLeMemeQue(self,autreMC):
- if hasattr(self,'nomXML') and hasattr(autreMC,'nomXML') and self.nomXML==autreMC.nomXML and self.nomXML != None: return True
+ for l in list(self.listeDesBlocsNonDisjoints):
+ if len(l) == 1:
+ self.listeDesBlocsNonDisjoints.remove(l)
+
+ def estLeMemeQue(self, autreMC):
+ if (
+ hasattr(self, "nomXML")
+ and hasattr(autreMC, "nomXML")
+ and self.nomXML == autreMC.nomXML
+ and self.nomXML != None
+ ):
+ return True
return False
- def aUnPremierCommunDansLesPossibles(self, laListe) :
- # fonctionne avec liste de mc ou une liste(mc,index)
+ def aUnPremierCommunDansLesPossibles(self, laListe):
+ # fonctionne avec liste de mc ou une liste(mc,index)
import types
- mesPremiers=set()
- for elt,index in laListe :
- if not type(e) == types.ListType :
- if elt.nom in mesPremiers : return True
+
+ mesPremiers = set()
+ for elt, index in laListe:
+ if not type(e) == types.ListType:
+ if elt.nom in mesPremiers:
+ return True
mesPremiers.add(elt.nom)
- else :
- if elt[0].nom in mesPremiers : return True
+ else:
+ if elt[0].nom in mesPremiers:
+ return True
mesPremiers.add(elt[0].nom)
return False
- def besoinDeFactoriserTrivial(self,laListe):
+ def besoinDeFactoriserTrivial(self, laListe):
# tout faux
# a revoir
return True
- besoin=False
- lesPremiers=set()
- for mcBloc in laListe :
- mc=mcBloc.mcXSD[0]
- if mc.label == 'BLOC' : return True
- if not(mc.statut=='o') : return True
- if mc.nom in lesPremiers : return True
+ besoin = False
+ lesPremiers = set()
+ for mcBloc in laListe:
+ mc = mcBloc.mcXSD[0]
+ if mc.label == "BLOC":
+ return True
+ if not (mc.statut == "o"):
+ return True
+ if mc.nom in lesPremiers:
+ return True
lesPremiers.add(mc.nom)
return False
- def factorise(self,liste,debug=False):
- self.listeConstruction=liste
- nomDebut=liste[0].nom
- indexDebut=self.mcXSD.index(liste[0])
- nomFin=liste[-1].nom
- indexFin=self.mcXSD.index(liste[-1]) + 1
- nom=nomDebut+'_'+nomFin
- if debug : print ('___________ dans factorise', nom)
- listeAFactoriser=[]
- for i in range(indexDebut, indexFin) :
+ def factorise(self, liste, debug=False):
+ self.listeConstruction = liste
+ nomDebut = liste[0].nom
+ indexDebut = self.mcXSD.index(liste[0])
+ nomFin = liste[-1].nom
+ indexFin = self.mcXSD.index(liste[-1]) + 1
+ nom = nomDebut + "_" + nomFin
+ if debug:
+ print("___________ dans factorise", nom)
+ listeAFactoriser = []
+ for i in range(indexDebut, indexFin):
listeAFactoriser.append(self.mcXSD[i])
- newListe=self.mcXSD[0:indexDebut]
+ newListe = self.mcXSD[0:indexDebut]
- monEltFacteur=X_compoFactoriseAmbigu(nom,listeAFactoriser,self)
+ monEltFacteur = X_compoFactoriseAmbigu(nom, listeAFactoriser, self)
newListe.append(monEltFacteur)
- newListe=newListe+self.mcXSD[indexFin:]
- self.mcXSD=newListe
- if debug :print ('___________ fin fin factorise', nom)
+ newListe = newListe + self.mcXSD[indexFin:]
+ self.mcXSD = newListe
+ if debug:
+ print("___________ fin fin factorise", nom)
def construitTousLesFils(self):
- for nomChild in self.ordre_mc :
- if nomChild == 'Consigne' or nomChild == 'blocConsigne' : continue
- child=self.entites[nomChild]
- if child.label != 'BLOC' :
+ for nomChild in self.ordre_mc:
+ if nomChild == "Consigne" or nomChild == "blocConsigne":
+ continue
+ child = self.entites[nomChild]
+ if child.label != "BLOC":
self.tousLesFils.append(child.nom)
else:
- if child.tousLesFils == [] : child.construitTousLesFils()
- for nomPetitFils in child.tousLesFils : self.tousLesFils.append(nomPetitFils)
- #print ('construitArbreEntier pour ', self.nom, self.tousLesFils)
-
-
- def isDisjoint(self, mc1) :
- if self.tousLesFils == [] : self.construitTousLesFils()
- if not (hasattr(mc1, 'tousLesFils')) : mc1.tousLesFils = []
- if mc1.tousLesFils == [] : mc1.construitTousLesFils()
- for fils in mc1.tousLesFils :
- if fils in self.tousLesFils : return False
+ if child.tousLesFils == []:
+ child.construitTousLesFils()
+ for nomPetitFils in child.tousLesFils:
+ self.tousLesFils.append(nomPetitFils)
+ # print ('construitArbreEntier pour ', self.nom, self.tousLesFils)
+
+ def isDisjoint(self, mc1):
+ if self.tousLesFils == []:
+ self.construitTousLesFils()
+ if not (hasattr(mc1, "tousLesFils")):
+ mc1.tousLesFils = []
+ if mc1.tousLesFils == []:
+ mc1.construitTousLesFils()
+ for fils in mc1.tousLesFils:
+ if fils in self.tousLesFils:
+ return False
return True
-
-
# ---------------------------------
-class X_FACT (X_definitionComposee):
-#--------- ------------------------
-#Un FACT avec max=** doit se projeter en XSD sous forme d'une sequence a cardinalite 1 et
-# l'element qui porte la repetition du FACT
- def traduitMinMax(self):
- if self.max == '**' or self.max == float('inf') : self.maxOccurs="unbounded"
- else : self.maxOccurs = self.max
+class X_FACT(X_definitionComposee):
+ # --------- ------------------------
+ # Un FACT avec max=** doit se projeter en XSD sous forme d'une sequence a cardinalite 1 et
+ # l'element qui porte la repetition du FACT
+ def traduitMinMax(self, maxOccurs=None):
+ if self.max == "**" or self.max == float("inf"):
+ self.maxOccurs = "unbounded"
+ else:
+ self.maxOccurs = self.max
self.minOccurs = self.min
- if self.statut =='f' : self.minOccurs=0
- if self.statut =='o' and self.min < 2: self.minOccurs=1
+ if self.statut == "f":
+ self.minOccurs = 0
+ if self.statut == "o" and self.min < 2:
+ self.minOccurs = 1
def construitArbrePossibles(self):
- if self.statut == 'f' :
- self.arbrePossibles = (self.nom,[])
- self.arbreMCPossibles = (self,None)
- else :
+ if self.statut == "f":
+ self.arbrePossibles = (self.nom, [])
+ self.arbreMCPossibles = (self, None)
+ else:
self.arbrePossibles = (self.nom,)
self.arbreMCPossibles = (self,)
- #print ('XFACT arbre des possibles de ' ,self.nom, self.arbrePossibles)
-
+ # print ('XFACT arbre des possibles de ' ,self.nom, self.arbrePossibles)
# ---------------------------------
-class X_OPER (X_definitionComposee):
-# ---------------------------------
- def dumpXsd(self, dansFactorisation=False, multiple = False, first=False):
- X_definitionComposee.dumpXsd(self,dansFactorisation)
+class X_OPER(X_definitionComposee):
+ # ---------------------------------
+ def dumpXsd(
+ self, dansFactorisation=False, multiple=False, first=False, avecEltAbstrait=True
+ ):
+ X_definitionComposee.dumpXsd(
+ self, dansFactorisation, avecEltAbstrait=avecEltAbstrait
+ )
self.texteComplexe += finTypeCompoSeq
self.texteComplexe += attributeNameName
self.texteComplexe += attributeTypeForASSD
self.texteComplexe += attributeTypeUtilisateurName.format(self.sd_prod.__name__)
- self.texteComplexe += finTypeCompoEtape
+ if avecEltAbstrait:
+ self.texteComplexe += finTypeCompoEtape
self.texteComplexe += finTypeCompo
-
cata = CONTEXT.getCurrentCata()
- if self.sd_prod.__name__ not in list(cata.dictTypesASSDorUserASSDCrees) :
- cata.dictTypesASSDorUserASSDCrees[self.sd_prod.__name__]=[self,]
- else :
+ if self.sd_prod.__name__ not in list(cata.dictTypesASSDorUserASSDCrees):
+ cata.dictTypesASSDorUserASSDCrees[self.sd_prod.__name__] = [
+ self,
+ ]
+ else:
cata.dictTypesASSDorUserASSDCrees[self.sd_prod.__name__].append(self)
# ----------------------------------
-class X_PROC (X_definitionComposee):
-#-----------------------------------
+class X_PROC(X_definitionComposee):
+ # -----------------------------------
pass
-#-----------------------------------
-class X_BLOC (X_definitionComposee):
-#-----------------------------------
- def dumpXsd(self, dansFactorisation=False, multiple = False, first=False, debug = False):
- if debug : print ('X_BLOC dumpXsd', self.nom)
- self.tousLesFils=[]
- if self.nom == 'blocConsigne' :
+
+# -----------------------------------
+class X_BLOC(X_definitionComposee):
+ # -----------------------------------
+ def dumpXsd(
+ self, dansFactorisation=False, multiple=False, first=False, debug=False
+ ):
+ if debug:
+ print("X_BLOC dumpXsd", self.nom)
+ self.tousLesFils = []
+ if self.nom == "blocConsigne":
self.texteComplexe = ""
- self.texteSimple = ""
+ self.texteSimple = ""
self.nomDuTypePyxb = "NonTraiteConsigne"
- self.texteSimpleVenantDesFils = ""
self.aCreer = False
self.texteElt = ""
self.getNomDuCodeDumpe()
# dans ce cas les blocs successifs sont identiques et on ne dumpe que le 1er
- self.nomDuTypePyxb = self.definitNomDuTypePyxb()
- self.texteSimple = "" # on n ajoute pas de type simple
+ self.nomDuTypePyxb = self.definitNomDuTypePyxb()
+ self.texteSimple = "" # on n ajoute pas de type simple
# Pour les blocs le minOccurs vaut 0 et le max 1
- if self.aCreer :
+ if self.aCreer:
self.texteComplexe = debutTypeSubst.format(self.nomDuTypePyxb)
- texteComplexeVenantDesFils=self.creeTexteComplexeVenantDesFils(dansFactorisation)
- self.texteComplexe = texteComplexeVenantDesFils + self.texteComplexe
+ texteComplexeVenantDesFils = self.creeTexteComplexeVenantDesFils(
+ dansFactorisation
+ )
+ self.texteComplexe = texteComplexeVenantDesFils + self.texteComplexe
self.texteComplexe += finTypeSubst
- else :
+ else:
self.texteComplexe = ""
- self.texteElt=substDsSequence.format(self.code,self.nomDuTypePyxb,0,1,'condition : ' +self.condition)
-
- #print ('------------------------------------------------')
-
- def compare(self,autreMC):
- if self.label != autreMC.label : return False
- if self.inUnion == True or autreMC.inUnion == True : return False
- if hasattr(self,'nomXML') and hasattr(autreMC,'nomXML') and self.nomXML==autreMC.nomXML and self.nomXML != None : return True
- for attr in ( 'condition', 'regles', ):
- val1=getattr(self,attr)
- val2=getattr(autreMC,attr)
- if val1 != val2 : return False
- if len(self.entites) != len(autreMC.entites) : return False
+ self.texteElt = substDsSequence.format(
+ self.code, self.nomDuTypePyxb, 0, 1, "condition : " + self.condition
+ )
+
+ # print ('------------------------------------------------')
+
+ def compare(self, autreMC):
+ if self.label != autreMC.label:
+ return False
+ if self.inUnion == True or autreMC.inUnion == True:
+ return False
+ if (
+ hasattr(self, "nomXML")
+ and hasattr(autreMC, "nomXML")
+ and self.nomXML == autreMC.nomXML
+ and self.nomXML != None
+ ):
+ return True
+ for attr in (
+ "condition",
+ "regles",
+ ):
+ val1 = getattr(self, attr)
+ val2 = getattr(autreMC, attr)
+ if val1 != val2:
+ return False
+ if len(self.entites) != len(autreMC.entites):
+ return False
for defFille in self.entites.keys():
- if defFille not in autreMC.entites.keys() : return False
- if not self.entites[defFille].compare(autreMC.entites[defFille]) : return False
+ if defFille not in autreMC.entites.keys():
+ return False
+ if not self.entites[defFille].compare(autreMC.entites[defFille]):
+ return False
return True
def construitArbrePossibles(self):
- self.arbrePossibles=[[],]
- #print ('X_BLOC je construis l arbre des possibles pour ', self.nom)
- for child in self.mcXSD :
- if not hasattr(child, 'arbrePossibles') : child.construitArbrePossibles()
- #print (child.nom, child.label, child.arbrePossibles)
- if child.label == 'BLOC' :
- self.arbrePossibles = deepcopy(self.remplaceListeParContenuEtVide(self.arbrePossibles, child.arbrePossibles))
- elif child.label == 'BlocAmbigu':
- #print ("je passe par la pour", self.nom, child.nom, self.arbrePossibles, child.arbrePossibles)
- self.arbrePossibles = deepcopy(self.remplaceListeParContenuEtVide(self.arbrePossibles, child.arbrePossibles))
- #print ('resultat', self.arbrePossibles)
- else :
- self.arbrePossibles = deepcopy(self.adjoint(self.arbrePossibles, child.arbrePossibles))
- self.arbrePossibles.append([]) # un bloc n est pas obligatoire
- #print ('arbre des possibles de ' ,self.nom, self.arbrePossibles)
-
-
-#--------------------------------
-class X_SIMP (X_definition):
-#--------------------------------
- def dumpXsd(self, dansFactorisation=False, multiple=False, first=False, debug=False):
- #debug = True
- #if PourTraduction : print (self.nom)
- if debug : print ('X_SIMP dumpXsd pour', self.nom, '___________________________')
+ self.arbrePossibles = [
+ [],
+ ]
+ # print ('X_BLOC je construis l arbre des possibles pour ', self.nom)
+ for child in self.mcXSD:
+ if not hasattr(child, "arbrePossibles"):
+ child.construitArbrePossibles()
+ # print (child.nom, child.label, child.arbrePossibles)
+ if child.label == "BLOC":
+ self.arbrePossibles = deepcopy(
+ self.remplaceListeParContenuEtVide(
+ self.arbrePossibles, child.arbrePossibles
+ )
+ )
+ elif child.label == "BlocAmbigu":
+ # print ("je passe par la pour", self.nom, child.nom, self.arbrePossibles, child.arbrePossibles)
+ self.arbrePossibles = deepcopy(
+ self.remplaceListeParContenuEtVide(
+ self.arbrePossibles, child.arbrePossibles
+ )
+ )
+ # print ('resultat', self.arbrePossibles)
+ else:
+ self.arbrePossibles = deepcopy(
+ self.adjoint(self.arbrePossibles, child.arbrePossibles)
+ )
+ self.arbrePossibles.append([]) # un bloc n est pas obligatoire
+ # print ('arbre des possibles de ' ,self.nom, self.arbrePossibles)
+
+
+# --------------------------------
+class X_SIMP(X_definition):
+ # --------------------------------
+ def dumpXsd(
+ self, dansFactorisation=False, multiple=False, first=False, debug=False
+ ):
+ # if PourTraduction : print (self.nom)
+ # if self.nom == 'A' : debug = True
+ if debug:
+ print(
+ "X_SIMP dumpXsd pour",
+ self.nom,
+ dansFactorisation,
+ "___________________________",
+ )
+ debug = False
self.prepareDumpXSD()
# si inUnion la comparaison est fausse : on cree le nomDuType
- if multiple : self.inUnion=True
- #print ('exploreObjet SIMP')
+ if multiple:
+ self.inUnion = True
+ # print ('exploreObjet SIMP')
self.getNomDuCodeDumpe()
self.aCreer = True
self.texteComplexe = ""
- self.texteSimple = ""
- self.texteElt = ""
- if self.nom =='Consigne' : return
+ self.texteSimple = ""
+ self.texteElt = ""
+ if self.nom == "Consigne":
+ return
# --> homonymie on peut utiliser genealogie ?
self.nomDuTypeDeBase = self.traduitType()
- if debug : print ('nomDuTypeDeBase', self.nomDuTypeDeBase)
- if debug : print ('multiple', multiple, 'first', first)
- if not multiple :
- self.nomDuTypePyxb = self.definitNomDuTypePyxb()
- else :
- if first :
+ if debug:
+ print("nomDuTypeDeBase", self.nomDuTypeDeBase)
+ if debug:
+ print("multiple", multiple, "first", first)
+ if not multiple:
+ self.nomDuTypePyxb = self.definitNomDuTypePyxb()
+ else:
+ if first:
# on force la creation
- self.nomDuTypePyxb = self.definitNomDuTypePyxb()
+ self.nomDuTypePyxb = self.definitNomDuTypePyxb()
self.aCreer = True
- else :
- self.nomDuTypePyxb='NonDetermine'
-
- if debug : print ('nomDuTypePyxb', self.nomDuTypePyxb)
- if debug : print ('aCreer', self.aCreer)
+ else:
+ self.nomDuTypePyxb = "NonDetermine"
+ # if self.nom == 'A' : debug = False
+ if debug:
+ print("nomDuTypePyxb", self.nomDuTypePyxb)
+ if debug:
+ print("---------------------------- aCreer", self.aCreer)
+ debug = False
# on se sert des listes ou non pour la gestion des minOccurs /maxOccurs est > 0
- if self.statut =='f' : minOccurs = 0
- else : minOccurs = 1
- if dansFactorisation : minOccurs = 1
-
- if self.suisUneMatrice :
- self.dumpSpecifiqueMatrice(minOccurs)
- return
+ if self.statut == "f":
+ minOccurs = 0
+ else:
+ minOccurs = 1
+ if dansFactorisation:
+ minOccurs = 1
+
+ if self.suisUneMatrice:
+ if dansFactorisation:
+ return
+ self.dumpSpecifiqueMatrice(minOccurs)
+ return
- if self.suisUnTuple :
- self.dumpSpecifiqueTuple(minOccurs)
- return
+ if self.suisUnTuple:
+ self.dumpSpecifiqueTuple(minOccurs)
+ return
- if self.avecBlancs and self.max > 1 :
- #print ('je suis avec blanc pour ', self.nom)
- self.dumpSpecifiqueTexteAvecBlancs(minOccurs,multiple)
- return
+ if self.avecBlancs and self.max > 1:
+ self.dumpSpecifiqueTexteAvecBlancs(minOccurs, multiple)
+ return
- #print ('minOccurs',minOccurs)
+ # print ('minOccurs',minOccurs)
# le defaut est dans l elt Name -> tester la coherence d existence avec Accas
# regles Accas
# pas d elt si on est dans multiple
# sauf si on est le '1er' dans un element ambigu
- if not multiple :
- #print ('je passe la pas multiple')
+ if not multiple:
+ if debug:
+ print("je passe la pas multiple")
texteAide = ""
- if self.ang != '' : texteAide = self.ang
- else : texteAide = self.fr
- if self.intoXML and self.into :
- if self.intoXML != self.into :
- #print ('je passe la pour ', self.nom)
- texteAide :texteAide = texteAide+'\nPossible choices for '+ self.nom + 'at this place : \n'+str(self.into)+'\n'
-
- if self.defaut :
- if self.max > 1 or self.max == '**' or self.max == float('inf') :
- txtDefaut=""
- for val in self.defaut : txtDefaut+=str(val) + " "
+ if self.ang != "":
+ texteAide = self.ang
+ else:
+ texteAide = self.fr
+ if self.intoXML and self.into:
+ if self.intoXML != self.into:
+ # print ('je passe la pour ', self.nom)
+ texteAide = (
+ texteAide
+ + "\nPossible choices for "
+ + self.nom
+ + "at this place : \n"
+ + str(self.into)
+ + "\n"
+ )
+
+ if self.defaut:
+ if debug:
+ print("j ai un defaut")
+ if self.max > 1 or self.max == "**" or self.max == float("inf"):
+ txtDefaut = ""
+ for val in self.defaut:
+ txtDefaut += str(val) + " "
# cela ne fonctionne pas tres bien. a revoir
- txtDefaut+=txtDefaut[0:-1]
- if not('TXM' in (self.type)) :
+ txtDefaut = txtDefaut[0:-1]
+ if not ("TXM" in (self.type)):
# a revoir pour les tuples avec defaut
- if texteAide != '' : self.texteElt = eltDsSequenceWithDefautAndHelp.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1,txtDefaut,texteAide)
- else : self.texteElt = eltDsSequenceWithDefaut.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1,txtDefaut)
- else :
- texteAide += texteAide+'\ndefault Value in MDM : \n'+txtDefaut
- self.texteElt = eltDsSequenceWithHelp.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1,texteAide)
- else :
- if str(self.defaut) == 'True' : txtDefaut = 'true'
- elif str(self.defaut) == 'False' : txtDefaut = 'false'
- else : txtDefaut = str(self.defaut)
- if texteAide != '' : self.texteElt = eltDsSequenceWithDefautAndHelp.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1,txtDefaut,texteAide)
- else : self.texteElt = eltDsSequenceWithDefaut.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1,txtDefaut)
- else :
- if texteAide != '' : self.texteElt = eltDsSequenceWithHelp.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1,texteAide)
- else : self.texteElt = eltDsSequence.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1)
+ if texteAide != "":
+ self.texteElt = eltDsSequenceWithDefautAndHelp.format(
+ self.nom,
+ self.code,
+ self.nomDuTypePyxb,
+ minOccurs,
+ 1,
+ txtDefaut,
+ texteAide,
+ )
+ else:
+ self.texteElt = eltDsSequenceWithDefaut.format(
+ self.nom,
+ self.code,
+ self.nomDuTypePyxb,
+ minOccurs,
+ 1,
+ txtDefaut,
+ )
+ else:
+ texteAide += (
+ texteAide + "\ndefault Value in MDM : \n" + txtDefaut
+ )
+ self.texteElt = eltDsSequenceWithHelp.format(
+ self.nom,
+ self.code,
+ self.nomDuTypePyxb,
+ minOccurs,
+ 1,
+ texteAide,
+ )
+ else:
+ if str(self.defaut) == "True":
+ txtDefaut = "true"
+ elif str(self.defaut) == "False":
+ txtDefaut = "false"
+ else:
+ txtDefaut = str(self.defaut)
+ if texteAide != "":
+ self.texteElt = eltDsSequenceWithDefautAndHelp.format(
+ self.nom,
+ self.code,
+ self.nomDuTypePyxb,
+ minOccurs,
+ 1,
+ txtDefaut,
+ texteAide,
+ )
+ else:
+ self.texteElt = eltDsSequenceWithDefaut.format(
+ self.nom,
+ self.code,
+ self.nomDuTypePyxb,
+ minOccurs,
+ 1,
+ txtDefaut,
+ )
+ else:
+ if texteAide != "":
+ self.texteElt = eltDsSequenceWithHelp.format(
+ self.nom, self.code, self.nomDuTypePyxb, minOccurs, 1, texteAide
+ )
+ else:
+ self.texteElt = eltDsSequence.format(
+ self.nom, self.code, self.nomDuTypePyxb, minOccurs, 1
+ )
elif first:
- # l'aide est geree a la fusion
- self.texteElt = eltDsSequence.format(self.nom,self.code,self.nomDuTypePyxb,1,1)
+ # l'aide est geree a la fusion
+ self.texteElt = eltDsSequence.format(
+ self.nom, self.code, self.nomDuTypePyxb, 1, 1
+ )
# self.aCreer est mis a jour ds definitNomDuTypePyxb
# ou si elt est le 1er d une liste identique
- if debug : print ('je suis aCreer', self.aCreer)
- if not self.aCreer : return
+ if debug:
+ print("je suis aCreer", self.aCreer)
+ if not self.aCreer:
+ return
- typeATraduire=self.type[0]
+ typeATraduire = self.type[0]
- self.texteSimplePart1=""
- if not(isinstance(typeATraduire,str)) and not(isinstance(typeATraduire,Accas.Tuple)) and issubclass(typeATraduire, Accas.UserASSD) :
+ self.texteSimplePart1 = ""
+ if (
+ not (isinstance(typeATraduire, str))
+ and not (isinstance(typeATraduire, Accas.Tuple))
+ and issubclass(typeATraduire, Accas.UserASSD)
+ ):
cata = CONTEXT.getCurrentCata()
- if len(self.type) == 2 and self.type[1]=='createObject' : suffixe = 'C'
- else : suffixe = 'U'
- #print (cata.listeUserASSDDumpes)
- #print (typeATraduire.__name__)
- #print (typeATraduire.__name__ in cata.listeUserASSDDumpes)
- if typeATraduire.__name__ not in cata.listeUserASSDDumpes :
+ if len(self.type) == 2 and self.type[1] == "createObject":
+ suffixe = "C"
+ else:
+ suffixe = "U"
+ # print (cata.listeUserASSDDumpes)
+ # print (typeATraduire.__name__)
+ # print (typeATraduire.__name__ in cata.listeUserASSDDumpes)
+ if typeATraduire.__name__ not in cata.listeUserASSDDumpes:
cata.listeUserASSDDumpes.add(typeATraduire.__name__)
- if issubclass(typeATraduire, Accas.UserASSDMultiple) :
- self.texteSimplePart1 = defUserASSDMultiple.format(typeATraduire.__name__)
- if cata.definitUserASSDMultiple == False :
- cata.definitUserASSDMultiple = True
- cata.texteSimple = cata.texteSimple + defBaseXSDUserASSDMultiple
- else :
- self.texteSimplePart1 = defUserASSD.format(typeATraduire.__name__)
- if cata.definitUserASSD == False :
- cata.definitUserASSD = True
- cata.texteSimple = cata.texteSimple + defBaseXSDUserASSD
- if typeATraduire.__name__+'_'+suffixe not in cata.listeUserASSDDumpes :
- cata.texteSimple = cata.texteSimple + defUserASSDOrUserASSDMultiple.format(typeATraduire.__name__, suffixe,typeATraduire.__name__)
- cata.listeUserASSDDumpes.add(typeATraduire.__name__+'_'+suffixe)
-
-
- if not multiple : self.texteSimple += debutSimpleType.format(self.nomDuTypePyxb)
- else : self.texteSimple += debutSimpleTypeSsNom
+ if issubclass(typeATraduire, Accas.UserASSDMultiple):
+ self.texteSimplePart1 = defUserASSDMultiple.format(
+ typeATraduire.__name__
+ )
+ if cata.definitUserASSDMultiple == False:
+ cata.definitUserASSDMultiple = True
+ cata.texteSimple = cata.texteSimple + defBaseXSDUserASSDMultiple
+ else:
+ self.texteSimplePart1 = defUserASSD.format(typeATraduire.__name__)
+ if cata.definitUserASSD == False:
+ cata.definitUserASSD = True
+ cata.texteSimple = cata.texteSimple + defBaseXSDUserASSD
+ if typeATraduire.__name__ + "_" + suffixe not in cata.listeUserASSDDumpes:
+ cata.texteSimple = (
+ cata.texteSimple
+ + defUserASSDOrUserASSDMultiple.format(
+ typeATraduire.__name__, suffixe, typeATraduire.__name__
+ )
+ )
+ cata.listeUserASSDDumpes.add(typeATraduire.__name__ + "_" + suffixe)
+
+ if not multiple:
+ self.texteSimple += debutSimpleType.format(self.nomDuTypePyxb)
+ else:
+ self.texteSimple += debutSimpleTypeSsNom
+ # gestion des elements constants
+ if self.homo == "constant":
+ if type(self.defaut) in ("tuple", "list"):
+ self.intoConstant = self.defaut
+ else:
+ if self.defaut != None:
+ self.intoConstant = [
+ self.defaut,
+ ]
+ else:
+ self.intoConstant = None
+ else:
+ self.intoConstant = None
# On est dans une liste
- if self.max > 1 or self.max == '**' or self.max == float('inf') or hasattr(self.type[0], 'ntuple') :
- self.texteSimple += debutTypeSimpleListe
- self.texteSimple += "\t\t\t\t"+debutRestrictionBase.format(self.nomDuTypeDeBase)
- if self.val_min != float('-inf') : self.texteSimple += "\t\t\t\t"+minInclusiveBorne.format(self.val_min)
- if self.val_max != float('inf') and self.val_max != '**' : self.texteSimple +="\t\t\t\t"+ maxInclusiveBorne.format(self.val_max)
- if self.into != None:
+ if (
+ self.max > 1
+ or self.max == "**"
+ or self.max == float("inf")
+ or hasattr(self.type[0], "ntuple")
+ ):
+ self.texteSimple += debutTypeSimpleListe
+ self.texteSimple += "\t\t\t\t" + debutRestrictionBase.format(
+ self.nomDuTypeDeBase
+ )
+ if self.val_min != float("-inf"):
+ self.texteSimple += "\t\t\t\t" + minInclusiveBorne.format(self.val_min)
+ if self.val_max != float("inf") and self.val_max != "**":
+ self.texteSimple += "\t\t\t\t" + maxInclusiveBorne.format(self.val_max)
+ if self.into != None or self.intoConstant != None:
# PN --> traduction des into
- into=self.into
- if self.intoXML != None : into = self.intoXML
- for val in into : self.texteSimple += "\t\t\t\t"+enumeration.format(val)
- if PourTraduction :
- for val in into : print (str(val))
- self.texteSimple += fermeBalisesMileu
- if self.max !=1 and self.max != '**' and self.max != float('inf') : self.texteSimple += maxLengthTypeSimple.format(self.max)
- if self.min !=1 and self.min != float('-inf') : self.texteSimple += minLengthTypeSimple.format(self.min)
- self.texteSimple += fermeRestrictionBase
- else :
- # ou pas
- self.texteSimple += debutRestrictionBase.format(self.nomDuTypeDeBase)
- if self.val_min != float('-inf') : self.texteSimple += minInclusiveBorne.format(self.val_min)
- if self.val_max != float('inf') and self.val_max != '**' : self.texteSimple += maxInclusiveBorne.format(self.val_max)
- if self.into != None:
- into=self.into
- if self.intoXML != None : into = self.intoXML
- for val in into : self.texteSimple += enumeration.format(val)
- if PourTraduction :
- for val in into : print (str(val))
- self.texteSimple += fermeRestrictionBase
- self.texteSimple += fermeSimpleType
+ into = self.into
+ if self.intoConstant != None:
+ into = self.intoConstant
+ if self.intoXML != None:
+ into = self.intoXML
+ for val in into:
+ self.texteSimple += "\t\t\t\t" + enumeration.format(val)
+ if PourTraduction:
+ for val in into:
+ print(str(val))
+ self.texteSimple += fermeBalisesMileu
+ if self.max != 1 and self.max != "**" and self.max != float("inf"):
+ self.texteSimple += maxLengthTypeSimple.format(self.max)
+ if self.min != 1 and self.min != float("-inf"):
+ self.texteSimple += minLengthTypeSimple.format(self.min)
+ self.texteSimple += fermeRestrictionBase
+ else:
+ # ou pas
+ self.texteSimple += debutRestrictionBase.format(self.nomDuTypeDeBase)
+ if self.val_min != float("-inf"):
+ self.texteSimple += minInclusiveBorne.format(self.val_min)
+ if self.val_max != float("inf") and self.val_max != "**":
+ self.texteSimple += maxInclusiveBorne.format(self.val_max)
+ if self.into != None or self.intoConstant != None:
+ # Pour ModelVariable et ObjectName de UQ
+ # et autre mot clef ou le into est calcule
+ if self.into != [] and type(self.into) != types.FunctionType:
+ into = self.into
+ if self.intoConstant != None:
+ into = self.intoConstant
+ if self.intoXML != None:
+ into = self.intoXML
+ for val in into:
+ self.texteSimple += enumeration.format(val)
+ if PourTraduction:
+ for val in into:
+ print(str(val))
+ self.texteSimple += fermeRestrictionBase
+ self.texteSimple += fermeSimpleType
self.texteSimplePart2 = self.texteSimple
self.texteSimple = self.texteSimplePart1 + self.texteSimplePart2
-
-
- def dumpSpecifiqueTexteAvecBlancs(self,minOccurs,multiple):
+ if self.unite != None:
+ cata = CONTEXT.getCurrentCata()
+ if cata.unitAsAttribute:
+ self.texteSimple = self.texteSimple.replace(
+ self.nomDuTypePyxb, self.nomDuTypePyxb + "_NoUnit"
+ )
+ nouveauTexte = self.texteSimple
+ nouveauTexte += typeAvecAttributUnite.format(
+ self.nomDuTypePyxb,
+ self.code,
+ self.nomDuTypePyxb,
+ self.nomDuTypePyxb,
+ self.unite,
+ )
+ self.texteSimple = nouveauTexte
+ if debug:
+ print(self.texteSimple)
+
+ def dumpSpecifiqueTexteAvecBlancs(self, minOccurs, multiple):
# attention multiple non traite
# pour l instant on n a pas max =1 et on ne traite pas les into
texteAide = ""
- if self.ang != '' : texteAide = self.ang
- elif self.fr != '' : texteAide = self.fr
-
- self.texteElt = eltDsSequenceWithHelp.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1,texteAide)
- txtDefaut=""
+ if self.ang != "":
+ texteAide = self.ang
+ elif self.fr != "":
+ texteAide = self.fr
+
+ self.texteElt = eltDsSequenceWithHelp.format(
+ self.nom, self.code, self.nomDuTypePyxb, minOccurs, 1, texteAide
+ )
+ txtDefaut = ""
# Pas de Defaut pour les string en XSD
# max sert pour la taille de la liste
- if self.defaut : texteAide += ' Valeur par defaut dans le comm : '+str(self.defaut)
- if texteAide != '' : self.texteElt = eltDsSequenceWithHelp.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1,texteAide)
- else : self.texteElt = eltDsSequence.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1)
-
-
- if self.max == '**' or self.max == float('inf') : max='unbounded'
- else : max = self.max
-
- if self.max > 1 : # juste au cas ou on traite 1 pareil
- self.texteSimple = ''
+ if self.defaut:
+ texteAide += " Valeur par defaut dans le comm : " + str(self.defaut)
+ if texteAide != "":
+ self.texteElt = eltDsSequenceWithHelp.format(
+ self.nom, self.code, self.nomDuTypePyxb, minOccurs, 1, texteAide
+ )
+ else:
+ self.texteElt = eltDsSequence.format(
+ self.nom, self.code, self.nomDuTypePyxb, minOccurs, 1
+ )
+
+ if self.max == "**" or self.max == float("inf"):
+ max = "unbounded"
+ else:
+ max = self.max
+
+ if self.max > 1: # juste au cas ou on traite 1 pareil
+ self.texteSimple = ""
cata = CONTEXT.getCurrentCata()
- if self.nomDuTypePyxb in cata.listeTypeTXMAvecBlancs: return
+ if self.nomDuTypePyxb in cata.listeTypeTXMAvecBlancs:
+ return
cata.listeTypeTXMAvecBlancs.add(self.nomDuTypePyxb)
- self.texteSimple = complexChaineAvecBlancs.format(self.nomDuTypePyxb,max,self.nomDuTypePyxb)
- if self.intoXML != None : into = self.intoXML
- else : into = self.into
- if into == None :
- self.texteSimple += typeEltChaineAvecBlancSansInto.format(self.nomDuTypePyxb)
- else :
- self.texteSimple += debutChaineAvecBlancsInto.format(self.nomDuTypePyxb)
- for val in into : self.texteSimple += milieuChaineAvecBlancsInto.format(val)
- self.texteSimple += finChaineAvecBlancsInto
-
-
- def dumpSpecifiqueTuple(self,minOccurs):
+ self.texteSimple = complexChaineAvecBlancs.format(
+ self.nomDuTypePyxb, max, self.nomDuTypePyxb
+ )
+ if self.intoXML != None:
+ into = self.intoXML
+ else:
+ into = self.into
+ if into == None:
+ self.texteSimple += typeEltChaineAvecBlancSansInto.format(
+ self.nomDuTypePyxb
+ )
+ else:
+ self.texteSimple += debutChaineAvecBlancsInto.format(self.nomDuTypePyxb)
+ for val in into:
+ self.texteSimple += milieuChaineAvecBlancsInto.format(val)
+ self.texteSimple += finChaineAvecBlancsInto
+
+ def dumpSpecifiqueTuple(self, minOccurs):
self.nomDuTypeDeBase = self.traduitType()
- tousPareil=True
+ tousPareil = True
# il faut gerer l aide et les defaut
- if self.defaut : print ('il faut tester le defaut')
- if self.max == '**' or self.max == float('inf') : max='unbounded'
- else : max = self.max
- self.texteElt = tupleNonHomogeneElt.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,max)
- leType=self.nomDuTypeDeBase[0]
- for leTypeComp in self.nomDuTypeDeBase[1:] :
- if leTypeComp != leType :
+ if self.defaut:
+ print("il faut tester le defaut")
+ if self.max == "**" or self.max == float("inf"):
+ max = "unbounded"
+ else:
+ max = self.max
+ self.texteElt = tupleNonHomogeneElt.format(
+ self.nom, self.code, self.nomDuTypePyxb, minOccurs, max
+ )
+ leType = self.nomDuTypeDeBase[0]
+ for leTypeComp in self.nomDuTypeDeBase[1:]:
+ if leTypeComp != leType:
tousPareil = False
- break;
- #if tousPareil :
- #PN PN a statuer
+ break
+ # if tousPareil :
+ # PN PN a statuer
# self.texteSimple += debutSimpleType.format(self.nomDuTypePyxb)
# self.texteSimple += debutTypeSimpleListe
# self.texteSimple += "\t\t\t\t"+debutRestrictionBase.format(leType)
# into=self.into
# if self.intoXML != None : into = self.intoXML
# for val in into : self.texteSimple += "\t\t\t\t"+enumeration.format(val)
- # if PourTraduction :
+ # if PourTraduction :
# for val in into : print (str(val))
# self.texteSimple += fermeBalisesMileu
# if self.max !=1 and self.max != '**' and self.max != float('inf') : self.texteSimple += maxLengthTypeSimple.format(self.max)
# self.texteSimple += fermeSimpleType
# return
- self.texteSimple = ''
+ if self.min == 0:
+ sequenceVide = True
+ else:
+ sequenceVide = False
+ self.texteSimple = ""
complexeTypeTuple = tupleDebutComplexeType.format(self.nomDuTypePyxb)
num = 1
- for leType in self.nomDuTypeDeBase :
- self.texteSimple += tupleNonHomogeneSimpleType.format(self.nomDuTypePyxb,str(num),leType)
- complexeTypeTuple += tupleMilieuComplexeType.format(str(num),self.nomDuTypePyxb,str(num))
+ for leType in self.nomDuTypeDeBase:
+ self.texteSimple += tupleNonHomogeneSimpleType.format(
+ self.nomDuTypePyxb, str(num), leType
+ )
+ complexeTypeTuple += tupleMilieuComplexeType.format(
+ str(num), self.nomDuTypePyxb, str(num)
+ )
num = num + 1
complexeTypeTuple += tupleFinComplexeType
- self.texteSimple += complexeTypeTuple
-
+ self.texteSimple += complexeTypeTuple
- def dumpSpecifiqueMatrice(self,minOccurs):
- # if faut traiter le defaut
- typeDeMatrice =self.type[0]
+ def dumpSpecifiqueMatrice(self, minOccurs):
+ # ajouter le AccasAssd
+ # if faut traiter le defaut
+ typeDeMatrice = self.type[0]
- self.texteSimple += debutSimpleType.format(self.nomDuTypePyxb+'_element')
- self.texteSimple += debutRestrictionBase.format(self.nomDuTypeDeBase)
+ self.texteSimple += debutSimpleType.format(self.nomDuTypePyxb + "_element")
+ self.texteSimple += debutRestrictionBase.format(self.nomDuTypeDeBase)
if typeDeMatrice.typEltInto != None:
- for val in typeDeMatrice.typEltInto : self.texteSimple += enumeration.format(val)
- self.texteSimple += fermeRestrictionBase
+ for val in typeDeMatrice.typEltInto:
+ self.texteSimple += enumeration.format(val)
+ self.texteSimple += fermeRestrictionBase
self.texteSimple += fermeSimpleType
- nom=self.nomDuTypePyxb
- nbCols=typeDeMatrice.nbCols
- nbLigs=typeDeMatrice.nbCols
- self.texteSimple += matriceSimpleType.format(nom,nom,nbCols,nom,self.code,nom,nbLigs,nbLigs,nom,self.code,nom,self.min,self.max)
- self.texteElt = eltMatrice.format(self.nom,self.code,self.nomDuTypePyxb,minOccurs,1)
+ nom = self.nomDuTypePyxb
+ nbCols = typeDeMatrice.nbCols
+ nbLigs = typeDeMatrice.nbCols
+ self.texteSimple += matriceSimpleType.format(
+ nom,
+ nom,
+ nbCols,
+ nbCols,
+ nom,
+ self.code,
+ nom,
+ nbLigs,
+ nbLigs,
+ nom,
+ self.code,
+ nom,
+ self.min,
+ self.max,
+ )
+ self.texteElt = eltMatrice.format(
+ self.nom, self.code, self.nomDuTypePyxb, minOccurs, 1
+ )
-
def prepareDumpXSD(self):
- self.inUnion=False
- if self.statut == 'f' : self.arbrePossibles = (self.nom,[])
- else : self.arbrePossibles = (self.nom,)
- self.mcXSD=[]
-
-
+ self.inUnion = False
+ if self.statut == "f":
+ self.arbrePossibles = (self.nom, [])
+ else:
+ self.arbrePossibles = (self.nom,)
+ self.mcXSD = []
- def traduitType(self,debug=False):
+ def traduitType(self, debug=False):
# il faut traduire le min et le max
# il faut ajouter les regles
# il faut gerer les types tuple et fichier
# on ne paut pas tester le type qui depend du cataloge
- if hasattr(self.type[0], 'typElt') :
- #print ('je suis une Matrice de ' ,dictNomsDesTypes[self.type[0].typElt])
+ if hasattr(self.type[0], "typElt"):
+ if debug:
+ print(self.nom, "est une matrice")
self.suisUneMatrice = True
- # on presume que le type de l elt est un ASSD
- if self.type[0].typElt not in dictNomsDesTypes.keys(): return 'xs:string'
- return dictNomsDesTypes[self.type[0].typElt]
- else :
+ # on presume que le type de l elt est un ASSD si il n est pas un type connu
+ if self.type[0].typElt not in dictNomsDesTypes.keys():
+ return "AccasAssd"
+ return dictNomsDesTypes[self.type[0].typElt]
+ else:
self.suisUneMatrice = False
- if hasattr(self.type[0], 'ntuple') :
+ if hasattr(self.type[0], "ntuple"):
+ if debug:
+ print(self.nom, "est un tuple")
self.suisUnTuple = True
# Pour l instant pas de into dans les tuples non homogenes et pas de reference
# sinon, il faudra faire un for sur la suite avec les createObjet
- leType=self.validators.typeDesTuples[0]
- enRetour=[]
+ leType = self.validators.typeDesTuples[0]
+ enRetour = []
for i in range(self.type[0].ntuple):
- enRetour.append(dictNomsDesTypes[self.validators.typeDesTuples[i]])
+ # Attention, si plusieurs validators on a des soucis
+ # a Reprendre
+ typeATraduire = self.validators.typeDesTuples[i]
+ if not (typeATraduire in list(dictNomsDesTypes.keys())):
+ enRetour.append("AccasAssd")
+ else:
+ enRetour.append(dictNomsDesTypes[self.validators.typeDesTuples[i]])
return enRetour
- #typeATraduire=leType
- else :
+ # typeATraduire=leType
+ else:
self.suisUnTuple = False
- typeATraduire=self.type[0]
- if not (typeATraduire in list(dictNomsDesTypes.keys())) :
- #if (isinstance(typeATraduire, Accas.ASSD) or issubclass(typeATraduire, Accas.ASSD)) :
- if (not(isinstance(typeATraduire,str)) and issubclass(typeATraduire, Accas.ASSD)) :
- # cas d une creation
+ typeATraduire = self.type[0]
+ # Pour les types non encore implementes en Accas comme date
+ if hasattr(self, "typeXSD"):
+ return self.typeXSD
+ if not (typeATraduire in list(dictNomsDesTypes.keys())):
+ # if (isinstance(typeATraduire, Accas.ASSD) or issubclass(typeATraduire, Accas.ASSD)) :
+ if debug:
+ print(self.nom, "n est pas un type de base")
+ if not (isinstance(typeATraduire, str)) and issubclass(
+ typeATraduire, Accas.ASSD
+ ):
+ if debug:
+ print(self.nom, "est d un type sous classe de ASSD")
+ # cas d une creation
cata = CONTEXT.getCurrentCata()
# PNPNPN a Revoir pour la creation des keyrefs
- if len(self.type) == 2 and self.type[1]=='createObject' :
- if typeATraduire.__name__ not in list(cata.dictTypesASSDorUserASSDCrees) :
- cata.dictTypesASSDorUserASSDCrees[typeATraduire.__name__]=[self,]
- else :
- cata.dictTypesASSDorUserASSDCrees[typeATraduire.__name__].append(self)
- if issubclass(typeATraduire, Accas.UserASSD) : return typeATraduire.__name__+'_C'
- else : return 'xs:string'
+ if len(self.type) == 2 and self.type[1] == "createObject":
+ if typeATraduire.__name__ not in list(
+ cata.dictTypesASSDorUserASSDCrees
+ ):
+ cata.dictTypesASSDorUserASSDCrees[typeATraduire.__name__] = [
+ self,
+ ]
+ else:
+ cata.dictTypesASSDorUserASSDCrees[
+ typeATraduire.__name__
+ ].append(self)
+ if issubclass(typeATraduire, Accas.UserASSD):
+ return typeATraduire.__name__ + "_C"
+ if issubclass(typeATraduire, Accas.ASSD):
+ return "AccasAssd"
+ else:
+ return "xs:string"
# cas d une consommation
- if typeATraduire not in list(cata.dictTypesASSDorUserASSDUtilises) :
- cata.dictTypesASSDorUserASSDUtilises[typeATraduire]=[self,]
- else :
- cata.dictTypesASSDorUserASSDUtilises[typeATraduire].append(self,)
- if issubclass(typeATraduire, Accas.UserASSD) : return typeATraduire.__name__+'_U'
- else : return 'xs:string'
- else : return ('YYYYY')
+ if typeATraduire not in list(cata.dictTypesASSDorUserASSDUtilises):
+ cata.dictTypesASSDorUserASSDUtilises[typeATraduire] = [
+ self,
+ ]
+ else:
+ cata.dictTypesASSDorUserASSDUtilises[typeATraduire].append(
+ self,
+ )
+ if issubclass(typeATraduire, Accas.UserASSD):
+ return typeATraduire.__name__ + "_U"
+ if issubclass(typeATraduire, Accas.ASSD):
+ return "AccasAssd"
+ else:
+ return "xs:string"
+ else:
+ return "YYYYY"
return dictNomsDesTypes[typeATraduire]
def traduitValMinValMax(self):
- self.maxInclusive=self.val_max
- self.minInclusive=self.val_min
- if self.val_min == float('-inf') and val_max== float('inf') : return
- #print ('il faut affiner le type du SIMP ', self.nom)
- if self.val_max == '**' or self.val_max == float('inf') : self.maxInclusive=None
- else : self.maxInclusive = self.val_max
- if self.val_min == '**' or self.val_max == float('-inf') : self.maxInclusive=None
- else : self.minInclusive = self.val_min
+ self.maxInclusive = self.val_max
+ self.minInclusive = self.val_min
+ if self.val_min == float("-inf") and val_max == float("inf"):
+ return
+ # print ('il faut affiner le type du SIMP ', self.nom)
+ if self.val_max == "**" or self.val_max == float("inf"):
+ self.maxInclusive = None
+ else:
+ self.maxInclusive = self.val_max
+ if self.val_min == "**" or self.val_max == float("-inf"):
+ self.maxInclusive = None
+ else:
+ self.minInclusive = self.val_min
def traduitMinMax(self):
- if self.min == 1 and self.max == 1 : return
- #print ('il faut creer une liste ' , self.nom)
-
- def compare(self,autreMC):
- if self.label != autreMC.label : return False
- if self.inUnion == True or autreMC.inUnion == True : return False
- if hasattr(self,'nomXML') and hasattr(autreMC,'nomXML') and self.nomXML==autreMC.nomXML and self.nomXML != None : return True
- listeAComparer = [ 'type', 'defaut', 'min' ,'max' ,'val_min' , 'val_max' ]
- if self.intoXML != None : listeAComparer.append('intoXML')
- else : listeAComparer.append('into')
- if (hasattr (self, 'nomXML')) and self.nomXML != None : nomUtil=self.nomXML
- for attr in listeAComparer :
- val1=getattr(self,attr)
- val2=getattr(autreMC,attr)
- if val1 != val2 : return False
+ if self.min == 1 and self.max == 1:
+ return
+ # print ('il faut creer une liste ' , self.nom)
+
+ def compare(self, autreMC):
+ if self.label != autreMC.label:
+ return False
+ if self.inUnion == True or autreMC.inUnion == True:
+ return False
+ if (
+ hasattr(self, "nomXML")
+ and hasattr(autreMC, "nomXML")
+ and self.nomXML == autreMC.nomXML
+ and self.nomXML != None
+ ):
+ return True
+ listeAComparer = ["type", "defaut", "min", "max", "val_min", "val_max"]
+ if self.intoXML != None:
+ listeAComparer.append("intoXML")
+ else:
+ listeAComparer.append("into")
+ if (hasattr(self, "nomXML")) and self.nomXML != None:
+ nomUtil = self.nomXML
+ for attr in listeAComparer:
+ val1 = getattr(self, attr)
+ val2 = getattr(autreMC, attr)
+ if val1 != val2:
+ return False
return True
def construitArbrePossibles(self):
- if self.statut == 'f' :
- self.arbrePossibles = (self.nom,[])
- else :
+ if self.statut == "f":
+ self.arbrePossibles = (self.nom, [])
+ else:
self.arbrePossibles = (self.nom,)
- #print ('SIMP arbre des possibles de ' ,self.nom, self.arbrePossibles)
+ # print ('SIMP arbre des possibles de ' ,self.nom, self.arbrePossibles)
-#-----------------
-class X_JDC_CATA :
-#-----------------
+# -----------------
+class X_JDC_CATA:
+ # -----------------
- def dumpXsd(self, avecEltAbstrait, debug = True):
+ def dumpXsd(self, avecEltAbstrait, avecSubstitution=True, debug=False):
cata = CONTEXT.getCurrentCata()
- if debug : print ('avecEltAbstrait -------------------', avecEltAbstrait)
-
- if debug : print ('self.importedBy -------------------', self.importedBy)
- if debug : print ('self.code -------------------', self.code)
-
- self.texteSimple = ""
+ # cata.unitAsAttribute = unitAsAttribute
+ cata.unitAsAttribute = True
+ if debug:
+ print("avecEltAbstrait -------------------", avecEltAbstrait)
+ if debug:
+ print("self.importedBy -------------------", self.importedBy)
+ if debug:
+ print("self.code -------------------", self.code)
+
+ self.texteSimple = ""
self.texteComplexe = ""
- self.texteCata = ""
- self.texteDeclaration = ""
- self.texteInclusion = ""
- self.texteElt = ""
+ self.texteCata = ""
+ self.texteDeclaration = ""
+ self.texteInclusion = ""
+ self.texteElt = ""
self.texteTypeAbstrait = ""
- if self.implement == "" :
+ if self.implement == "":
self.nomDuCodeDumpe = self.code
- self.implement = self.code
- self.nomDuXsdPere = self.code
- else :
- self.implement,self.nomDuXsdPere=self.implement.split(':')
+ self.implement = self.code
+ self.nomDuXsdPere = self.code
+ else:
+ self.implement, self.nomDuXsdPere = self.implement.split(":")
self.nomDuCodeDumpe = self.implement
- if debug : print ('self.implement -------------------', self.implement)
- if debug : print ('self.nomDuCodeDumpe -------------------', self.nomDuCodeDumpe)
- if debug : print ('self.nomDuXsdPere -------------------', self.nomDuXsdPere)
-
- self.nomDuTypePyxb = 'T_'+self.nomDuCodeDumpe
- self.dumpLesCommandes()
-
- if self.implement == self.code :
- self.texteCata += eltAbstraitCataPPal.format(self.code)
- if 0 : pass
- else : self.texteCata += eltCataPPal.format(self.code,self.code,self.code)
- else :
- self.texteCata += eltAbstraitCataFils.format(self.implement,self.nomDuXsdPere,self.nomDuXsdPere)
- if 0 : pass
- else : self.texteCata += eltCataFils.format(self.implement,self.nomDuXsdPere,self.nomDuXsdPere,self.nomDuXsdPere)
- self.texteInclusion += includeCata.format(self.nomDuXsdPere)
-
-
- self.texteCata += eltCata.format(self.implement,self.implement,self.implement,self.implement,self.nomDuXsdPere)
- #if self.implement == self.code :
- # self.texteCata += debutTypeCata.format(self.nomDuCodeDumpe)
- #else :
- # self.texteCata += debutTypeCataExtension.format(self.nomDuCodeDumpe)
- # self.texteCata += debutExtension.format(self.code,self.nomDuCodeDumpe)
- # self.texteInclusion += includeCata.format(self.nomDuXsdPere)
-
-
-
- #for codeHeritant in self.importedBy:
- # self.texteCata += eltCodeSpecDsCata.format(codeHeritant)
- # self.texteTypeAbstrait += eltAbstrait.format(codeHeritant,codeHeritant,self.code,codeHeritant)
-
- #if self.implement != "" : self.texteCata = self.texteCata + finExtension + finTypeCompo
- #else : self.texteCata += finTypeCata
-
- #if self.implement != "" :
- # self.texteElt=implementeAbstrait.format(self.nomDuCodeDumpe,self.code,self.nomDuTypePyxb,self.code,self.nomDuCodeDumpe)
- #else :
- # self.texteElt = eltCata.format(self.nomDuCodeDumpe,self.code, self.nomDuTypePyxb)
-
- if self.implement == self.code :
- self.texteXSD = texteDebut.format(self.code,self.code,self.code,self.code,self.code,self.code)
- elif self.nomDuXsdPere == self.code :
- self.texteXSD = texteDebutNiveau2.format(self.code,self.implement,self.code,self.code,self.code, self.code,self.code,self.code,self.code,self.code)
- else :
- self.texteXSD = texteDebutNiveau3.format(self.code,self.implement,self.code,self.nomDuXsdPere,self.code,self.code,self.code, self.code,self.code,self.code,self.code,self.code)
-
- if self.texteInclusion != "" : self.texteXSD += self.texteInclusion
+ if debug:
+ print("self.implement -------------------", self.implement)
+ if debug:
+ print("self.nomDuCodeDumpe -------------------", self.nomDuCodeDumpe)
+ if debug:
+ print("self.nomDuXsdPere -------------------", self.nomDuXsdPere)
+
+ self.nomDuTypePyxb = "T_" + self.nomDuCodeDumpe
+ if hasattr(self.cata, "dElementsRecursifs"):
+ self.listeElementsRecursifs = list(self.cata.dElementsRecursifs.keys())
+ else:
+ self.listeElementsRecursifs = ()
+
+ if avecEltAbstrait:
+ self.dumpAvecEltAbstraitDesCommandes()
+ else:
+ self.dumpSimpleDesCommandes()
+
+ if avecEltAbstrait:
+ if self.implement == self.code:
+ self.texteCata += eltAbstraitCataPPal.format(self.code)
+ self.texteCata += eltCataPPal.format(self.code, self.code, self.code)
+ else:
+ self.texteCata += eltAbstraitCataFils.format(
+ self.implement, self.nomDuXsdPere, self.nomDuXsdPere
+ )
+ self.texteCata += eltCataFils.format(
+ self.implement,
+ self.nomDuXsdPere,
+ self.nomDuXsdPere,
+ self.nomDuXsdPere,
+ )
+ self.texteInclusion += includeCata.format(self.nomDuXsdPere)
+
+ self.texteCata += eltCata.format(
+ self.implement,
+ self.implement,
+ self.implement,
+ self.implement,
+ self.nomDuXsdPere,
+ )
+ if self.implement == self.code:
+ self.texteXSD = texteDebut.format(
+ self.code, self.code, self.code, self.code, self.code, self.code
+ )
+ elif self.nomDuXsdPere == self.code:
+ self.texteXSD = texteDebutNiveau2.format(
+ self.code,
+ self.implement,
+ self.code,
+ self.code,
+ self.code,
+ self.code,
+ self.code,
+ self.code,
+ self.code,
+ self.code,
+ )
+ else:
+ self.texteXSD = texteDebutNiveau3.format(
+ self.code,
+ self.implement,
+ self.code,
+ self.nomDuXsdPere,
+ self.code,
+ self.code,
+ self.code,
+ self.code,
+ self.code,
+ self.code,
+ self.code,
+ self.code,
+ )
+
+ if self.texteInclusion != "":
+ self.texteXSD += self.texteInclusion
+
+ else:
+ self.texteXSD = texteDebut.format(
+ self.code, self.code, self.code, self.code, self.code, self.code
+ )
+
+ self.texteXSD += defBaseXSDASSD
self.texteXSD += self.texteSimple
self.texteXSD += self.texteComplexe
- #if self.texteTypeAbstrait != "" : self.texteXSD += self.texteTypeAbstrait
+ # if self.texteTypeAbstrait != "" : self.texteXSD += self.texteTypeAbstrait
self.texteXSD += self.texteCata
- #self.texteXSD += self.texteElt
- toutesLesKeys=set()
+ toutesLesKeys = set()
texteKeyRef = ""
# Pour le nom des key_ref en creation : le type ( une seule key-ref par type. facile a retrouver)
for clef in self.dictTypesASSDorUserASSDCrees:
- existeASSD=0
- texteDesFields=""
+ existeASSD = 0
+ texteDesFields = ""
for unOper in self.dictTypesASSDorUserASSDCrees[clef]:
- if not(isinstance(unOper, Accas.OPER)) : continue
- existeASSD=1
- texteDesFields+=texteFieldUnitaire.format(self.code, unOper.nom)
- if existeASSD : texteDesFields=texteDesFields[0:-2]
- texteDesUserASSD=''
- existeunUserASSD=0
+ if not (isinstance(unOper, Accas.OPER)):
+ continue
+ existeASSD = 1
+ texteDesFields += texteFieldUnitaire.format(self.code, unOper.nom)
+ if existeASSD:
+ texteDesFields = texteDesFields[0:-2]
+ texteDesUserASSD = ""
+ existeunUserASSD = 0
for unSimp in self.dictTypesASSDorUserASSDCrees[clef]:
- if not (isinstance(unSimp, Accas.SIMP)) : continue
+ if not (isinstance(unSimp, Accas.SIMP)):
+ continue
texteDesUserASSD += unSimp.getXPathSansSelf() + " | "
- #print (unSimp.getXPathSansSelf())
- #texteFieldUnitaire='/'+self.code+":"+unSimp.nom
- existeunUserASSD=1
+ # print (unSimp.getXPathSansSelf())
+ # texteFieldUnitaire='/'+self.code+":"+unSimp.nom
+ existeunUserASSD = 1
if existeunUserASSD:
- if existeASSD : texteDesFields = texteDesFields + texteDesUserASSD[0:-2] +"/>\n\t\t"
- else: texteDesFields = texteDesUserASSD[0:-2]
- #print (texteDesUserASSD)
- #print (texteDesFields)
- if texteDesFields != "" :
- texteKeyRef += producingASSDkeyRefDeclaration.format( clef ,texteDesFields)
-
+ if existeASSD:
+ texteDesFields = (
+ texteDesFields + texteDesUserASSD[0:-2] + "/>\n\t\t"
+ )
+ else:
+ texteDesFields = texteDesUserASSD[0:-2]
+ # print (texteDesUserASSD)
+ # print (texteDesFields)
+ if texteDesFields != "":
+ texteKeyRef += producingASSDkeyRefDeclaration.format(
+ clef, texteDesFields
+ )
# Pour le nom des key-ref en utilisation : la genealogie complete ( une key-ref par utilisation et on retrouve facilement la )
for clef in self.dictTypesASSDorUserASSDUtilises:
for unSimp in self.dictTypesASSDorUserASSDUtilises[clef]:
# il faut la genealogie
- texteKeyRef += UsingASSDkeyRefDeclaration.format(unSimp.getNomCompletAvecBloc(), unSimp.type[0].__name__,self.code, unSimp.type[0].__name__,unSimp.getXPathComplet() )
-
- #PNPN on debranche les keyref le temps de bien reflechir a leur forme
- #if texteKeyRef != '' :
+ texteKeyRef += UsingASSDkeyRefDeclaration.format(
+ unSimp.getNomCompletAvecBloc(),
+ unSimp.type[0].__name__,
+ self.code,
+ unSimp.type[0].__name__,
+ unSimp.getXPathComplet(),
+ )
+
+ # PNPN on debranche les keyref le temps de bien reflechir a leur forme
+ # if texteKeyRef != '' :
# self.texteXSD = self.texteXSD[0:-3]+'>\n'
# self.texteXSD += texteKeyRef
# self.texteXSD += fermeEltCata
-
-
- #if not PourTraduction : print (self.texteXSD)
-
- import pprint
- #pprint.pprint (cata.dictTypesXSDJumeaux)
- #for k in cata.dictTypesXSDJumeaux:
- # print (k.nom, k.nomComplet())
- # print (cata.dictTypesXSDJumeaux[k][0].nom, cata.dictTypesXSDJumeaux[k][0].nomComplet())
-
- #pprint.pprint (cata.dictTypesXSD)
- #for k in cata.dictTypesXSD:
- # print (k)
- # print (cata.dictTypesXSD)
+ # if not PourTraduction : print (self.texteXSD)
dico = {}
- for k in list(cata.dictTypesXSD.keys()):
- dico[k]={}
- different=False
- for definition in cata.dictTypesXSD[k] :
- if definition.label == 'BLOC' or definition.label == 'BlocAmbigu':continue
- if definition.nomDuTypePyxb != 'T_'+definition.nom : different=True
- listeATraiter=[definition.geneaCompleteSousFormeDeListe(),]
- while listeATraiter != [] :
- listeGenea=listeATraiter[0]
- listeATraiter=listeATraiter[1:]
- txtNomComplet=''
- indexMC=0
+ # debug = True
+ for k in list(cata.dictTypesXSD.keys()):
+ if debug:
+ print("cata.dictTypesXSD traitement de ", k)
+ dico[k] = {}
+ different = False
+ for definition in cata.dictTypesXSD[k]:
+ if definition.label == "BLOC" or definition.label == "BlocAmbigu":
+ continue
+ if definition.nomDuTypePyxb != "T_" + definition.nom:
+ different = True
+ if debug:
+ print("definition.nomDuTypePyxb", definition.nomDuTypePyxb)
+ listeATraiter = [
+ definition.geneaCompleteSousFormeDeListe(),
+ ]
+ # print (listeATraiter)
+ while listeATraiter != []:
+ listeGenea = listeATraiter[0]
+ listeATraiter = listeATraiter[1:]
+ txtNomComplet = ""
+ indexMC = 0
for MC in listeGenea:
- txtNomComplet=txtNomComplet+'_'+MC.nom
- if MC in list(cata.dictTypesXSDJumeaux.keys()) :
+ # attention en cas de MC Recursif on a une boucle infinie avec le append
+ if MC.nom in self.listeElementsRecursifs:
+ continue
+ txtNomComplet = txtNomComplet + "_" + MC.nom
+ if MC in list(cata.dictTypesXSDJumeaux.keys()):
for MCJumeau in cata.dictTypesXSDJumeaux[MC]:
# attention nvlleGenalogie n a pas de sens en Accas
- nvlleGenalogie=listeGenea[:indexMC]+MCJumeau.geneaCompleteSousFormeDeListe()
+ nvlleGenalogie = (
+ listeGenea[:indexMC]
+ + MCJumeau.geneaCompleteSousFormeDeListe()
+ )
listeATraiter.append(nvlleGenalogie)
- indexMC=indexMC+1
- dico[k][txtNomComplet]=definition.nomDuTypePyxb
- if dico[k]== {} or (not different) : del dico[k]
+ indexMC = indexMC + 1
+ dico[k][txtNomComplet] = definition.nomDuTypePyxb
+ if dico[k] == {} or (not different):
+ del dico[k]
import pprint
- #pprint.pprint(dico)
+
+ # pprint.pprint(dico)
# PN reflechir a ce *** de nom
- #if dico != {} : self.texteXSD += texteAnnotation.format(self.nomDuCodeDumpe,str(dico))
- if dico != {} : self.texteXSD += texteAnnotation.format(str(dico))
-
- #import pprint
- #if (not PourTraduction) and (dico != {}) : pprint.pprint(dico)
- print ('__________________________ decommenter pour le texteXSD________________________')
- #print (dico)
- #print (self.texteXSD)
+ # if dico != {} : self.texteXSD += texteAnnotation.format(self.nomDuCodeDumpe,str(dico))
+ if dico != {}:
+ self.texteXSD += texteAnnotation.format(str(dico))
+
+ # import pprint
+ # if (not PourTraduction) and (dico != {}) : pprint.pprint(dico)
+ # print ('__________________________ decommenter pour le texteXSD________________________')
+ # print (dico)
+ # print (self.texteXSD)
self.texteXSD += texteFin
return self.texteXSD
-
- def dumpLesCommandes(self):
+ def dumpAvecEltAbstraitDesCommandes(self):
cata = CONTEXT.getCurrentCata()
- fichierCataSourceExt=os.path.basename(cata.cata.__file__)
- fichierCataSource, extension=os.path.splitext(fichierCataSourceExt)
- importCataSource=__import__(fichierCataSource,{},{})
+ fichierCataSourceExt = os.path.basename(cata.cata.__file__)
+ fichierCataSource, extension = os.path.splitext(fichierCataSourceExt)
+ importCataSource = __import__(fichierCataSource, {}, {})
- texte=""
+ texte = ""
for m in sys.modules:
- monModule=sys.modules[m]
- try :
- if m in ('os', 'sys', 'inspect', 'six', 'pickle', 'codecs') : continue
- if m in ('cPickle', 'pprint', 'dis', '_sre', 'encodings.aliases'): continue
- if m in ('numbers', 'optparse', 'binascii', 'posixpath') : continue
- if m in ('_locale', '_sysconfigdata_nd', 'gc', 'functools') : continue
- if m in ('posixpath', 'types', 'posix', 'prefs') : continue
- if m in ('warnings', 'types', 'posix', 'prefs') : continue
- if monModule.__name__[0:15] == '_sysconfigdata_' : continue
- if monModule.__name__ == '__future__' : continue
- if monModule.__name__[0:3] == 'Ihm' : continue
- if monModule.__name__[0:5] == 'numpy' : continue
- if monModule.__name__[0:5] == 'Noyau' : continue
- if monModule.__name__[0:5] == 'Accas' : continue
- if monModule.__name__[0:7] == 'convert' : continue
- if monModule.__name__[0:7] == 'Efi2Xsd' : continue
- if monModule.__name__[0:7] == 'Editeur' : continue
- if monModule.__name__[0:9] == 'generator' : continue
- if monModule.__name__[0:10] == 'Validation' : continue
- if monModule.__name__[0:10] == 'Extensions' : continue
- if monModule.__name__[0:12] == 'InterfaceQT4' : continue
- if monModule.__name__ == fichierCataSource : continue
- texte= texte + "try : import "+ monModule.__name__ + " \n"
- texte= texte + "except : pass \n"
- texte= texte + "try : from "+ monModule.__name__ + ' import * \n'
- texte= texte + "except : pass \n"
- except :
+ monModule = sys.modules[m]
+ try:
+ if m in ("os", "sys", "inspect", "six", "pickle", "codecs"):
+ continue
+ if m in ("cPickle", "pprint", "dis", "_sre", "encodings.aliases"):
+ continue
+ if m in ("numbers", "optparse", "binascii", "posixpath"):
+ continue
+ if m in ("_locale", "_sysconfigdata_nd", "gc", "functools"):
+ continue
+ if m in ("posixpath", "types", "posix", "prefs"):
+ continue
+ if m in ("warnings", "types", "posix", "prefs"):
+ continue
+ if monModule.__name__[0:15] == "_sysconfigdata_":
+ continue
+ if monModule.__name__ == "__future__":
+ continue
+ if monModule.__name__[0:3] == "Ihm":
+ continue
+ if monModule.__name__[0:5] == "numpy":
+ continue
+ if monModule.__name__[0:5] == "Noyau":
+ continue
+ if monModule.__name__[0:5] == "Accas":
+ continue
+ if monModule.__name__[0:7] == "convert":
+ continue
+ if monModule.__name__[0:7] == "Efi2Xsd":
+ continue
+ if monModule.__name__[0:7] == "Editeur":
+ continue
+ if monModule.__name__[0:9] == "generator":
+ continue
+ if monModule.__name__[0:10] == "Validation":
+ continue
+ if monModule.__name__[0:10] == "Extensions":
+ continue
+ if monModule.__name__[0:12] == "InterfaceQT":
+ continue
+ if monModule.__name__ == fichierCataSource:
+ continue
+ texte = texte + "try : import " + monModule.__name__ + " \n"
+ texte = texte + "except : pass \n"
+ texte = texte + "try : from " + monModule.__name__ + " import * \n"
+ texte = texte + "except : pass \n"
+ except:
pass
- newModule=imp.new_module('__main__')
- exec (texte, newModule.__dict__)
- allClassToDump=[]
+ newModule = imp.new_module("__main__")
+ exec(texte, newModule.__dict__)
+ allClassToDump = []
for i in dir(importCataSource):
if i not in dir(newModule):
allClassToDump.append(importCataSource.__dict__[i])
+ self.texteSimple = ""
+ self.texteComplexe = ""
+ for c in allClassToDump:
+ if not (isinstance(c, Accas.OPER)) and not (isinstance(c, Accas.PROC)):
+ continue
+ c.nomDuCodeDumpe = self.nomDuCodeDumpe
+ c.code = self.implement
+ c.dumpXsd(avecEltAbstrait=True)
- self.texteSimple = ''
- self.texteComplexe = ''
- for c in allClassToDump :
- if not(isinstance(c, Accas.OPER)) and not(isinstance(c, Accas.PROC)) : continue
- c.nomDuCodeDumpe=self.nomDuCodeDumpe
- c.code=self.implement
- c.dumpXsd()
-
- self.texteSimple += c.texteSimple
+ self.texteSimple += c.texteSimple
self.texteComplexe += c.texteComplexe
- if c.ang != '' : c.texteElt = eltEtapeWithHelp.format(c.nom,self.implement,c.nomDuTypePyxb,self.implement,c.ang)
- elif c.fr != '' : c.texteElt = eltEtapeWithHelp.format(c.nom,self.implement,c.nomDuTypePyxb,self.implement,c.fr)
- else : c.texteElt = eltEtape.format(c.nom,self.implement,c.nomDuTypePyxb,self.implement)
- self.texteCata += c.texteElt
+ if c.ang != "":
+ c.texteElt = eltEtapeWithHelp.format(
+ c.nom, self.implement, c.nomDuTypePyxb, self.implement, c.ang
+ )
+ elif c.fr != "":
+ c.texteElt = eltEtapeWithHelp.format(
+ c.nom, self.implement, c.nomDuTypePyxb, self.implement, c.fr
+ )
+ else:
+ c.texteElt = eltEtape.format(
+ c.nom, self.implement, c.nomDuTypePyxb, self.implement
+ )
+ self.texteCata += c.texteElt
+
+ def dumpSimpleDesCommandes(self, debug=False):
+ self.texteCata = eltCataSimple.format(
+ self.code, self.code, self.code, self.code
+ )
+ # on remplace les extensions par rien
+ for c in self.commandes:
+ if debug:
+ print("commande ", c, c.nom)
+ c.nomDuCodeDumpe = self.nomDuCodeDumpe
+ c.code = self.implement
+ c.dumpXsd(avecEltAbstrait=False)
+ self.texteSimple += c.texteSimple
+ self.texteSimple += c.texteComplexe
+ if c.ang != "":
+ c.texteElt = eltEtapeSimpleWithHelp.format(
+ c.nom, self.implement, c.nomDuTypePyxb, 0, 1, c.ang
+ )
+ elif c.fr != "":
+ c.texteElt = eltEtapeSimpleWithHelp.format(
+ c.nom, self.implement, c.nomDuTypePyxb, 0, 1, c.fr
+ )
+ else:
+ c.texteElt = eltEtapeSimple.format(
+ c.nom, self.implement, c.nomDuTypePyxb, 0, 1
+ )
+ self.texteCata += c.texteElt
+ self.texteCata += finEltCataSimple
# -*- coding: utf-8 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
-# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
+# COPYRIGHT (C) 1991 - 2024 EDF R&D WWW.CODE-ASTER.ORG
# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2007-2021 EDF R&D
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-import sys,os
+# --------------------------------------------------------
+# Todo : affiner la traduction de la date
+# valeurPourXML='{}-{}-{}'.format(self.valeur.year, self.valeur.month,self.valeur.day)
+# n est pas suffisant
+# la valeur de la date a None egalement a affiner
+# --------------------------------------------------------
+import sys, os
import inspect
import traceback
+
+
def trace():
traceback.print_stack()
-#import raw.efficas as efficas
+
+
+# import raw.efficas as efficas
import types
-sys.path.insert(0,os.path.abspath(os.path.join(os.getcwd(),'..')))
+sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "..")))
-try :
+try:
import pyxb
import pyxb.binding
import pyxb.binding.basis
- #import pyxb.utils.utility
- #import pyxb.utils.domutils
-except : pass
+
+ # import pyxb.utils.utility
+ # import pyxb.utils.domutils
+except:
+ pass
from Accas import A_ASSD
+from Extensions.parametre import PARAMETRE
+
class X_OBJECT:
-# -------------
+ # -------------
def delObjPyxb(self, debug=False):
- if not self.cata or not self.cata.modeleMetier : return
- if self.nom == 'Consigne' : return None
+ if not self.cata or not self.cata.modeleMetier:
+ return
+ if self.nom == "Consigne":
+ return None
trouve = False
- if debug : print ('--------------- in delObjPyxb pour ' , self.nom)
- if debug : print (self.perePyxb.objPyxb.orderedContent())
- if debug : print (list(map(lambda o:o.value, self.perePyxb.objPyxb.orderedContent())))
-
- elt=pyxb.binding.basis.ElementContent(self.objPyxb, instance=self.perePyxb.objPyxb, tag=pyxb.namespace.ExpandedName(self.cata.modeleMetier.Namespace, self.nom))
- if debug : print ('element moi = ', elt, 'id de moi = ', id(self.objPyxb), self.objPyxb)
- if (elt.elementDeclaration.isPlural()):
- if debug : print ('je suis Plural')
- # monIndexInOrderedContent=0
- # for c in self.perePyxb.objPyxb.orderedContent():
- # if isinstance(c._Content__value,list) and isinstance(c._Content__value[0], type(self.objPyxb)): monIndexInOrderedContent += 1
- # listeObjetsAccas=self.parent.getChild(self.nom,restreint='oui')
- # if len(listeObjetsAccas) == 1 : monIndex=0
- # else : monIndex=listeObjetsAccas.index(self)
- # listeObjetsPyxb=getattr(self.perePyxb.objPyxb,elt.elementDeclaration._ElementDeclaration__key)
- # listeObjetsPyxb.pop(monIndex)
- # self.perePyxb.objPyxb.orderedContent().pop(monIndexInOrderedContent)
+ if debug:
+ print("--------------- in delObjPyxb pour ", self.nom)
+ if debug:
+ print(self.perePyxb.objPyxb.orderedContent())
+ if debug:
+ print(list(map(lambda o: o.value, self.perePyxb.objPyxb.orderedContent())))
+
+ elt = pyxb.binding.basis.ElementContent(
+ self.objPyxb,
+ instance=self.perePyxb.objPyxb,
+ tag=pyxb.namespace.ExpandedName(self.cata.modeleMetier.Namespace, self.nom),
+ )
+ if debug:
+ print("element moi = ", elt, "id de moi = ", id(self.objPyxb), self.objPyxb)
+ if elt.elementDeclaration.isPlural():
+ if debug:
+ print("je suis Plural")
+ # monIndexInOrderedContent=0
+ # for c in self.perePyxb.objPyxb.orderedContent():
+ # if isinstance(c._Content__value,list) and isinstance(c._Content__value[0], type(self.objPyxb)): monIndexInOrderedContent += 1
+ # listeObjetsAccas=self.parent.getChild(self.nom,restreint='oui')
+ # if len(listeObjetsAccas) == 1 : monIndex=0
+ # else : monIndex=listeObjetsAccas.index(self)
+ # listeObjetsPyxb=getattr(self.perePyxb.objPyxb,elt.elementDeclaration._ElementDeclaration__key)
+ # listeObjetsPyxb.pop(monIndex)
+ # self.perePyxb.objPyxb.orderedContent().pop(monIndexInOrderedContent)
for c in self.perePyxb.objPyxb.orderedContent():
- trouve=False
- if isinstance(c._Content__value,list) and isinstance(c._Content__value[0],type(self.objPyxb)):
- monIndex=c.value.index(self.objPyxb)
+ trouve = False
+ if isinstance(c._Content__value, list) and isinstance(
+ c._Content__value[0], type(self.objPyxb)
+ ):
+ monIndex = c.value.index(self.objPyxb)
trouve = True
- if trouve : break
- if not trouve : print ("************ pas trouve au delete"); return
- listeObjetsPyxb=getattr(self.perePyxb.objPyxb,elt.elementDeclaration._ElementDeclaration__key)
+ if trouve:
+ break
+ if not trouve:
+ print("************ pas trouve au delete")
+ return
+ listeObjetsPyxb = getattr(
+ self.perePyxb.objPyxb, elt.elementDeclaration._ElementDeclaration__key
+ )
listeObjetsPyxb.pop(monIndex)
# si dernier ?
- else :
+ else:
newOrderedContent = []
for i in self.perePyxb.objPyxb.orderedContent():
- if id(self.objPyxb) == id(i._Content__value) : trouve = True ;continue
+ if id(self.objPyxb) == id(i._Content__value):
+ trouve = True
+ continue
newOrderedContent.append(i)
- if not trouve : print ('elt a supprimer ', self.nom, 'non trouve')
+ if not trouve:
+ print("elt a supprimer ", self.nom, "non trouve")
for i in range(len(newOrderedContent)):
- self.perePyxb.objPyxb.orderedContent()[i]=newOrderedContent[i]
+ self.perePyxb.objPyxb.orderedContent()[i] = newOrderedContent[i]
self.perePyxb.objPyxb.orderedContent().pop(len(newOrderedContent))
- setattr(self.perePyxb.objPyxb,elt.elementDeclaration._ElementDeclaration__key,None)
- if debug : print (list(map(lambda o:o.value, self.perePyxb.objPyxb.orderedContent())))
+ setattr(
+ self.perePyxb.objPyxb,
+ elt.elementDeclaration._ElementDeclaration__key,
+ None,
+ )
+ if debug:
+ print(
+ list(map(lambda o: o.value, self.perePyxb.objPyxb.orderedContent()))
+ )
-
-
- def addObjPyxb(self,indiceDsLeContenu,debug=False):
- if not self.cata or not self.cata.modeleMetier : return
- if debug :print ('_____________ addObjPyxb ds X_OBJECT', self.nom, indiceDsLeContenu)
+ def addObjPyxb(self, indiceDsLeContenu, debug=False):
+ if not self.cata or not self.cata.modeleMetier:
+ return
+ if debug:
+ print("_____________ addObjPyxb ds X_OBJECT", self.nom, indiceDsLeContenu)
# adherence Accas sur le parent
- parent=self.parent
- while (parent.isBLOC()):
- if parent != self.parent : indiceDsLeContenu += parent.rangDsPyxb()
- parent=parent.parent
- self.perePyxb=parent
-
- if debug :print ('indiceDsLeContenu',indiceDsLeContenu)
- if debug :print (pyxb.namespace.ExpandedName(self.cata.modeleMetier.Namespace, self.nom))
-
- #if self.objPyxb ! = None : self.objPyxb.objAccas=self
- elt=pyxb.binding.basis.ElementContent(self.objPyxb, instance=self.perePyxb.objPyxb, tag=pyxb.namespace.ExpandedName(self.cata.modeleMetier.Namespace, self.nom))
- self.perePyxb.objPyxb.orderedContent().insert(indiceDsLeContenu,elt)
- if (elt.elementDeclaration.isPlural()):
- # je suis donc un MCList
- listeObjetsAccas=self.parent.getChild(self.nom,restreint='oui')
- if len(listeObjetsAccas) == 1 : monIndex=1
- else : monIndex=listeObjetsAccas.index(self)
- listeObjetsPyxb=getattr(self.perePyxb.objPyxb,elt.elementDeclaration._ElementDeclaration__key)
- listeObjetsPyxb.insert(monIndex,self.objPyxb)
- else :
- setattr(self.perePyxb.objPyxb,elt.elementDeclaration._ElementDeclaration__key,self.objPyxb)
- if debug : print (list(map(lambda o:o.value, self.perePyxb.objPyxb.orderedContent())))
- if debug : print ('fin _____________ addObjPyxb ds X_OBJECT', self.nom, indiceDsLeContenu)
-
+ parent = self.parent
+ while parent.isBLOC():
+ if parent != self.parent:
+ indiceDsLeContenu += parent.rangDsPyxb()
+ parent = parent.parent
+ self.perePyxb = parent
+
+ if debug:
+ print("indiceDsLeContenu", indiceDsLeContenu)
+ if debug:
+ print(
+ pyxb.namespace.ExpandedName(self.cata.modeleMetier.Namespace, self.nom)
+ )
+
+ if self.objPyxb != None:
+ self.objPyxb.objAccas = self # ATTENTION TUPLE&MATRICE
+ elt = pyxb.binding.basis.ElementContent(
+ self.objPyxb,
+ instance=self.perePyxb.objPyxb,
+ tag=pyxb.namespace.ExpandedName(self.cata.modeleMetier.Namespace, self.nom),
+ )
+ self.perePyxb.objPyxb.orderedContent().insert(indiceDsLeContenu, elt)
+ if elt.elementDeclaration.isPlural():
+ # je suis donc un MCList
+ listeObjetsAccas = self.parent.getChild(self.nom, restreint="oui")
+ if len(listeObjetsAccas) == 1:
+ monIndex = 1
+ else:
+ monIndex = listeObjetsAccas.index(self)
+ listeObjetsPyxb = getattr(
+ self.perePyxb.objPyxb, elt.elementDeclaration._ElementDeclaration__key
+ )
+ listeObjetsPyxb.insert(monIndex, self.objPyxb)
+ else:
+ setattr(
+ self.perePyxb.objPyxb,
+ elt.elementDeclaration._ElementDeclaration__key,
+ self.objPyxb,
+ )
+ if debug:
+ print(list(map(lambda o: o.value, self.perePyxb.objPyxb.orderedContent())))
+ if debug:
+ print(
+ "fin _____________ addObjPyxb ds X_OBJECT", self.nom, indiceDsLeContenu
+ )
def rangDsPyxb(self):
- monRangEnAccas=self.parent.mcListe.index(self)
- rangEnPyxb=0
- for frere in self.parent.mcListe[0: monRangEnAccas] :
+ monRangEnAccas = self.parent.mcListe.index(self)
+ rangEnPyxb = 0
+ for frere in self.parent.mcListe[0:monRangEnAccas]:
rangEnPyxb += frere.longueurDsArbre()
return rangEnPyxb
class X_MCSIMP(X_OBJECT):
-# -----------------------
-
- def buildObjPyxb(self, debug=True) :
- if not self.cata or not self.cata.modeleMetier : return
- if self.nom == 'Consigne' : return None
- if debug : print (self.definition.nomComplet())
- if debug : print ('_______________ X_MCSIMP buildObjPyxb', self.nom, self,self.valeur)
- if debug and self.objPyxbDeConstruction == None : print (self.nom, ' pas de pyxb')
- elif debug : print ('objPyxbDeConstruction', self.objPyxbDeConstruction)
-
- if self.objPyxbDeConstruction != None :
+ # -----------------------
+
+ def buildObjPyxb(self, debug=False):
+ if not self.cata or not self.cata.modeleMetier:
+ return
+ if self.nom == "Consigne":
+ return None
+ if debug:
+ print(self.definition.nomComplet())
+ if debug:
+ print("_______________ X_MCSIMP buildObjPyxb", self.nom, self, self.valeur)
+ if debug and self.objPyxbDeConstruction == None:
+ print(self.nom, " pas de pyxb")
+ elif debug:
+ print("objPyxbDeConstruction", self.objPyxbDeConstruction)
+ # PNPN Attention les unties ne sont pas forcement projetes comme attribut
+ # TODO : a revoir selon le catalogue et faire passer l info dans le XSD
+ if self.definition.unite != None:
+ typeAvecUnite = True
+ nomAttributUnite = "unite_T_" + self.nom
+ valeurAttributUnite = str(self.definition.unite)
+ else:
+ typeAvecUnite = False
+
+ if self.objPyxbDeConstruction != None:
self.objPyxb = self.objPyxbDeConstruction
- self.maClasseModeleMetier =type(self.objPyxb)
+ self.maClasseModeleMetier = type(self.objPyxb)
self.objPyxbDeConstruction = None
- if issubclass(self.maClasseModeleMetier, self.cata.modeleMetier.pyxb.binding.basis.STD_union):
- self.needFactory=True
- self.maClasseModeleMetierFactory=getattr(self.maClasseModeleMetier,'Factory')
- else : self.needFactory=False
- else :
- self.monNomClasseModeleMetier ='T_'+self.nom
- if hasattr(self.definition,'nomXML') and self.definition.nomXML != None : self.monNomClasseModeleMetier='T_'+self.definition.nomXML
- if self.monNomClasseModeleMetier in list(self.cata.DicoNomTypeDifferentNomElt.keys()) :
- nomComplet=self.definition.nomComplet()
- if nomComplet in list(self.cata.DicoNomTypeDifferentNomElt[self.monNomClasseModeleMetier].keys()):
- self.monNomClasseModeleMetier=self.cata.DicoNomTypeDifferentNomElt[self.monNomClasseModeleMetier][nomComplet]
- if debug : print ('Pour', self.nom, ' le type est ', self.monNomClasseModeleMetier)
- self.maClasseModeleMetier=getattr(self.cata.modeleMetier,self.monNomClasseModeleMetier)
-
- if self.waitMatrice() :
- #PNPN : Attention rien ne relie les objets listeObjPyxb a un objAccas
- # 27/04 je ne sais pas si cela posera pb
- self.listeLines = []
- self.maClasseModeleMetier=getattr(self.cata.modeleMetier,self.monNomClasseModeleMetier)
- self.maClasseModeleMetier_line=getattr(self.cata.modeleMetier,self.monNomClasseModeleMetier+'_line')
- if debug : print ('Matrice de type ', self.maClasseModeleMetier)
- for v in self.valeur:
- l=self.maClasseModeleMetier_line(v)
- self.listeLines.append(l)
- self.objPyxb=self.maClasseModeleMetier(*self.listeLines)
- #if self.objPyxb !=None : self.objPyxb.objAccas=self
- if debug : print ('Matrice ', self.nom, self.objPyxb)
- return
- if self.waitTuple() :
- self.objPyxb = []
- self.maClasseModeleMetier=getattr(self.cata.modeleMetier,self.monNomClasseModeleMetier)
- # if faut traiter l autre cas
- # et optimiser
- if self.definition.max !=1 :
- for v in self.valeur :
- if debug : print ('je traite ', v)
- listeConstruction=[]
- for i in range(self.combienEltDsTuple()):
- num=i+1
- maClasseElt=getattr(self.cata.modeleMetier,self.monNomClasseModeleMetier+'_n'+str(num))
- listeConstruction.append(maClasseElt(v[i]))
- self.objPyxb.append(self.maClasseModeleMetier(*listeConstruction))
- if debug : print (self.objPyxb)
- return
+ if issubclass(
+ self.maClasseModeleMetier,
+ self.cata.modeleMetier.pyxb.binding.basis.STD_union,
+ ):
+ self.needFactory = True
+ self.maClasseModeleMetierFactory = getattr(
+ self.maClasseModeleMetier, "Factory"
+ )
+ elif self.waitChaineAvecBlancs() and self.definition.max > 1:
+ self.maClasseModeleMetier = type(self.objPyxb[0])
+ self.needFactory = 1
+ self.maClasseModeleMetierFactory = getattr(
+ self.maClasseModeleMetier, "Factory"
+ )
+ else:
+ self.needFactory = False
+ else:
+ self.monNomClasseModeleMetier = "T_" + self.nom
+ if hasattr(self.definition, "nomXML") and self.definition.nomXML != None:
+ self.monNomClasseModeleMetier = "T_" + self.definition.nomXML
+ if self.monNomClasseModeleMetier in list(
+ self.cata.DicoNomTypeDifferentNomElt.keys()
+ ):
+ nomComplet = self.definition.nomComplet()
+ if nomComplet in list(
+ self.cata.DicoNomTypeDifferentNomElt[
+ self.monNomClasseModeleMetier
+ ].keys()
+ ):
+ self.monNomClasseModeleMetier = (
+ self.cata.DicoNomTypeDifferentNomElt[
+ self.monNomClasseModeleMetier
+ ][nomComplet]
+ )
+ if debug:
+ print("Pour", self.nom, " le type est ", self.monNomClasseModeleMetier)
+ self.maClasseModeleMetier = getattr(
+ self.cata.modeleMetier, self.monNomClasseModeleMetier
+ )
+
+ if self.waitMatrice():
+ # PNPN : Attention rien ne relie les objets listeObjPyxb a un objAccas
+ # 27/04 je ne sais pas si cela posera pb
+ self.listeLines = []
+ self.maClasseModeleMetier = getattr(
+ self.cata.modeleMetier, self.monNomClasseModeleMetier
+ )
+ self.maClasseModeleMetier_line = getattr(
+ self.cata.modeleMetier, self.monNomClasseModeleMetier + "_line"
+ )
+ if debug:
+ print("Matrice de type ", self.maClasseModeleMetier)
+ for v in self.valeur:
+ l = self.maClasseModeleMetier_line(v)
+ self.listeLines.append(l)
+ self.objPyxb = self.maClasseModeleMetier(*self.listeLines)
+ # if self.objPyxb !=None : self.objPyxb.objAccas=self
+ if debug:
+ print("Matrice ", self.nom, self.objPyxb)
+ if debug:
+ print(self.objPyxb.toDOM(element_name="RN_EDG").toprettyxml())
+ return
+ if self.waitTuple():
+ self.objPyxb = []
+ self.maClasseModeleMetier = getattr(
+ self.cata.modeleMetier, self.monNomClasseModeleMetier
+ )
+ # if faut traiter l autre cas
+ # et optimiser
+ if self.definition.max != 1:
+ for v in self.valeur:
+ if debug:
+ print("je traite ", v)
+ listeConstruction = []
+ for i in range(self.combienEltDsTuple()):
+ num = i + 1
+ maClasseElt = getattr(
+ self.cata.modeleMetier,
+ self.monNomClasseModeleMetier
+ + "_n"
+ + str(num)
+ + "_tuple",
+ )
+ listeConstruction.append(maClasseElt(v[i]))
+ self.objPyxb.append(
+ self.maClasseModeleMetier(*listeConstruction)
+ )
+ # on fait porter au 1er l objet Accas pour retrouver la definition
+ if self.objPyxb[0] != None:
+ self.objPyxb[0].objAccas = self
+ if debug:
+ print(self.objPyxb)
+ if debug:
+ print(self.objPyxb[0].__class__)
+ if debug:
+ for o in self.objPyxb:
+ print(
+ "x_MSIMP",
+ o.toDOM(element_name="RN_EDG").toprettyxml(),
+ )
+ return
if self.waitChaineAvecBlancs() and self.definition.max > 1:
- self.maClasseModeleMetier=getattr(self.cata.modeleMetier,self.monNomClasseModeleMetier)
- if debug : print (self.valeur)
- if self.valeur != None and self.valeur != [] : self.objPyxb = self.maClasseModeleMetier(*self.valeur)
- else :self.objPyxb = self.maClasseModeleMetier()
- if debug : print ('X_MCSIMP', self.nom, self.objPyxb, )
- if debug : print ('__________ fin X_MCSIMP', self.objPyxb, self.nom, self, self.maClasseModeleMetier,self.valeur)
- return
-
-
- if issubclass(self.maClasseModeleMetier, self.cata.modeleMetier.pyxb.binding.basis.STD_union):
- if debug : print ('needFactory')
- self.needFactory=True
- self.maClasseModeleMetierFactory=getattr(self.maClasseModeleMetier,'Factory')
- else : self.needFactory=False
-
- if self.valeur != None :
- if self.needFactory :
- if self.definition.max > 1 :
- # PNPN A corriger
- # self.objPyxb=self.maClasseModeleMetier(self.valeur)
- self.objPyxb=self.maClasseModeleMetierFactory(self.valeur)
- else : self.objPyxb=self.maClasseModeleMetierFactory(self.valeur)
- else : self.objPyxb=self.maClasseModeleMetier(self.valeur)
- else :
- if self.needFactory : self.objPyxb=None
- else : self.objPyxb=self.maClasseModeleMetier(_validate_constraints=False)
-
-
- #if self.objPyxb !=None : self.objPyxb.objAccas=self
- if debug : print ('X_MCSIMP', self.nom, self.objPyxb, )
- if debug : print ('__________ fin X_MCSIMP', self.objPyxb, self.nom, self, self.maClasseModeleMetier,self.valeur)
-
-
- def setValeurObjPyxb(self,newVal, debug=True):
- if not self.cata or not self.cata.modeleMetier : return
- if debug : print (' ___________________________ dans setValeurObjPyxb MCSIMP ', self.nom, newVal)
- if debug : print (' self.perePyxb = ', self.perePyxb.nom)
- if debug : print (self.nom , ' a pour pere', self.perePyxb, self.perePyxb.nom, self.perePyxb.objPyxb)
- if debug : print ('debut du setValeurObjPyxb pour ', self.nom, self.perePyxb.objPyxb.orderedContent())
-
- #if newVal != None : nvlObj=self.maClasseModeleMetier(newVal)
- if newVal != None :
- if self.needFactory : nvlObj=self.maClasseModeleMetierFactory(newVal)
- else : nvlObj=self.maClasseModeleMetier(newVal)
- else :
- if self.needFactory : nvlObj =None
- else : nvlObj=self.maClasseModeleMetier(_validate_constraints=False)
- self.val=newVal
- if debug : print ('fin du setValeurObjPyxb pour ', self.nom, self.perePyxb.objPyxb.orderedContent())
-
- if inspect.isclass(newVal) and issubclass(newVal,A_ASSD) :
+ self.maClasseModeleMetier = getattr(
+ self.cata.modeleMetier, self.monNomClasseModeleMetier
+ )
+ if debug:
+ print(self.maClasseModeleMetier)
+ if debug:
+ print(self.valeur)
+ if debug:
+ print(type(self.valeur))
+ if debug:
+ print(self.maClasseModeleMetier)
+ # cas des chaines avec blancs
+ if self.valeur != None and self.valeur != []:
+ listeDeChaine = []
+ laClasseDeChaine = getattr(
+ self.cata.modeleMetier, self.monNomClasseModeleMetier + "_enum"
+ )
+ for obj in self.valeur:
+ listeDeChaine.append(laClasseDeChaine(obj))
+ self.objPyxb = self.maClasseModeleMetier(*listeDeChaine)
+ else:
+ self.objPyxb = self.maClasseModeleMetier()
+ if self.objPyxb != None:
+ self.objPyxb.objAccas = self
+ if debug:
+ print(
+ "X_MCSIMP",
+ self.nom,
+ self.objPyxb,
+ )
+ if debug:
+ print(
+ "__________ fin X_MCSIMP",
+ self.objPyxb,
+ self.nom,
+ self,
+ self.maClasseModeleMetier,
+ self.valeur,
+ )
+ return
+
+ if issubclass(
+ self.maClasseModeleMetier,
+ self.cata.modeleMetier.pyxb.binding.basis.STD_union,
+ ):
+ if debug:
+ print("needFactory")
+ self.needFactory = True
+ self.maClasseModeleMetierFactory = getattr(
+ self.maClasseModeleMetier, "Factory"
+ )
+ else:
+ self.needFactory = False
+
+ if self.valeur != None:
+ if isinstance(self.valeur, PARAMETRE):
+ valeurPourXML = self.valeur.valeur
+ elif issubclass(self.maClasseModeleMetier, pyxb.binding.datatypes.date):
+ # PN a affiner selon la date
+ valeurPourXML = "{}-{}-{}".format(
+ self.valeur.year, self.valeur.month, self.valeur.day
+ )
+ else:
+ valeurPourXML = self.valeur
+ if self.needFactory:
+ if self.definition.max > 1:
+ # PNPN A corriger
+ # self.objPyxb=self.maClasseModeleMetier(valeurPourXML)
+ self.objPyxb = self.maClasseModeleMetierFactory(valeurPourXML)
+ else:
+ self.objPyxb = self.maClasseModeleMetierFactory(valeurPourXML)
+ else:
+ self.objPyxb = self.maClasseModeleMetier(valeurPourXML)
+ else:
+ if self.needFactory:
+ self.objPyxb = None
+ elif issubclass(self.maClasseModeleMetier, pyxb.binding.datatypes.date):
+ self.objPyxb = self.maClasseModeleMetier("0001-01-01")
+ else:
+ self.objPyxb = self.maClasseModeleMetier(
+ _validate_constraints=False
+ )
+
+ if self.objPyxb != None:
+ # les dict ont une entree objEnPyxb
+ if type(self.objPyxb) is list or type(self.objPyxb) is tuple:
+ porteObjet = self.objPyxb[0]
+ while type(porteObjet) is list or type(porteObjet) is tuple:
+ porteObjet = porteObjet[0]
+ if type(porteObjet) is dict:
+ porteObjet = porteObjet["objEnPyxb"]
+ porteObjet.objAccas = self
+ elif type(self.objPyxb) is dict:
+ porteObjet = self.objPyxb["objEnPyxb"]
+ porteObjet.objAccas = self
+ else:
+ self.objPyxb.objAccas = self
+ if self.objPyxb != None and typeAvecUnite:
+ setattr(self.objPyxb, nomAttributUnite, valeurAttributUnite)
+ valeurAttributUnite = str(self.definition.unite)
+ if debug:
+ print(
+ "X_MCSIMP",
+ self.nom,
+ self.objPyxb,
+ )
+ if debug:
+ print(
+ "__________ fin X_MCSIMP",
+ self.objPyxb,
+ self.nom,
+ self,
+ self.maClasseModeleMetier,
+ self.valeur,
+ )
+
+ def setValeurObjPyxb(self, newVal, debug=False):
+ # if self.nom=='MCPath' : debug = True
+ # print (self.nom)
+ if not self.cata or not self.cata.modeleMetier:
+ return
+ if debug:
+ print(
+ " ___________________________ dans setValeurObjPyxb MCSIMP ",
+ self.nom,
+ newVal,
+ )
+ if debug:
+ print(" self.perePyxb = ", self.perePyxb.nom)
+ if debug:
+ print(
+ self.nom,
+ " a pour pere",
+ self.perePyxb,
+ self.perePyxb.nom,
+ self.perePyxb.objPyxb,
+ )
+ if debug:
+ print(
+ "debut du setValeurObjPyxb pour ",
+ self.nom,
+ self.perePyxb.objPyxb.orderedContent(),
+ )
+ if debug:
+ print("self.needFactory", self.needFactory)
+ # if self.waitChaineAvecBlancs() and self.definition.max > 1: self.needFactory=1
+
+ # if newVal != None : nvlObj=self.maClasseModeleMetier(newVal)
+ if newVal != None:
+ if self.needFactory:
+ nvlObj = self.maClasseModeleMetierFactory(newVal)
+ elif issubclass(self.maClasseModeleMetier, pyxb.binding.datatypes.date):
+ valeurPourXML = "{}-{}-{}".format(
+ self.valeur.year, self.valeur.month, self.valeur.day
+ )
+ nvlObj = self.maClasseModeleMetier(valeurPourXML)
+ else:
+ nvlObj = self.maClasseModeleMetier(newVal)
+ if self.waitChaineAvecBlancs() and self.definition.max > 1:
+ self.monNomClasseModeleMetier = "T_" + self.nom
+ self.maClasseModeleMetier = getattr(
+ self.cata.modeleMetier, self.monNomClasseModeleMetier
+ )
+ if debug:
+ print(self.maClasseModeleMetier)
+ if newVal != None and newVal != []:
+ listeDeChaine = []
+ laClasseDeChaine = getattr(
+ self.cata.modeleMetier, self.monNomClasseModeleMetier + "_enum"
+ )
+ for obj in newVal:
+ listeDeChaine.append(laClasseDeChaine(obj))
+ nvlObj = self.maClasseModeleMetier(*listeDeChaine)
+ else:
+ nvlObj = self.maClasseModeleMetier(_validate_constraints=False)
+ else:
+ if self.needFactory:
+ nvlObj = None
+ # elif issubclass(self.maClasseModeleMetier,pyxb.binding.datatypes.date): nvlObj=None
+ elif issubclass(self.maClasseModeleMetier, pyxb.binding.datatypes.date):
+ self.objPyxb = self.maClasseModeleMetier("0001-01-01")
+ else:
+ nvlObj = self.maClasseModeleMetier(_validate_constraints=False)
+ self.val = newVal
+ if debug:
+ print(
+ "fin du setValeurObjPyxb pour ",
+ self.nom,
+ self.perePyxb.objPyxb.orderedContent(),
+ )
+
+ if inspect.isclass(newVal) and issubclass(newVal, A_ASSD):
newVal = newVal.nom
- setattr(self.perePyxb.objPyxb,self.nom,nvlObj)
- trouve=False
- indice=0
+
+ setattr(self.perePyxb.objPyxb, self.nom, nvlObj)
+ trouve = False
+ indice = 0
for i in self.perePyxb.objPyxb.orderedContent():
if i.elementDeclaration.id() == self.nom:
- #if isinstance(i._Content__value, self.maClasseModeleMetier) :
- self.perePyxb.objPyxb.orderedContent()[indice]=self.perePyxb.objPyxb.orderedContent()[-1]
- del(self.perePyxb.objPyxb.orderedContent()[-1])
- trouve=True
+ # if isinstance(i._Content__value, self.maClasseModeleMetier) :
+ self.perePyxb.objPyxb.orderedContent()[
+ indice
+ ] = self.perePyxb.objPyxb.orderedContent()[-1]
+ del self.perePyxb.objPyxb.orderedContent()[-1]
+ trouve = True
break
- indice+=1
- if not trouve : print ('Attention souci au changement de valeur de ', self.nom)
- self.objPyxb=nvlObj
- #self.objPyxb.objAccas=self
- if debug : print ('fin du setValeurObjPyxb pour ', self.nom, self.perePyxb.objPyxb.orderedContent())
-
-
-
-
-class X_MCCOMPO(X_OBJECT) :
-# -------------------------
-#
- def buildObjPyxb(self,mc_list, debug=False) :
- if not self.cata or not self.cata.modeleMetier : return
-
- #if self.nom == 'Scenario_data' : debug=1
- if debug : print ('X_MCCOMPO', self.nom)
- deepDebug=False
- self.listArg=[]
- self.dicoArg={}
- for objAccas in mc_list :
- if objAccas.nature == 'MCBLOC' :
+ indice += 1
+ if not trouve:
+ print("Attention souci au changement de valeur de ", self.nom)
+ self.objPyxb = nvlObj
+ # self.objPyxb.objAccas=self
+ if debug:
+ print(
+ "fin du setValeurObjPyxb pour ",
+ self.nom,
+ self.perePyxb.objPyxb.orderedContent(),
+ )
+
+
+class X_MCCOMPO(X_OBJECT):
+ # -------------------------
+ #
+ def buildObjPyxb(self, mc_list, debug=False):
+ if not self.cata or not self.cata.modeleMetier:
+ return
+
+ if debug:
+ print("X_MCCOMPO", self.nom)
+ deepDebug = False
+ if debug:
+ print("****************** X_MCCOMPO------------------------", self.nom)
+ self.listArg = []
+ self.dicoArg = {}
+ for objAccas in mc_list:
+ if debug:
+ print("dans le for", objAccas.nom)
+ if objAccas.nature == "MCBLOC":
self.exploreBLOC(objAccas)
- elif objAccas.nature == 'MCList' :
- if objAccas[0].definition.max > 1 :
- self.listArg.append(objAccas) # les MCList n ont pas objPyxb
- self.dicoArg[objAccas.nom]=[]
- for fils in objAccas :
- fils.perePyxb=self
+ elif objAccas.nature == "MCList":
+ if objAccas[0].definition.max > 1:
+ self.listArg.append(objAccas) # les MCList n ont pas objPyxb
+ self.dicoArg[objAccas.nom] = []
+ for fils in objAccas:
+ fils.perePyxb = self
self.dicoArg[objAccas.nom].append(fils.objPyxb)
- else :
- objAccas[0].perePyxb=self
- self.dicoArg[objAccas.nom]=objAccas[0].objPyxb
+ else:
+ objAccas[0].perePyxb = self
+ self.dicoArg[objAccas.nom] = objAccas[0].objPyxb
self.listArg.append(objAccas[0].objPyxb)
- else :
- if objAccas.nom == 'Consigne' : continue
- print ('______________', objAccas.nom, objAccas.objPyxb)
+ else:
+ if objAccas.nom == "Consigne":
+ continue
+ if debug:
+ print(
+ "ds X_MCCOMPO de ",
+ self.nom + " pour ",
+ objAccas.nom,
+ objAccas.objPyxb,
+ )
self.listArg.append(objAccas.objPyxb)
- self.dicoArg[objAccas.nom]=objAccas.objPyxb
- objAccas.perePyxb=self
-
- if debug : print('X_MCCOMPO -- listArg ---',self.nom,self.listArg)
- if debug : print('X_MCCOMPO -- dicoArg ---',self.nom,self.dicoArg)
-
-
- self.monNomClasseModeleMetier='T_'+self.nom
- if self.monNomClasseModeleMetier in list(self.cata.DicoNomTypeDifferentNomElt.keys()) :
- self.nomComplet=self.definition.nomComplet()
- self.monNomClasseModeleMetier=self.cata.DicoNomTypeDifferentNomElt[self.monNomClasseModeleMetier][self.nomComplet]
- self.maClasseModeleMetier=getattr(self.cata.modeleMetier,self.monNomClasseModeleMetier)
+ self.dicoArg[objAccas.nom] = objAccas.objPyxb
+ objAccas.perePyxb = self
+
+ if debug:
+ print("X_MCCOMPO -- listArg ---", self.nom, self.listArg)
+ if debug:
+ print("X_MCCOMPO -- dicoArg ---", self.nom, self.dicoArg)
+
+ self.monNomClasseModeleMetier = "T_" + self.nom
+ if self.monNomClasseModeleMetier in list(
+ self.cata.DicoNomTypeDifferentNomElt.keys()
+ ):
+ self.nomComplet = self.definition.nomComplet()
+ self.monNomClasseModeleMetier = self.cata.DicoNomTypeDifferentNomElt[
+ self.monNomClasseModeleMetier
+ ][self.nomComplet]
+ self.maClasseModeleMetier = getattr(
+ self.cata.modeleMetier, self.monNomClasseModeleMetier
+ )
# PN : Ne doit-on pas tester avant
- if self.objPyxbDeConstruction != None :
+ if self.objPyxbDeConstruction != None:
self.objPyxb = self.objPyxbDeConstruction
self.objPyxbDeConstruction = None
- if debug : print ('je passe dans le if pour ', self.nom, self.objPyxb, self)
- if debug : print ('X_MCCOMPO', self, self.nom, self.objPyxb,self.listArg,self.objPyxb.orderedContent())
- else :
- if debug : print (self.listArg)
- if debug : print (self.maClasseModeleMetier)
+ if debug:
+ print("je passe dans le if pour ", self.nom, self.objPyxb, self)
+ if debug:
+ print(
+ "X_MCCOMPO",
+ self,
+ self.nom,
+ self.objPyxb,
+ self.listArg,
+ self.objPyxb.orderedContent(),
+ )
+ else:
+ if debug:
+ print(self.listArg)
+ if debug:
+ print(self.maClasseModeleMetier)
# self.objPyxb=self.maClasseModeleMetier(*self.listArg)
- self.objPyxb=self.maClasseModeleMetier(**self.dicoArg)
- if deepDebug :
- print ('debut de __________ new ordered content')
+ self.objPyxb = self.maClasseModeleMetier(**self.dicoArg) # **1
+ # **1 Attention passer un complex plural element par **kw corrompt
+ # - l'élément content associé qui contient une liste au lieu d'un plural
+ # - l'orderedcontent qui contient une liste de Element Content au lieu des Elements Content directement
+ if deepDebug:
+ print("debut de __________ ordered content")
for o in self.objPyxb.orderedContent():
- print ('o', o)
- print ('value', o.value)
- print ('type', type(o.value))
- print ('id', id(o.value))
- print ('fin __________ new ordered content')
- print ('debut de __________ listArg')
+ print("o", o)
+ print("value", o.value)
+ print("type", type(o.value))
+ print("id", id(o.value))
+ print("fin __________ ordered content")
+ print("debut de __________ listArg")
for obj in self.listArg:
- print ('obj',obj)
- print ('type obj', type(obj))
- print ('id(obj)', id(obj))
- print ('fin __________ listArg')
+ print("obj", obj)
+ print("type obj", type(obj))
+ print("id(obj)", id(obj))
+ print("fin __________ listArg")
- newOrderedContent=[]
- if debug : print ('list Arg')
+ newOrderedContent = []
+ if debug:
+ print("list Arg")
for obj in self.listArg:
- if debug :
- print ('obj',obj)
- print ('type obj', type(obj))
- print ('id(obj)', id(obj))
-
- # on teste le caractere pluriel
- if isinstance(obj, list):
- for c in self.objPyxb.orderedContent() :
- if hasattr (c,'value') and c.value == obj :
- newOrderedContent.append(c)
- continue
- if (hasattr(obj, 'nature')) : # attention on a un object Accas et non un pyxb car les MCList n ont pas de objPyxb
- max=obj[0].definition.max
- else : max = 1
- if max == 1 :
- #if not(issubclass(type(obj), pyxb.binding.basis.enumeration_mixin) ):
+ if isinstance(obj, list):
+ # traitement particulier des tuples
+ # PN attention au cas particulier d un objet non instancie
+ # pb de l appel du build sur un JDC non valide
+ # TODO : plus reflechir au usecase d un build invalide
+ if obj != [] and (
+ hasattr(obj[0], "objAccas")
+ and obj[0].objAccas.nature == "MCSIMP"
+ and obj[0].objAccas.waitTuple()
+ ):
+ badObjPyxb = self.maClasseModeleMetier(**self.dicoArg)
+ for c in badObjPyxb.orderedContent():
+ if isinstance(c._Content__value, list) and isinstance(
+ c._Content__value[0], type(obj[0])
+ ):
+ newOrderedContent.append(c)
+ # **2 En cohérence avec le **1
+ # isinstance(c._Content__value,list) fonctionne par une conséquence de la corruption **1
+ # il faudrait en réalité tester/construire le plural pour avoir les objets pyxb bien construit
+ # et éviter les orphanContentException.
+ continue
+
+ # for c in self.objPyxb.orderedContent() :
+ # if hasattr (c,'value') and c.value == obj :
+ # newOrderedContent.append(c)
+ # continue
+ if hasattr(
+ obj, "nature"
+ ): # attention on a un object Accas et non un pyxb car les MCList n ont pas de objPyxb
+ max = obj[0].definition.max
+ else:
+ max = 1
+ if max == 1:
+ # if not(issubclass(type(obj), pyxb.binding.basis.enumeration_mixin) ):
# newOrderedContent.append(self.objPyxb.orderedContent()[list(map(lambda o:id(o.value), self.objPyxb.orderedContent())).index(id(obj))] )
- #else :
+ # else :
# newOrderedContent.append(self.objPyxb.orderedContent()[list(map(lambda o:type(o.value), self.objPyxb.orderedContent())).index(type(obj))] )
# PN 22 sept 2020 . pourquoi pas toujours l id. le tyoe ne convient pas en cas d union d enum
- newOrderedContent.append(self.objPyxb.orderedContent()[list(map(lambda o:id(o.value), self.objPyxb.orderedContent())).index(id(obj))] )
- else : # element Pural
- for c in self.objPyxb.orderedContent() :
- if isinstance(c._Content__value,list) and isinstance(c._Content__value[0], type(obj[0].objPyxb)): newOrderedContent.append(c)
-
- for i in range(len(self.listArg)):
- self.objPyxb.orderedContent()[i]=newOrderedContent[i]
- debug=True
- if debug : print ('X_MCCOMPO', self, self.nom, self.objPyxb)
- if debug : print ('X_MCCOMPO', self.listArg)
- if debug : print ('X_MCCOMPO', newOrderedContent)
- if debug : print ( 'X_MCCOMPO',self.objPyxb.orderedContent())
- if debug : print ('fin buildObjetPyxb _______________________________________')
- # assert(self.objPyxb.validateBinding())
+ newOrderedContent.append(
+ self.objPyxb.orderedContent()[
+ list(
+ map(
+ lambda o: id(o.value), self.objPyxb.orderedContent()
+ )
+ ).index(id(obj))
+ ]
+ )
+ else: # element Plural
+ for c in self.objPyxb.orderedContent():
+ if isinstance(c._Content__value, list) and isinstance(
+ c._Content__value[0], type(obj[0].objPyxb)
+ ):
+ newOrderedContent.append(c)
+ # **2 En cohérence avec le **1
+ # isinstance(c._Content__value,list) fonctionne par une conséquence de la corruption **1
+ # il faudrait en réalité tester/construire le plural pour avoir les objets pyxb bien construit
+ # et éviter les orphanContentException.
+
+ if debug:
+ print("construction X_MCCOMPO", self, self.nom, self.objPyxb)
+ i = 0
+
+ # a priori on a a len(newOrderedContent) > len(orderedContent())
+ #
+ if debug:
+ print("X_MCCOMPO newOrderedContent", len(newOrderedContent))
+ if debug:
+ print("X_MCCOMPO oderedContent", len(self.objPyxb.orderedContent()))
+ for i in range(len(newOrderedContent)):
+ self.objPyxb.orderedContent()[i] = newOrderedContent[i]
+
+ if debug:
+ print("X_MCCOMPO", self, self.nom, self.objPyxb)
+ if debug:
+ print("X_MCCOMPO", self.listArg)
+ if debug:
+ print("X_MCCOMPO", newOrderedContent)
+ if debug:
+ print("X_MCCOMPO", self.objPyxb.orderedContent())
+ if deepDebug:
+ for obj in self.objPyxb.orderedContent():
+ print("----------------- obj ", obj)
+ print(obj.value)
+ try:
+ for objFils in obj.value.orderedContent():
+ print(objFils.value)
+ except:
+ pass
+ if debug:
+ print("X_MCCOMPO", self.objPyxb.orderedContent())
+ if debug:
+ print(
+ "x_MCCOMPO", self.objPyxb.toDOM(element_name="RN_EDG").toprettyxml()
+ )
+ if debug:
+ print("X_MCCOMPO", self.objPyxb.orderedContent())
+ if debug:
+ print("fin buildObjetPyxb _______________________________________")
+ # assert(self.objPyxb.validateBinding())
- def exploreBLOC(self,objAccas,debug=False):
- if debug : print (' ds exploreBLOC', objAccas.nom)
- laListeSsLesBlocs=[]
+ def exploreBLOC(self, objAccas, debug=False):
+ if debug:
+ print(" ds exploreBLOC", objAccas.nom)
+ laListeSsLesBlocs = []
for fils in objAccas.mcListe:
- if fils.nature == 'MCBLOC' :
+ if fils.nature == "MCBLOC":
self.exploreBLOC(fils)
- elif fils.nature == 'MCList' :
- #print ('exploreBLOC des MCList', fils.nom)
- self.dicoArg[fils.nom]=[]
- if fils[0].definition.max > 1 :
- #print ('ajout de ', fils)
- self.listArg.append(fils) # les MCList n ont pas objPyxb
- for objFils in fils :
- objFils.perePyxb=self
+ elif fils.nature == "MCList":
+ # print ('exploreBLOC des MCList', fils.nom)
+ self.dicoArg[fils.nom] = []
+ if fils[0].definition.max > 1:
+ # print ('ajout de ', fils)
+ self.listArg.append(fils) # les MCList n ont pas objPyxb
+ for objFils in fils:
+ objFils.perePyxb = self
self.dicoArg[fils.nom].append(objFils.objPyxb)
else:
- fils[0].perePyxb=self
- self.dicoArg[fils.nom]=fils[0].objPyxb
+ fils[0].perePyxb = self
+ self.dicoArg[fils.nom] = fils[0].objPyxb
self.listArg.append(fils[0].objPyxb)
- else :
- if fils.nom == "Consigne" : continue
+ if debug:
+ print(
+ "ajout dans exploreBLOC ",
+ self.nom + " de fact ",
+ fils.nom,
+ fils[0].objPyxb,
+ )
+ else:
+ if fils.nom == "Consigne":
+ continue
self.listArg.append(fils.objPyxb)
- self.dicoArg[fils.nom]=fils.objPyxb
- fils.perePyxb=self
- if debug : print (fils.nom ,' est un SIMP a pour pere Pyxb', self, self.nom)
- if debug : print ('fin ds exploreBLOC', objAccas .nom)
-
-
-
-
-class X_MCBLOC (X_MCCOMPO):
-# --------------------------
- def buildObjPyxb(self,mc_list,debug=False):
- if not self.cata or not self.cata.modeleMetier : return
- if debug : print ('X_MCBLOC buildObjPyxb', self.nom, self, mc_list, 'ne fait rien')
- self.perePyxb=None
- self.objPyxb=None
+ self.dicoArg[fils.nom] = fils.objPyxb
+ fils.perePyxb = self
+ if debug:
+ print(
+ "ajout dans exploreBLOC ",
+ self.nom + " de ",
+ fils.nom,
+ fils.objPyxb,
+ )
+ # if debug : print ('ds exploreBLOC de ', self.nom + ' pour ', fils.nom, fils.objPyxb)
+ # if debug : print (fils.nom ,' est un SIMP a pour pere Pyxb', self, self.nom)
+ if debug:
+ print("fin ds exploreBLOC", objAccas.nom)
+
+
+class X_MCBLOC(X_MCCOMPO):
+ # --------------------------
+ def buildObjPyxb(self, mc_list, debug=False):
+ if not self.cata or not self.cata.modeleMetier:
+ return
+ if debug:
+ print("X_MCBLOC buildObjPyxb", self.nom, self, mc_list, "ne fait rien")
+ self.perePyxb = None
+ self.objPyxb = None
def addObjPyxb(self, indiceDsLeContenu, debug=False):
- if not self.cata or not self.cata.modeleMetier : return
- if debug : print ('X_MCBLOC addObjPyxb', self.nom, self, self.mcListe, indiceDsLeContenu)
- rangDeLObjet=indiceDsLeContenu
+ if not self.cata or not self.cata.modeleMetier:
+ return
+ if debug:
+ print(
+ "X_MCBLOC addObjPyxb", self.nom, self, self.mcListe, indiceDsLeContenu
+ )
+ rangDeLObjet = indiceDsLeContenu
for obj in self.mcListe:
- obj.addObjPyxb( rangDeLObjet)
- rangDeLObjet=rangDeLObjet+obj.longueurDsArbre()
+ obj.addObjPyxb(rangDeLObjet)
+ rangDeLObjet = rangDeLObjet + obj.longueurDsArbre()
def delObjPyxb(self, debug=False):
- if not self.cata or not self.cata.modeleMetier : return
- if debug : print ('X_MCBLOC delObjPyxb', self.nom, ' --------------------------')
+ if not self.cata or not self.cata.modeleMetier:
+ return
+ if debug:
+ print("X_MCBLOC delObjPyxb", self.nom, " --------------------------")
for obj in self.mcListe:
obj.delObjPyxb()
- if debug : print ('fin X_MCBLOC delObjPyxb --------------------------')
+ if debug:
+ print("fin X_MCBLOC delObjPyxb --------------------------")
-class X_MCLIST (X_MCCOMPO):
-# --------------------------
- def buildObjPyxb(self,mc_list, debug=False):
- if debug : print ('X_MCLIST buildObjPyxb ne fait rien', self.nom, self, mc_list)
+class X_MCLIST(X_MCCOMPO):
+ # --------------------------
+
+ def buildObjPyxb(self, mc_list, debug=False):
+ if debug:
+ print("X_MCLIST buildObjPyxb ne fait rien", self.nom, self, mc_list)
pass
- def addObjPyxb(self,indiceDsLeContenu, debug=False):
- if debug : print ('X_MCLIST addObjPyxb', self.nom, indiceDsLeContenu)
- rangDeLObjet=indiceDsLeContenu
- for objFils in self :
+ def addObjPyxb(self, indiceDsLeContenu, debug=False):
+ if debug:
+ print("X_MCLIST addObjPyxb", self.nom, indiceDsLeContenu)
+ rangDeLObjet = indiceDsLeContenu
+ for objFils in self:
objFils.addObjPyxb(rangDeLObjet)
- rangDeLObjet= rangDeLObjet + 1
+ rangDeLObjet = rangDeLObjet + 1
def delObjPyxb(self, debug=False):
- if not self.cata or not self.cata.modeleMetier : return
- if debug : print ('X_MCLIST delObjPyxb', self.nom, ' --------------------------')
+ if not self.cata or not self.cata.modeleMetier:
+ return
+ if debug:
+ print("X_MCLIST delObjPyxb", self.nom, " --------------------------")
for obj in self:
obj.delObjPyxb()
- if debug : print ('fin X_MCLIST delObjPyxb --------------------------')
+ if debug:
+ print("fin X_MCLIST delObjPyxb --------------------------")
-class X_MCFACT (X_MCCOMPO):
-# -------------------------
+class X_MCFACT(X_MCCOMPO):
+ # -------------------------
pass
-class X_ETAPE(X_MCCOMPO) :
-# -------------------------
-
- def metAJourNomASSD(self, nom,debug=False):
- if not self.cata or not self.cata.modeleMetier : return
- if debug : print ('X_ETAPE metAJourLesAttributs', self.nom, nom,' --------------------------')
- self.objPyxb.sdName=nom
-
-class X_JDC (X_MCCOMPO):
-# ---------------------
-
- def __init__(self):
- self.perePyxb=None
- if not self.cata or not self.cata.modeleMetier : return
- #if hasattr(self.cata,'DicoNomTypeDifferentNomElt') : print ('jkllllllllllllllll')
- if not(hasattr(self.cata,'DicoNomTypeDifferentNomElt')) : self.cata.DicoNomTypeDifferentNomElt={}
- self.monNomClasseModeleMetier=self.code
- self.maClasseModeleMetier=getattr(self.cata.modeleMetier,self.monNomClasseModeleMetier)
- self.objPyxb=self.maClasseModeleMetier()
- #self.objPyxb.objAccas=self
- pyxb.GlobalValidationConfig._setContentInfluencesGeneration(pyxb.GlobalValidationConfig.NEVER)
- pyxb.GlobalValidationConfig._setInvalidElementInContent(pyxb.GlobalValidationConfig.RAISE_EXCEPTION)
- pyxb.GlobalValidationConfig._setOrphanElementInContent(pyxb.GlobalValidationConfig.RAISE_EXCEPTION)
-
-
-
- def enregistreEtapePyxb(self,etape,indice=0):
- # ne fonctionne pas : a reecrire avec les fonctions addObjPyxb et ReconstruitPerePyxb
- # ne contient pas indice pour l insant
- # print ( 'hhhhhhhhhhhhhhh enregistreEtapePyxb hhhhhhhhhhhhhhhhhhhhhhhhh')
- # print ('enregistre ds ',self, etape.nom, 'indice = ', indice)
- if not self.cata.modeleMetier : return
+
+class X_ETAPE(X_MCCOMPO):
+ # -------------------------
+
+ def metAJourNomASSD(self, nom, debug=False):
+ if not self.cata or not self.cata.modeleMetier:
+ return
+ if debug:
+ print(
+ "X_ETAPE metAJourLesAttributs",
+ self.nom,
+ nom,
+ " --------------------------",
+ )
+ self.objPyxb.sdName = nom
+
+
+class X_JDC(X_MCCOMPO):
+ # ---------------------
+
+ def __init__(self):
+ self.perePyxb = None
+ if not self.cata or not self.cata.modeleMetier:
+ return
+ # if hasattr(self.cata,'DicoNomTypeDifferentNomElt') : print ('jkllllllllllllllll')
+ if not (hasattr(self.cata, "DicoNomTypeDifferentNomElt")):
+ self.cata.DicoNomTypeDifferentNomElt = {}
+ self.monNomClasseModeleMetier = self.code
+ self.maClasseModeleMetier = getattr(
+ self.cata.modeleMetier, self.monNomClasseModeleMetier
+ )
+ self.objPyxb = self.maClasseModeleMetier()
+ # self.objPyxb.objAccas=self
+ pyxb.GlobalValidationConfig._setContentInfluencesGeneration(
+ pyxb.GlobalValidationConfig.ALWAYS
+ )
+ pyxb.GlobalValidationConfig._setInvalidElementInContent(
+ pyxb.GlobalValidationConfig.RAISE_EXCEPTION
+ )
+ # pyxb.GlobalValidationConfig._setOrphanElementInContent(pyxb.GlobalValidationConfig.RAISE_EXCEPTION) #TODO: Réactiver après correction cf **1 **2
+ pyxb.GlobalValidationConfig._setOrphanElementInContent(
+ pyxb.GlobalValidationConfig.GIVE_UP
+ )
+
+ def enregistreEtapePyxb(self, etape, indice=0, debug=False):
+ # ne fonctionne pas : a reecrire avec les fonctions addObjPyxb et ReconstruitPerePyxb
+ # ne contient pas indice pour l insant
+
+ if debug:
+ print("hhhhhhhhhhhhhhh enregistreEtapePyxb hhhhhhhhhhhhhhhhhhhhhhhhh")
+ if debug:
+ print("enregistre ds ", self, etape.nom, "indice = ", indice)
+ if etape.nature == "COMMENTAIRE":
+ return
+ if etape.nature == "PARAMETRE":
+ return
+ if not self.cata.modeleMetier:
+ return
+ if debug:
+ print("etape.objPyxb", etape.objPyxb)
+ if debug:
+ print(etape.objPyxb.toDOM(element_name=self.code).toprettyxml())
self.objPyxb.append(etape.objPyxb)
etape.perePyxb = self
- #print (self.objPyxb.orderedContent())
- #if indice != (len(self.objPyxb.orderedContent()) ) :
+ # print (self.objPyxb.orderedContent())
+ # if indice != (len(self.objPyxb.orderedContent()) ) :
# tampon=self.objPyxb.orderedContent()[-1]
# for i in reversed(range(len(self.objPyxb.orderedContent()))):
# self.objPyxb.orderedContent()[i]=self.objPyxb.orderedContent()[i-1]
# if i == indice + 1 : break
# self.objPyxb.orderedContent()[indice]=tampon
- #print (self.objPyxb.orderedContent())
- #try:
+ # print (self.objPyxb.orderedContent())
+ # try:
# self.objPyxb.validateBinding()
- #except pyxb.ValidationError as e:
+ # except pyxb.ValidationError as e:
# print(e.details())
- def toXml(self,fichier=None, debug=False):
- if debug : print ('ds to XML')
- if not self.cata or not self.cata.modeleMetier : return
- if debug : print (' to xml ***************',self.objPyxb,'***************',)
- if debug : print (' to xml ***************',self,'***************',)
- if debug : print (' to xml ***************',self.objPyxb.orderedContent(),'***************',)
- if debug : print(self.objPyxb.toDOM().toprettyxml())
- if debug : print(self.objPyxb.toxml())
- return (self.objPyxb.toDOM().toprettyxml())
-
-
- def analyseFromXML(self,debug=False):
- print ("je suis ds analyseFromXML -- > appel ds analyseXML de I_JDC.py")
- if self.procedure == "" : return
- self.objPyxb=self.cata.modeleMetier.CreateFromDocument(self.procedure)
- if not hasattr(self.cata.modeleMetier,'AccasUserAssd'):
+ def toXml(self, fichier=None, debug=False, uniteAsAttribute=False):
+ if debug:
+ print("ds to XML")
+ if not self.cata or not self.cata.modeleMetier:
+ return
+ self.cata.uniteAsAttribute = uniteAsAttribute
+ # if debug : print (' to xml ***************',self.objPyxb,'***************',)
+ # if debug : print (' to xml ***************',self,'***************',)
+ # if debug : print (' to xml ***************',self.objPyxb.orderedContent(),'***************',)
+ # if debug : print(self.objPyxb.toDOM().toprettyxml())
+ # if debug : print(self.objPyxb.toxml())
+ # ns1 = pyxb.namespace.Namespace("xsi:schemaLocation")
+ # monUri='http://chercheurs.edf.com/logiciels/{} {}'.format(self.code,os.path.basename(self.cata.fileModeleMetier))
+ # print ('monUri', monUri)
+ # pyxb.utils.domutils.BindingDOMSupport.DeclareNamespace(ns1, monUri)
+
+ ns1 = pyxb.namespace.NamespaceForURI(
+ "http://www.w3.org/2001/XMLSchema-instance", True
+ )
+ pyxb.utils.domutils.BindingDOMSupport.DeclareNamespace(ns1, "xsi")
+ texteXML = self.objPyxb.toDOM().toprettyxml()
+ if debug:
+ print(texteXML)
+ if debug:
+ print(
+ "__________________________________________________________________________"
+ )
+ # enteteXML = '<ns1:{} xmlns:ns1="http://chercheurs.edf.com/logiciels/{}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://chercheurs.edf.com/logiciels/{} file:{}>'.format(self.code,self.code,self.code,self.cata.fileModeleMetier)
+ return self.objPyxb.toDOM().toprettyxml()
+
+ def analyseFromXML(self, debug=False):
+ if debug:
+ print("je suis ds analyseFromXML -- > appel ds analyseXML de I_JDC.py")
+ if self.procedure == "":
+ return
+ self.objPyxb = self.cata.modeleMetier.CreateFromDocument(self.procedure)
+ if not hasattr(self.cata.modeleMetier, "AccasUserAssd"):
from Accas import UserASSD
- self.cata.modeleMetier.AccasUserAssd=UserASSD
+
+ self.cata.modeleMetier.AccasUserAssd = UserASSD
+ if not hasattr(self.cata.modeleMetier, "AccasUserAssdMultiple"):
+ from Accas import UserASSDMultiple
+
+ self.cata.modeleMetier.AccasUserAssdMultiple = UserASSDMultiple
for contentObjEtape in self.objPyxb.orderedContent():
- objEtape=contentObjEtape.value
- objEtape.dictArgs=(self.pyxbToDict(objEtape))
- objEtape.monNomClasseAccas=objEtape._ExpandedName.localName()
- objEtape.monNomClasseAccas=objEtape.monNomClasseAccas[2:]
+ # debug=1
+ objEtape = contentObjEtape.value
+ objEtape.dictArgs = self.pyxbToDict(objEtape)
+ objEtape.monNomClasseAccas = objEtape._ExpandedName.localName()
+ objEtape.monNomClasseAccas = objEtape.monNomClasseAccas[2:]
# doute sur les 2 lignes suivantes : objEtape peut etre contentObjEtape 2juin20
- objEtape.dictPyxb['objEnPyxb']=objEtape
- objEtape.dictArgs['dicoPyxbDeConstruction']=objEtape.dictPyxb
- if debug : print ('dicoPyxbDeConstruction', objEtape.dictArgs['dicoPyxbDeConstruction'])
- maClasseAccas=getattr(self.cata,objEtape.monNomClasseAccas)
- if debug : print ( 'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh')
- if debug : print ('maClasseAccas ', maClasseAccas)
- if debug : print ('objEtape ', objEtape , type(objEtape))
- if debug : print ('nomClasseAccas ',objEtape.monNomClasseAccas, type(objEtape.monNomClasseAccas))
- if debug : print ('_ExpandedName ', objEtape._ExpandedName, type(objEtape._ExpandedName))
- if debug : print ('dictArgs ',objEtape.dictArgs)
- if debug : print ('dictPyxb ',objEtape.dictPyxb)
+ objEtape.dictPyxb["objEnPyxb"] = objEtape
+ objEtape.dictArgs["dicoPyxbDeConstruction"] = objEtape.dictPyxb
+ if debug:
+ print(
+ "dicoPyxbDeConstruction",
+ objEtape.dictArgs["dicoPyxbDeConstruction"],
+ )
+ maClasseAccas = getattr(self.cata, objEtape.monNomClasseAccas)
+ if debug:
+ print("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")
+ if debug:
+ print("maClasseAccas ", maClasseAccas)
+ if debug:
+ print("objEtape ", objEtape, type(objEtape))
+ if debug:
+ print(
+ "nomClasseAccas ",
+ objEtape.monNomClasseAccas,
+ type(objEtape.monNomClasseAccas),
+ )
+ if debug:
+ print(
+ "_ExpandedName ",
+ objEtape._ExpandedName,
+ type(objEtape._ExpandedName),
+ )
+ if debug:
+ print("dictArgs ", objEtape.dictArgs)
+ if debug:
+ print("dictPyxb ", objEtape.dictPyxb)
# attention au call d Oper qui renomme l objet pyxb
- if hasattr(objEtape,'sdName') :
- if debug and hasattr(objEtape,'sdName') :print ('sdName',objEtape.sdName)
- objAccasEtape=maClasseAccas(nomXML=objEtape.sdName, **(objEtape.dictArgs))
- else : objAccasEtape=maClasseAccas(**(objEtape.dictArgs))
- if debug : print ( 'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh')
-
+ if hasattr(objEtape, "sdName"):
+ if debug and hasattr(objEtape, "sdName"):
+ print("sdName", objEtape.sdName)
+ objAccasEtape = maClasseAccas(
+ nomXML=objEtape.sdName, **(objEtape.dictArgs)
+ )
+ else:
+ objAccasEtape = maClasseAccas(**(objEtape.dictArgs))
+ if debug:
+ print("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")
- def pyxbToDict(self,objAAnalyser, debug=True):
+ def pyxbToDict(self, objAAnalyser, debug=False):
# la transformation de l objAAnalyser en type lu par eficas ne fonctionne pas pour tout
- if objAAnalyser is None: return
- if debug : print ('debut pour_____________________________ ',objAAnalyser)
+ if objAAnalyser is None:
+ return
+ # if (objAAnalyser.__class__.__name__.find('BU_map')>0) : debug=True
+ # if (objAAnalyser.__class__.__name__.find('n1')>0) : debug=True
+ # if debug : print ('debut pour_____________________________ ',objAAnalyser, objAAnalyser.__class__.__name__)
dictArgs = {}
# traitement SIMP
- # ---------------
+ # ---------------
# a revoir pour les matrices
# et les tuples
- debug = 1
- if isinstance(objAAnalyser, pyxb.binding.basis.simpleTypeDefinition):
- if debug : print ('je suis un MCSimple', objAAnalyser)
+ # if isinstance(objAAnalyser, pyxb.binding.basis.simpleTypeDefinition) or (self._ContentTypeTag == self._CT_SIMPLE) :
+ if debug:
+ print(
+ "simpleTypeDefinition :",
+ isinstance(objAAnalyser, pyxb.binding.basis.simpleTypeDefinition),
+ )
+ forcesimpleTypeDefinition = False
+ if objAAnalyser._AttributeMap != {}:
+ # PNPN pour trouver comment differencier les types complexes extensions avec un attibut
+ # pour l instant on ne fait rien des attributs dans eficas
+ # et pas traite pour les listes
+ try:
+ c = objAAnalyser.orderedContent()
+ except:
+ forcesimpleTypeDefinition = True
+ if (
+ isinstance(objAAnalyser, pyxb.binding.basis.simpleTypeDefinition)
+ or forcesimpleTypeDefinition
+ ):
+ if debug:
+ print("je suis un MCSimple", objAAnalyser)
# traitement scalaire
- objAAnalyser.dictPyxb=objAAnalyser
- if not (isinstance(objAAnalyser,pyxb.binding.basis.STD_list)):
- if debug : print ('je suis un scalaire')
- if isinstance(objAAnalyser,self.cata.modeleMetier.AccasUserAssd) or isinstance(objAAnalyser,self.cata.modeleMetier.AccasUserAssdMultiple):
- if debug : print ('je suis un UserASSD')
- laClassePyxbUserAssd=type(objAAnalyser)
- return self.creeUserAssd(objAAnalyser,laClassePyxbUserAssd)
- if isinstance(objAAnalyser, pyxb.binding.datatypes.boolean) : return bool(objAAnalyser)
- if isinstance(objAAnalyser, str) : return str(objAAnalyser)
- if isinstance(objAAnalyser, int) : return int(objAAnalyser)
- if isinstance(objAAnalyser, float): return float(objAAnalyser)
- if isinstance(objAAnalyser, pyxb.binding.basis.enumeration_mixin): return str(objAAnalyser)
+ objAAnalyser.dictPyxb = objAAnalyser
+ if not (isinstance(objAAnalyser, pyxb.binding.basis.STD_list)):
+ if forcesimpleTypeDefinition:
+ objAAnalyser = objAAnalyser.value()
+ if debug:
+ print("je suis un scalaire")
+ # if (objAAnalyser.__class__.__name__.find('n1')>0) :
+ # if (isinstance(objAAnalyser,self.cata.modeleMetier.AccasTuple)): return objAAnalyser
+ if isinstance(
+ objAAnalyser, self.cata.modeleMetier.AccasUserAssd
+ ) or isinstance(
+ objAAnalyser, self.cata.modeleMetier.AccasUserAssdMultiple
+ ):
+ laClassePyxbUserAssd = type(objAAnalyser)
+ return self.creeUserAssd(objAAnalyser, laClassePyxbUserAssd)
+ if issubclass(objAAnalyser.__class__, self.cata.modeleMetier.AccasAssd):
+ return self.g_context[str(objAAnalyser)]
+ if isinstance(objAAnalyser, pyxb.binding.datatypes.boolean):
+ return bool(objAAnalyser)
+ if isinstance(objAAnalyser, str):
+ return str(objAAnalyser)
+ if isinstance(objAAnalyser, int):
+ return int(objAAnalyser)
+ if isinstance(objAAnalyser, float):
+ return float(objAAnalyser)
+ if isinstance(objAAnalyser, pyxb.binding.basis.enumeration_mixin):
+ return str(objAAnalyser)
return objAAnalyser
- else :
- if debug : print ('je suis une liste')
- laListe=[]
+ else:
+ if debug:
+ print("je suis une liste")
+ laListe = []
+
# liste homogene
- if len(objAAnalyser)>0:
- if issubclass(objAAnalyser[0].__class__,self.cata.modeleMetier.AccasUserAssd) or issubclass(objAAnalyser[0].__class__,self.cata.modeleMetier.AccasUserAssdMultiple): estUnUserASSDorUserASSDMultiple = True
- else : estUnUserASSDorUserASSDMultiple=False
- else : estUnUserASSDorUserASSDMultiple=False
- if debug : print ('estUnUserASSDorUserASSDMultiple', estUnUserASSDorUserASSDMultiple)
- for obj in objAAnalyser :
- if estUnUserASSDorUserASSDMultiple:
- laClassePyxbUserAssd=obj.__class__
- laListe.append(self.creeUserAssd(obj,laClassePyxbUserAssd))
- elif isinstance(obj, str): laListe.append (str(obj))
- elif isinstance(obj, int): laListe.append (int(obj))
- elif isinstance(obj, float): laListe.append (float(obj))
- elif isinstance(obj, pyxb.binding.basis.enumeration_mixin): laListe.append(str(obj))
- else : laListe.append(obj)
- return (laListe)
+ # if len(objAAnalyser)>0:
+ # if issubclass(objAAnalyser[0].__class__,self.cata.modeleMetier.AccasUserAssd) or issubclass(objAAnalyser[0].__class__,self.cata.modeleMetier.AccasUserAssdMultiple): estUnUserASSDorUserASSDMultiple = True
+ # else : estUnUserASSDorUserASSDMultiple=False
+ # print (objAAnalyser[0].__class__,objAAnalyser, estUnUserASSDorUserASSDMultiple)
+ # else : estUnUserASSDorUserASSDMultiple=False
+ # if debug : print ('estUnUserASSDorUserASSDMultiple', estUnUserASSDorUserASSDMultiple)
+
+ for obj in objAAnalyser:
+ if issubclass(
+ obj.__class__, self.cata.modeleMetier.AccasUserAssd
+ ) or issubclass(
+ obj.__class__, self.cata.modeleMetier.AccasUserAssdMultiple
+ ):
+ laClassePyxbUserAssd = obj.__class__
+ laListe.append(self.creeUserAssd(obj, laClassePyxbUserAssd))
+ elif issubclass(obj.__class__, self.cata.modeleMetier.AccasAssd):
+ laListe.append(self.g_context[str(obj)])
+ elif isinstance(obj, str):
+ laListe.append(str(obj))
+ elif isinstance(obj, int):
+ laListe.append(int(obj))
+ elif isinstance(obj, float):
+ laListe.append(float(obj))
+ elif isinstance(obj, pyxb.binding.basis.enumeration_mixin):
+ laListe.append(str(obj))
+ else:
+ laListe.append(obj)
+ return laListe
# if debug : print ('je suis Plural')
# ou ? return objAAnalyser
- #if isinstance(objAAnalyser, types.StringTypes): return pyxb.utils.utility.QuotedEscaped(objAAnalyser,)
- #pour une enum getattr(value dans le type)
+ # if isinstance(objAAnalyser, types.StringTypes): return pyxb.utils.utility.QuotedEscaped(objAAnalyser,)
+ # pour une enum getattr(value dans le type)
# return pythonLiteral(ReferenceFacet(facet=value, **kw))
- #print ('je suis un mot complexe')
+ # print ('je suis un mot complexe')
# traitement FACT ou BLOC
- # ------------------------
+ # ------------------------
# il faut traiter les fact multiples
objAAnalyser.dictPyxb = {}
- objAAnalyser.dictPyxb['objEnPyxb']=objAAnalyser
- #for expandedName, elementDeclaration in objAAnalyser._ElementMap.items():
+ objAAnalyser.dictPyxb["objEnPyxb"] = objAAnalyser
+ # for expandedName, elementDeclaration in objAAnalyser._ElementMap.items():
# objPyxbName = expandedName.localName()
# objPyxbValue = getattr(objAAnalyser, objPyxbName)
for objEltContentFils in objAAnalyser.orderedContent():
objPyxbValue = objEltContentFils.value
- objPyxbName = objEltContentFils.elementDeclaration.id()
+ objPyxbName = objEltContentFils.elementDeclaration.id()
elementDeclaration = objEltContentFils.elementDeclaration
- #if objPyxbValue == None or objPyxbValue == [] : continue
+ # if objPyxbValue == None or objPyxbValue == [] : continue
if elementDeclaration.isPlural():
- if objPyxbName not in list(dictArgs.keys()) : dictArgs[objPyxbName]=[]
- if objPyxbName not in list(objAAnalyser.dictPyxb.keys()) : objAAnalyser.dictPyxb[objPyxbName]=[]
+ # on est dans le cas d une liste de chaine avec des blancs
+ if debug:
+ print(objAAnalyser.dictPyxb)
+ if objPyxbName not in list(dictArgs.keys()):
+ dictArgs[objPyxbName] = []
+ if objPyxbName not in list(objAAnalyser.dictPyxb.keys()):
+ objAAnalyser.dictPyxb[objPyxbName] = []
dictArgs[objPyxbName].append(self.pyxbToDict(objPyxbValue))
objAAnalyser.dictPyxb[objPyxbName].append(objPyxbValue.dictPyxb)
else:
- dictArgs[objPyxbName] = self.pyxbToDict(getattr(objAAnalyser, objPyxbName))
+ dictArgs[objPyxbName] = self.pyxbToDict(
+ getattr(objAAnalyser, objPyxbName)
+ )
objAAnalyser.dictPyxb[objPyxbName] = objPyxbValue.dictPyxb
# print ('ajout dans dictPyxb', objPyxbName, objPyxbValue.dictPyxb)
- #print ('avec la valeur', 'de', objAAnalyser.dictPyxb[objPyxbName])
-
- #print ("***********************************")
- #print ('pyxbToDict fin pour ********** ', objAAnalyser)
- #print ('pyxbToDict ', objAAnalyser, objAAnalyser.dictPyxb)
- #print ('pyxbToDict fin pour ********** ', objAAnalyser)
- #print ("***********************************")
- #print (dictArgs)
- #print (dictPyxb)
- #for i in dictArgs.keys(): print (i, " ", dictArgs[i], " ", type(dictArgs[i]))
- #print ('fin pour ',objAAnalyser)
+ # print ('avec la valeur', 'de', objAAnalyser.dictPyxb[objPyxbName])
+ objPyxb = getattr(objAAnalyser, objPyxbName)
+ if hasattr(objPyxb, "listeDeStringAvecBlancs"):
+ if debug:
+ print(
+ "je change l argument en une liste de chaines avec blancs pour",
+ objPyxb,
+ )
+ # PNPN Est-ce qu on peut etre dans le if de ce isPlural ?
+ # Je ne pense pas parcequ en eficas une liste est un SIMP mais ?
+ dictArgs[objPyxbName] = objPyxb.listeDeStringAvecBlancs
+
+ # on traite ds if suivant les listes de chaines avec blanc
+ if objPyxbName == "s":
+ # Attention on transforme un dictionnaire en liste de valeur
+ # pour remonter la liste de chaine dans eficas comme un objet
+ listeDeStringAvecBlancs = objAAnalyser.dictPyxb[objPyxbName]
+ objAAnalyser.dictPyxb = listeDeStringAvecBlancs
+ objAAnalyser.listeDeStringAvecBlancs = listeDeStringAvecBlancs
+ if debug:
+ print("je cree listeDeStringAvecBlancs pour ", objAAnalyser)
+
+ # if objPyxbName == 'VariableProbabiliste' : print ('VariableProbabiliste', objAAnalyser.dictPyxb)
+ # if objPyxbName == 'MCPath' : print ('MCPath', objAAnalyser.dictPyxb)
+ if debug:
+ print("***********************************")
+ if debug:
+ print("pyxbToDict fin pour ********** ", objAAnalyser)
+ if debug:
+ print("pyxbToDict ", objAAnalyser, objAAnalyser.dictPyxb)
+ if debug:
+ print("pyxbToDict fin pour ********** ", objAAnalyser)
+ if debug:
+ print("***********************************")
+ # traitement des Matrices et des Tuples
+ # on change ce qu on retourne pour ne garder que la valeur de la matrice
+ if hasattr(objAAnalyser, "sdType") and objAAnalyser.sdType == "Matrice":
+ return dictArgs["line"]
+ # on estime que les elements du tuple sont nommes par ordre 1..., n
+ # ou par ordre alpha
+
+ if hasattr(objAAnalyser, "sdType") and objAAnalyser.sdType == "Tuple":
+ liste = []
+ listeKeys = list(dictArgs.keys())
+ listeKeys.sort()
+ for k in listeKeys:
+ liste.append(dictArgs[k])
+ return tuple(liste)
+ if debug:
+ print("fin pour ", objAAnalyser)
return dictArgs
- def creeUserAssd(self,objAAnalyser,laClassePyxbUserAssd,debug=True):
-
- enCreation=False
- if debug : print ('creeUserAssd ', objAAnalyser, ' ',laClassePyxbUserAssd)
- leTypeIntermediaire=laClassePyxbUserAssd.XsdSuperType()
- if debug : print ('leTypeIntermediaire ', leTypeIntermediaire)
- if debug : print ('leTypeIntermediaire ', leTypeIntermediaire.XsdSuperType())
- if leTypeIntermediaire.__name__[-2:]== '_C' : enCreation = True
- elif leTypeIntermediaire.__name__[-2:] != '_U' : print ('pb avec', laClassePyxbUserAssd); return None #exit()
- nomClasseAccasUserAssd=leTypeIntermediaire.XsdSuperType().__name__
- if debug : print ('nomClasseAccasUserAssd', nomClasseAccasUserAssd)
- laClasseAccas=getattr(self.cata,nomClasseAccasUserAssd)
- print (laClasseAccas)
- if not(enCreation):
- if str(objAAnalyser) in self.g_context.keys():return self.g_context[str(objAAnalyser)]
- else :
- obj=laClasseAccas()
- self.g_context[str(objAAnalyser)]=obj
+ def creeUserAssd(self, objAAnalyser, laClassePyxbUserAssd, debug=False):
+ enCreation = False
+ if debug:
+ print("creeUserAssd ", objAAnalyser, " ", laClassePyxbUserAssd)
+ leTypeIntermediaire = laClassePyxbUserAssd.XsdSuperType()
+ if debug:
+ print("leTypeIntermediaire ", leTypeIntermediaire)
+ if debug:
+ print("leTypeIntermediaire ", leTypeIntermediaire.XsdSuperType())
+ if leTypeIntermediaire.__name__[-2:] == "_C":
+ enCreation = True
+ elif leTypeIntermediaire.__name__[-2:] != "_U":
+ print("pb avec", laClassePyxbUserAssd)
+ return None # exit()
+ nomClasseAccasUserAssd = leTypeIntermediaire.XsdSuperType().__name__
+ if debug:
+ print("nomClasseAccasUserAssd", nomClasseAccasUserAssd)
+ laClasseAccas = getattr(self.cata, nomClasseAccasUserAssd)
+ if not (enCreation):
+ if str(objAAnalyser) in self.g_context.keys():
+ return self.g_context[str(objAAnalyser)]
+ else:
+ obj = laClasseAccas()
+ self.g_context[str(objAAnalyser)] = obj
return obj
if str(objAAnalyser) in self.g_context.keys():
- if isinstance(self.g_context[str(objAAnalyser)],laClasseAccas):
+ if isinstance(self.g_context[str(objAAnalyser)], laClasseAccas):
return self.g_context[str(objAAnalyser)]
- else :
- nvlObj=laClasseAccas()
- oldObj=self.g_context[str(objAAnalyser)]
+ else:
+ nvlObj = laClasseAccas()
+ oldObj = self.g_context[str(objAAnalyser)]
nvlObj.transfere(oldObj)
- self.g_context[str(objAAnalyser)]=nvlObj
+ self.g_context[str(objAAnalyser)] = nvlObj
return nvlObj
- else :
- obj=laClasseAccas()
- self.g_context[str(objAAnalyser)]=obj
+ else:
+ obj = laClasseAccas()
+ self.g_context[str(objAAnalyser)] = obj
return obj
+
# def analyseContent(self,objAAnalyser):
# objAAnalyser.dictArgs={}
# for objContenu in objAAnalyser.content():
# else :
# self.analyseContent(objContenu)
# objAAnalyser.dictArgs[objContenu.monNomClasseAccas]=objContenu.dictArgs
- #print ( '________________')
- #print (objAAnalyser.monNomClasseAccas)
- #for i in objAAnalyser.dictArgs : print (i, objAAnalyser.dictArgs[i])
- #print ( '________________')
-
+# print ( '________________')
+# print (objAAnalyser.monNomClasseAccas)
+# for i in objAAnalyser.dictArgs : print (i, objAAnalyser.dictArgs[i])
+# print ( '________________')
if __name__ == "__main__":
- print ('a faire')
+ print("a faire")
+++ /dev/null
-AccasXsd.py
- contient les classes qui font le lien entre les classes de definition Accas et les classes pyxb generees a partir du XSD genere a partir du catalogue
-
-balises.py
- contient les balises necessaires pour generer le xsd metier a partir du catalogue eficas (ou .py ou en .xsd)
-
-efficas.py
- contient le modele genere par pyxb a partir du XSD eficas
-
-mapDesTypes.py
- fait le lien bidirectionnel entre les types ACCAS et les types XSD
-
-MCAccasXsd.py
- contient les classes qui font le lien entre les classes objet Accas et les classes pyxb generees a partir du XSD genere a partir du catalogue
-
-readerEfiXsd.py
- contient les classes qui font le lien entre les classes de definition Accas et les classes pyxb generees a partir du modele eficas XSD
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XSD 1.1//EN" "XMLSchema.dtd" [
- <!-- provide ID type information even for parsers which only read the
- internal subset -->
- <!ATTLIST xs:schema
- id ID #IMPLIED
- >
- <!ATTLIST xs:complexType
- id ID #IMPLIED
- >
- <!ATTLIST xs:complexContent
- id ID #IMPLIED
- >
- <!ATTLIST xs:simpleContent
- id ID #IMPLIED
- >
- <!ATTLIST xs:extension
- id ID #IMPLIED
- >
- <!ATTLIST xs:element
- id ID #IMPLIED
- >
- <!ATTLIST xs:group
- id ID #IMPLIED
- >
- <!ATTLIST xs:all
- id ID #IMPLIED
- >
- <!ATTLIST xs:choice
- id ID #IMPLIED
- >
- <!ATTLIST xs:sequence
- id ID #IMPLIED
- >
- <!ATTLIST xs:any
- id ID #IMPLIED
- >
- <!ATTLIST xs:anyAttribute
- id ID #IMPLIED
- >
- <!ATTLIST xs:attribute
- id ID #IMPLIED
- >
- <!ATTLIST xs:attributeGroup
- id ID #IMPLIED
- >
- <!ATTLIST xs:unique
- id ID #IMPLIED
- >
- <!ATTLIST xs:key
- id ID #IMPLIED
- >
- <!ATTLIST xs:keyref
- id ID #IMPLIED
- >
- <!ATTLIST xs:selector
- id ID #IMPLIED
- >
- <!ATTLIST xs:field
- id ID #IMPLIED
- >
- <!ATTLIST xs:assert
- id ID #IMPLIED
- >
- <!ATTLIST xs:include
- id ID #IMPLIED
- >
- <!ATTLIST xs:import
- id ID #IMPLIED
- >
- <!ATTLIST xs:redefine
- id ID #IMPLIED
- >
- <!ATTLIST xs:override
- id ID #IMPLIED
- >
- <!ATTLIST xs:notation
- id ID #IMPLIED
- >
- <!--
- Make sure that processors that do not read the external
- subset will know about the various IDs we declare
- -->
- <!ATTLIST xs:simpleType
- id ID #IMPLIED
- >
- <!ATTLIST xs:maxExclusive
- id ID #IMPLIED
- >
- <!ATTLIST xs:minExclusive
- id ID #IMPLIED
- >
- <!ATTLIST xs:maxInclusive
- id ID #IMPLIED
- >
- <!ATTLIST xs:minInclusive
- id ID #IMPLIED
- >
- <!ATTLIST xs:totalDigits
- id ID #IMPLIED
- >
- <!ATTLIST xs:fractionDigits
- id ID #IMPLIED
- >
- <!ATTLIST xs:length
- id ID #IMPLIED
- >
- <!ATTLIST xs:minLength
- id ID #IMPLIED
- >
- <!ATTLIST xs:maxLength
- id ID #IMPLIED
- >
- <!ATTLIST xs:enumeration
- id ID #IMPLIED
- >
- <!ATTLIST xs:pattern
- id ID #IMPLIED
- >
- <!ATTLIST xs:assertion
- id ID #IMPLIED
- >
- <!ATTLIST xs:explicitTimezone
- id ID #IMPLIED
- >
- <!ATTLIST xs:appinfo
- id ID #IMPLIED
- >
- <!ATTLIST xs:documentation
- id ID #IMPLIED
- >
- <!ATTLIST xs:list
- id ID #IMPLIED
- >
- <!ATTLIST xs:union
- id ID #IMPLIED
- >
-]>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" targetNamespace="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="1.0" xml:lang="EN" vc:minVersion="1.1">
- <xs:annotation>
- <xs:documentation>
- Part 1 version: structures.xsd (rec-20120405)
- Part 2 version: datatypes.xsd (rec-20120405)
- </xs:documentation>
- </xs:annotation>
- <xs:annotation>
- <xs:documentation source="../structures/structures.html">
- The schema corresponding to this document is normative,
- with respect to the syntactic constraints it expresses in the
- XML Schema Definition Language. The documentation (within 'documentation' elements)
- below, is not normative, but rather highlights important aspects of
- the W3C Recommendation of which this is a part.
-
- See below (at the bottom of this document) for information about
- the revision and namespace-versioning policy governing this
- schema document.
-
- </xs:documentation>
- </xs:annotation>
- <xs:annotation>
- <xs:documentation>
- The simpleType element and all of its members are defined
- towards the end of this schema document.</xs:documentation>
- </xs:annotation>
- <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
- <xs:annotation>
- <xs:documentation>
- Get access to the xml: attribute groups for xml:lang
- as declared on 'schema' and 'documentation' below
- </xs:documentation>
- </xs:annotation>
- </xs:import>
- <xs:complexType name="openAttrs">
- <xs:annotation>
- <xs:documentation>
- This type is extended by almost all schema types
- to allow attributes from other namespaces to be
- added to user schemas.
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:anyType">
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="annotated">
- <xs:annotation>
- <xs:documentation>
- This type is extended by all types which allow annotation
- other than <schema> itself
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:group name="composition">
- <xs:choice>
- <xs:element ref="xs:include"/>
- <xs:element ref="xs:import"/>
- <xs:element ref="xs:redefine"/>
- <xs:element ref="xs:override"/>
- <xs:element ref="xs:annotation"/>
- </xs:choice>
- </xs:group>
- <xs:group name="schemaTop">
- <xs:annotation>
- <xs:documentation>
- This group is for the
- elements which occur freely at the top level of schemas.
- All of their types are based on the "annotated" type by extension.</xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:group ref="xs:redefinable"/>
- <xs:element ref="xs:element"/>
- <xs:element ref="xs:attribute"/>
- <xs:element ref="xs:notation"/>
- </xs:choice>
- </xs:group>
- <xs:group name="redefinable">
- <xs:annotation>
- <xs:documentation>
- This group is for the
- elements which can self-redefine (see <redefine> below).</xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element ref="xs:simpleType"/>
- <xs:element ref="xs:complexType"/>
- <xs:element ref="xs:group"/>
- <xs:element ref="xs:attributeGroup"/>
- </xs:choice>
- </xs:group>
- <xs:simpleType name="formChoice">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="qualified"/>
- <xs:enumeration value="unqualified"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="reducedDerivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="derivationSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list itemType="xs:reducedDerivationControl"/>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- <xs:simpleType name="typeDerivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="fullDerivationSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list itemType="xs:typeDerivationControl"/>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- <xs:element name="schema" id="schema">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-schema"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:sequence>
- <xs:group ref="xs:composition" minOccurs="0" maxOccurs="unbounded"/>
- <xs:sequence minOccurs="0">
- <xs:element ref="xs:defaultOpenContent"/>
- <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="xs:schemaTop"/>
- <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:sequence>
- <xs:attribute name="targetNamespace" type="xs:anyURI"/>
- <xs:attribute name="version" type="xs:token"/>
- <xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
- <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
- <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
- <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
- <xs:attribute name="defaultAttributes" type="xs:QName"/>
- <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace" use="optional" default="##local"/>
- <xs:attribute name="id" type="xs:ID"/>
- <xs:attribute ref="xml:lang"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:key name="element">
- <xs:selector xpath="xs:element"/>
- <xs:field xpath="@name"/>
- </xs:key>
- <xs:key name="attribute">
- <xs:selector xpath="xs:attribute"/>
- <xs:field xpath="@name"/>
- </xs:key>
- <xs:key name="type">
- <xs:selector xpath="xs:complexType|xs:simpleType"/>
- <xs:field xpath="@name"/>
- </xs:key>
- <xs:key name="group">
- <xs:selector xpath="xs:group"/>
- <xs:field xpath="@name"/>
- </xs:key>
- <xs:key name="attributeGroup">
- <xs:selector xpath="xs:attributeGroup"/>
- <xs:field xpath="@name"/>
- </xs:key>
- <xs:key name="notation">
- <xs:selector xpath="xs:notation"/>
- <xs:field xpath="@name"/>
- </xs:key>
- <xs:key name="identityConstraint">
- <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
- <xs:field xpath="@name"/>
- </xs:key>
- </xs:element>
- <xs:simpleType name="allNNI">
- <xs:annotation>
- <xs:documentation>
- for maxOccurs</xs:documentation>
- </xs:annotation>
- <xs:union memberTypes="xs:nonNegativeInteger">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="unbounded"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- <xs:attributeGroup name="occurs">
- <xs:annotation>
- <xs:documentation>
- for all particles</xs:documentation>
- </xs:annotation>
- <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
- <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="defRef">
- <xs:annotation>
- <xs:documentation>
- for element, group and attributeGroup,
- which both define and reference</xs:documentation>
- </xs:annotation>
- <xs:attribute name="name" type="xs:NCName"/>
- <xs:attribute name="ref" type="xs:QName"/>
- </xs:attributeGroup>
- <xs:group name="typeDefParticle">
- <xs:annotation>
- <xs:documentation>
- 'complexType' uses this</xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- </xs:choice>
- </xs:group>
- <xs:group name="nestedParticle">
- <xs:choice>
- <xs:element name="element" type="xs:localElement"/>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- <xs:element ref="xs:any"/>
- </xs:choice>
- </xs:group>
- <xs:group name="particle">
- <xs:choice>
- <xs:element name="element" type="xs:localElement"/>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- <xs:element ref="xs:any"/>
- </xs:choice>
- </xs:group>
- <xs:complexType name="attribute">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
- </xs:sequence>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attribute name="type" type="xs:QName"/>
- <xs:attribute name="use" use="optional" default="optional">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="prohibited"/>
- <xs:enumeration value="optional"/>
- <xs:enumeration value="required"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="default" type="xs:string"/>
- <xs:attribute name="fixed" type="xs:string"/>
- <xs:attribute name="form" type="xs:formChoice"/>
- <xs:attribute name="targetNamespace" type="xs:anyURI"/>
- <xs:attribute name="inheritable" type="xs:boolean"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="topLevelAttribute">
- <xs:complexContent>
- <xs:restriction base="xs:attribute">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="form" use="prohibited"/>
- <xs:attribute name="use" use="prohibited"/>
- <xs:attribute name="targetNamespace" use="prohibited"/>
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:attribute name="inheritable" type="xs:boolean"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:group name="attrDecls">
- <xs:sequence>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="attribute" type="xs:attribute"/>
- <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
- </xs:choice>
- <xs:element ref="xs:anyAttribute" minOccurs="0"/>
- </xs:sequence>
- </xs:group>
- <xs:element name="anyAttribute" id="anyAttribute">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-anyAttribute"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:wildcard">
- <xs:attribute name="notQName" type="xs:qnameListA" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:group name="assertions">
- <xs:sequence>
- <xs:element name="assert" type="xs:assertion" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:group>
- <xs:complexType name="assertion">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="test" type="xs:string"/>
- <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:group name="complexTypeModel">
- <xs:choice>
- <xs:element ref="xs:simpleContent"/>
- <xs:element ref="xs:complexContent"/>
- <xs:sequence>
- <xs:annotation>
- <xs:documentation>
- This branch is short for
- <complexContent>
- <restriction base="xs:anyType">
- ...
- </restriction>
- </complexContent></xs:documentation>
- </xs:annotation>
- <xs:element ref="xs:openContent" minOccurs="0"/>
- <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- <xs:group ref="xs:assertions"/>
- </xs:sequence>
- </xs:choice>
- </xs:group>
- <xs:complexType name="complexType" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:complexTypeModel"/>
- <xs:attribute name="name" type="xs:NCName">
- <xs:annotation>
- <xs:documentation>
- Will be restricted to required or prohibited</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="mixed" type="xs:boolean" use="optional">
- <xs:annotation>
- <xs:documentation>
- Not allowed if simpleContent child is chosen.
- May be overridden by setting on complexContent child.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="final" type="xs:derivationSet"/>
- <xs:attribute name="block" type="xs:derivationSet"/>
- <xs:attribute name="defaultAttributesApply" type="xs:boolean" use="optional" default="true"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="topLevelComplexType">
- <xs:complexContent>
- <xs:restriction base="xs:complexType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:complexTypeModel"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="localComplexType">
- <xs:complexContent>
- <xs:restriction base="xs:complexType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:complexTypeModel"/>
- </xs:sequence>
- <xs:attribute name="name" use="prohibited"/>
- <xs:attribute name="abstract" use="prohibited"/>
- <xs:attribute name="final" use="prohibited"/>
- <xs:attribute name="block" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="restrictionType">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:choice minOccurs="0">
- <xs:sequence>
- <xs:element ref="xs:openContent" minOccurs="0"/>
- <xs:group ref="xs:typeDefParticle"/>
- </xs:sequence>
- <xs:group ref="xs:simpleRestrictionModel"/>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- <xs:group ref="xs:assertions"/>
- </xs:sequence>
- <xs:attribute name="base" type="xs:QName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="complexRestrictionType">
- <xs:complexContent>
- <xs:restriction base="xs:restrictionType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:annotation>
- <xs:documentation>This choice is added simply to
- make this a valid restriction per the REC</xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element ref="xs:openContent" minOccurs="0"/>
- <xs:group ref="xs:typeDefParticle"/>
- </xs:sequence>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- <xs:group ref="xs:assertions"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="extensionType">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element ref="xs:openContent" minOccurs="0"/>
- <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- <xs:group ref="xs:assertions"/>
- </xs:sequence>
- <xs:attribute name="base" type="xs:QName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="complexContent" id="complexContent">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-complexContent"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:choice>
- <xs:element name="restriction" type="xs:complexRestrictionType"/>
- <xs:element name="extension" type="xs:extensionType"/>
- </xs:choice>
- <xs:attribute name="mixed" type="xs:boolean">
- <xs:annotation>
- <xs:documentation>
- Overrides any setting on complexType parent.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="openContent" id="openContent">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-openContent"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="any" type="xs:wildcard" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="mode" use="optional" default="interleave">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="none"/>
- <xs:enumeration value="interleave"/>
- <xs:enumeration value="suffix"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="defaultOpenContent" id="defaultOpenContent">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-defaultOpenContent"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="any" type="xs:wildcard"/>
- </xs:sequence>
- <xs:attribute name="appliesToEmpty" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="mode" use="optional" default="interleave">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="interleave"/>
- <xs:enumeration value="suffix"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:complexType name="simpleRestrictionType">
- <xs:complexContent>
- <xs:restriction base="xs:restrictionType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:annotation>
- <xs:documentation>This choice is added simply to
- make this a valid restriction per the REC</xs:documentation>
- </xs:annotation>
- <xs:group ref="xs:simpleRestrictionModel"/>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- <xs:group ref="xs:assertions"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="simpleExtensionType">
- <xs:complexContent>
- <xs:restriction base="xs:extensionType">
- <xs:sequence>
- <xs:annotation>
- <xs:documentation>
- No typeDefParticle group reference</xs:documentation>
- </xs:annotation>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- <xs:group ref="xs:assertions"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="simpleContent" id="simpleContent">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-simpleContent"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:choice>
- <xs:element name="restriction" type="xs:simpleRestrictionType"/>
- <xs:element name="extension" type="xs:simpleExtensionType"/>
- </xs:choice>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-complexType"/>
- </xs:annotation>
- </xs:element>
- <xs:simpleType name="blockSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {substitution, extension,
- restriction}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list>
- <xs:simpleType>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="substitution"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- <xs:complexType name="element" abstract="true">
- <xs:annotation>
- <xs:documentation>
- The element element can be used either
- at the top level to define an element-type binding globally,
- or within a content model to either reference a globally-defined
- element or type or declare an element-type binding locally.
- The ref form is not allowed at the top level.</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:element name="alternative" type="xs:altType" minOccurs="0" maxOccurs="unbounded"/>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attribute name="type" type="xs:QName"/>
- <xs:attribute name="substitutionGroup">
- <xs:simpleType>
- <xs:list itemType="xs:QName"/>
- </xs:simpleType>
- </xs:attribute>
- <xs:attributeGroup ref="xs:occurs"/>
- <xs:attribute name="default" type="xs:string"/>
- <xs:attribute name="fixed" type="xs:string"/>
- <xs:attribute name="nillable" type="xs:boolean" use="optional"/>
- <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="final" type="xs:derivationSet"/>
- <xs:attribute name="block" type="xs:blockSet"/>
- <xs:attribute name="form" type="xs:formChoice"/>
- <xs:attribute name="targetNamespace" type="xs:anyURI"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="topLevelElement">
- <xs:complexContent>
- <xs:restriction base="xs:element">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:element name="alternative" type="xs:altType" minOccurs="0" maxOccurs="unbounded"/>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="form" use="prohibited"/>
- <xs:attribute name="targetNamespace" use="prohibited"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="localElement">
- <xs:complexContent>
- <xs:restriction base="xs:element">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:element name="alternative" type="xs:altType" minOccurs="0" maxOccurs="unbounded"/>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="substitutionGroup" use="prohibited"/>
- <xs:attribute name="final" use="prohibited"/>
- <xs:attribute name="abstract" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="element" type="xs:topLevelElement" id="element">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-element"/>
- </xs:annotation>
- </xs:element>
- <xs:complexType name="altType">
- <xs:annotation>
- <xs:documentation>
- This type is used for 'alternative' elements.
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:attribute name="test" type="xs:string" use="optional"/>
- <xs:attribute name="type" type="xs:QName" use="optional"/>
- <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="group" abstract="true">
- <xs:annotation>
- <xs:documentation>
- group type for explicit groups, named top-level groups and
- group references</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attributeGroup ref="xs:occurs"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="realGroup">
- <xs:complexContent>
- <xs:restriction base="xs:group">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0" maxOccurs="1">
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- </xs:choice>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="namedGroup">
- <xs:complexContent>
- <xs:restriction base="xs:realGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="1" maxOccurs="1">
- <xs:element name="all">
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:all">
- <xs:group ref="xs:allModel"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="choice" type="xs:simpleExplicitGroup"/>
- <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="groupRef">
- <xs:complexContent>
- <xs:restriction base="xs:realGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="ref" type="xs:QName" use="required"/>
- <xs:attribute name="name" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="explicitGroup">
- <xs:annotation>
- <xs:documentation>
- group type for the three kinds of group</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:group">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="name" use="prohibited"/>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="simpleExplicitGroup">
- <xs:complexContent>
- <xs:restriction base="xs:explicitGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:group name="allModel">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:annotation>
- <xs:documentation>This choice with min/max is here to
- avoid a pblm with the Elt:All/Choice/Seq
- Particle derivation constraint</xs:documentation>
- </xs:annotation>
- <xs:element name="element" type="xs:localElement"/>
- <xs:element ref="xs:any"/>
- <xs:element name="group">
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:groupRef">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" fixed="1"/>
- <xs:attribute name="maxOccurs" type="xs:nonNegativeInteger" fixed="1"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- </xs:choice>
- </xs:sequence>
- </xs:group>
- <xs:complexType name="all">
- <xs:annotation>
- <xs:documentation>
- Only elements allowed inside</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:explicitGroup">
- <xs:group ref="xs:allModel"/>
- <xs:attribute name="minOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:enumeration value="0"/>
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="maxOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:allNNI">
- <xs:enumeration value="0"/>
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="all" type="xs:all" id="all">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-all"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="choice" type="xs:explicitGroup" id="choice">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-choice"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-sequence"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="group" type="xs:namedGroup" id="group">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-group"/>
- </xs:annotation>
- </xs:element>
- <xs:attributeGroup name="anyAttrGroup">
- <xs:attribute name="namespace" type="xs:namespaceList" use="optional"/>
- <xs:attribute name="notNamespace" use="optional">
- <xs:simpleType>
- <xs:restriction base="xs:basicNamespaceList">
- <xs:minLength value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="processContents" use="optional" default="strict">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="skip"/>
- <xs:enumeration value="lax"/>
- <xs:enumeration value="strict"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:attributeGroup>
- <xs:complexType name="wildcard">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attributeGroup ref="xs:anyAttrGroup"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="any" id="any">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-any"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:wildcard">
- <xs:attribute name="notQName" type="xs:qnameList" use="optional"/>
- <xs:attributeGroup ref="xs:occurs"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:annotation>
- <xs:documentation>
- simple type for the value of the 'namespace' attr of
- 'any' and 'anyAttribute'</xs:documentation>
- </xs:annotation>
- <xs:annotation>
- <xs:documentation>
- Value is
- ##any - - any non-conflicting WFXML/attribute at all
-
- ##other - - any non-conflicting WFXML/attribute from
- namespace other than targetNS
-
- ##local - - any unqualified non-conflicting WFXML/attribute
-
- one or - - any non-conflicting WFXML/attribute from
- more URI the listed namespaces
- references
- (space separated)
-
- ##targetNamespace or ##local may appear in the above list, to
- refer to the targetNamespace of the enclosing
- schema or an absent targetNamespace respectively</xs:documentation>
- </xs:annotation>
- <xs:simpleType name="namespaceList">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:union memberTypes="xs:specialNamespaceList xs:basicNamespaceList"/>
- </xs:simpleType>
- <xs:simpleType name="basicNamespaceList">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:list>
- <xs:simpleType>
- <xs:union memberTypes="xs:anyURI">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="##targetNamespace"/>
- <xs:enumeration value="##local"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- <xs:simpleType name="specialNamespaceList">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:enumeration value="##any"/>
- <xs:enumeration value="##other"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="qnameList">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use
- </xs:documentation>
- </xs:annotation>
- <xs:list>
- <xs:simpleType>
- <xs:union memberTypes="xs:QName">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="##defined"/>
- <xs:enumeration value="##definedSibling"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- <xs:simpleType name="qnameListA">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use
- </xs:documentation>
- </xs:annotation>
- <xs:list>
- <xs:simpleType>
- <xs:union memberTypes="xs:QName">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="##defined"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- <xs:simpleType name="xpathDefaultNamespace">
- <xs:union memberTypes="xs:anyURI">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="##defaultNamespace"/>
- <xs:enumeration value="##targetNamespace"/>
- <xs:enumeration value="##local"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-attribute"/>
- </xs:annotation>
- </xs:element>
- <xs:complexType name="attributeGroup" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:attrDecls"/>
- <xs:attributeGroup ref="xs:defRef"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="namedAttributeGroup">
- <xs:complexContent>
- <xs:restriction base="xs:attributeGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="attributeGroupRef">
- <xs:complexContent>
- <xs:restriction base="xs:attributeGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="ref" type="xs:QName" use="required"/>
- <xs:attribute name="name" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-attributeGroup"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="include" id="include">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-include"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="redefine" id="redefine">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-redefine"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:annotation"/>
- <xs:group ref="xs:redefinable"/>
- </xs:choice>
- <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="override" id="override">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-override"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:schemaTop" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="import" id="import">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-import"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="namespace" type="xs:anyURI"/>
- <xs:attribute name="schemaLocation" type="xs:anyURI"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="selector" id="selector">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-selector"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="xpath" use="required">
- <xs:simpleType>
- <xs:annotation>
- <xs:documentation>A subset of XPath expressions for use
-in selectors</xs:documentation>
- <xs:documentation>A utility type, not for public
-use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token"/>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="field" id="field">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-field"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="xpath" use="required">
- <xs:simpleType>
- <xs:annotation>
- <xs:documentation>A subset of XPath expressions for use
-in fields</xs:documentation>
- <xs:documentation>A utility type, not for public
-use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token"/>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:complexType name="keybase">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence minOccurs="0">
- <xs:element ref="xs:selector"/>
- <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName"/>
- <xs:attribute name="ref" type="xs:QName"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:group name="identityConstraint">
- <xs:annotation>
- <xs:documentation>The three kinds of identity constraints, all with
- type of or derived from 'keybase'.
- </xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element ref="xs:unique"/>
- <xs:element ref="xs:key"/>
- <xs:element ref="xs:keyref"/>
- </xs:choice>
- </xs:group>
- <xs:element name="unique" type="xs:keybase" id="unique">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-unique"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="key" type="xs:keybase" id="key">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-key"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="keyref" id="keyref">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-keyref"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:keybase">
- <xs:attribute name="refer" type="xs:QName"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="notation" id="notation">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-notation"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:attribute name="public" type="xs:public"/>
- <xs:attribute name="system" type="xs:anyURI"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:simpleType name="public">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- A public identifier, per ISO 8879</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token"/>
- </xs:simpleType>
- <xs:element name="appinfo" id="appinfo">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-appinfo"/>
- </xs:annotation>
- <xs:complexType mixed="true">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:any processContents="lax"/>
- </xs:sequence>
- <xs:attribute name="source" type="xs:anyURI"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="documentation" id="documentation">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-documentation"/>
- </xs:annotation>
- <xs:complexType mixed="true">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:any processContents="lax"/>
- </xs:sequence>
- <xs:attribute name="source" type="xs:anyURI"/>
- <xs:attribute ref="xml:lang"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="annotation" id="annotation">
- <xs:annotation>
- <xs:documentation source="../structures/structures.html#element-annotation"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:appinfo"/>
- <xs:element ref="xs:documentation"/>
- </xs:choice>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:annotation>
- <xs:documentation>
- notations for use within schema documents</xs:documentation>
- </xs:annotation>
- <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
- <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
- <xs:complexType name="anyType" mixed="true">
- <xs:annotation>
- <xs:documentation>
- Not the real urType, but as close an approximation as we can
- get in the XML representation</xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:anyAttribute processContents="lax"/>
- </xs:complexType>
- <xs:annotation>
- <xs:documentation>
- In keeping with the XML Schema WG's standard versioning policy,
- the material in this schema document will persist at the URI
- http://www.w3.org/2012/04/XMLSchema.xsd.
-
- At the date of issue it can also be found at the URI
- http://www.w3.org/2009/XMLSchema/XMLSchema.xsd.
-
- The schema document at that URI may however change in the future,
- in order to remain compatible with the latest version of XSD
- and its namespace. In other words, if XSD or the XML Schema
- namespace change, the version of this document at
- http://www.w3.org/2009/XMLSchema/XMLSchema.xsd will change accordingly;
- the version at http://www.w3.org/2012/04/XMLSchema.xsd will not change.
-
- Previous dated (and unchanging) versions of this schema document
- include:
-
- http://www.w3.org/2012/01/XMLSchema.xsd
- (XSD 1.1 Proposed Recommendation)
-
- http://www.w3.org/2011/07/XMLSchema.xsd
- (XSD 1.1 Candidate Recommendation)
-
- http://www.w3.org/2009/04/XMLSchema.xsd
- (XSD 1.1 Candidate Recommendation)
-
- http://www.w3.org/2004/10/XMLSchema.xsd
- (XSD 1.0 Recommendation, Second Edition)
-
- http://www.w3.org/2001/05/XMLSchema.xsd
- (XSD 1.0 Recommendation, First Edition)
-
-
- </xs:documentation>
- </xs:annotation>
- <xs:simpleType name="derivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="substitution"/>
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:group name="simpleDerivation">
- <xs:choice>
- <xs:element ref="xs:restriction"/>
- <xs:element ref="xs:list"/>
- <xs:element ref="xs:union"/>
- </xs:choice>
- </xs:group>
- <xs:simpleType name="simpleDerivationSet">
- <xs:annotation>
- <xs:documentation>
- #all or (possibly empty) subset of {restriction, extension, union, list}
- </xs:documentation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list>
- <xs:simpleType>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="extension"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- <xs:complexType name="simpleType" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:simpleDerivation"/>
- <xs:attribute name="final" type="xs:simpleDerivationSet"/>
- <xs:attribute name="name" type="xs:NCName">
- <xs:annotation>
- <xs:documentation>
- Can be restricted to required or forbidden
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="topLevelSimpleType">
- <xs:complexContent>
- <xs:restriction base="xs:simpleType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:simpleDerivation"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="required">
- <xs:annotation>
- <xs:documentation>
- Required at the top level
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="localSimpleType">
- <xs:complexContent>
- <xs:restriction base="xs:simpleType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:simpleDerivation"/>
- </xs:sequence>
- <xs:attribute name="name" use="prohibited">
- <xs:annotation>
- <xs:documentation>
- Forbidden when nested
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="final" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-simpleType"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="facet" abstract="true">
- <xs:annotation>
- <xs:documentation>
- An abstract element, representing facets in general.
- The facets defined by this spec are substitutable for
- this element, and implementation-defined facets should
- also name this as a substitution-group head.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:group name="simpleRestrictionModel">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:facet"/>
- <xs:any namespace="##other" processContents="lax"/>
- </xs:choice>
- </xs:sequence>
- </xs:group>
- <xs:element name="restriction" id="restriction">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-restriction">
- base attribute and simpleType child are mutually
- exclusive, but one or other is required
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:simpleRestrictionModel"/>
- <xs:attribute name="base" type="xs:QName" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="list" id="list">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-list">
- itemType attribute and simpleType child are mutually
- exclusive, but one or other is required
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="itemType" type="xs:QName" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="union" id="union">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-union">
- memberTypes attribute must be non-empty or there must be
- at least one simpleType child
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="memberTypes" use="optional">
- <xs:simpleType>
- <xs:list itemType="xs:QName"/>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:complexType name="facet">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="value" use="required"/>
- <xs:attribute name="fixed" type="xs:boolean" use="optional" default="false"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="noFixedFacet">
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="fixed" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="minExclusive" type="xs:facet" substitutionGroup="xs:facet" id="minExclusive">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-minExclusive"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="minInclusive" type="xs:facet" substitutionGroup="xs:facet" id="minInclusive">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-minInclusive"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="maxExclusive" type="xs:facet" substitutionGroup="xs:facet" id="maxExclusive">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-maxExclusive"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="maxInclusive" type="xs:facet" substitutionGroup="xs:facet" id="maxInclusive">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-maxInclusive"/>
- </xs:annotation>
- </xs:element>
- <xs:complexType name="numFacet">
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:complexType name="intFacet">
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:integer" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="totalDigits" substitutionGroup="xs:facet" id="totalDigits">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-totalDigits"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:numFacet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="fractionDigits" type="xs:numFacet" substitutionGroup="xs:facet" id="fractionDigits">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-fractionDigits"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="length" type="xs:numFacet" substitutionGroup="xs:facet" id="length">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-length"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="minLength" type="xs:numFacet" substitutionGroup="xs:facet" id="minLength">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-minLength"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="maxLength" type="xs:numFacet" substitutionGroup="xs:facet" id="maxLength">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-maxLength"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="enumeration" type="xs:noFixedFacet" substitutionGroup="xs:facet" id="enumeration">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-enumeration"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="whiteSpace" substitutionGroup="xs:facet" id="whiteSpace">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-whiteSpace"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="preserve"/>
- <xs:enumeration value="replace"/>
- <xs:enumeration value="collapse"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="pattern" substitutionGroup="xs:facet" id="pattern">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-pattern"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:noFixedFacet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:string" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="assertion" type="xs:assertion" substitutionGroup="xs:facet" id="assertion">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-assertion"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="explicitTimezone" substitutionGroup="xs:facet" id="explicitTimezone">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-explicitTimezone"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="optional"/>
- <xs:enumeration value="required"/>
- <xs:enumeration value="prohibited"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:annotation>
- <xs:documentation>
- In keeping with the XML Schema WG's standard versioning policy,
- this schema document will persist at the URI
- http://www.w3.org/2012/04/datatypes.xsd.
-
- At the date of issue it can also be found at the URI
- http://www.w3.org/2009/XMLSchema/datatypes.xsd.
-
- The schema document at that URI may however change in the future,
- in order to remain compatible with the latest version of XSD
- and its namespace. In other words, if XSD or the XML Schema
- namespace change, the version of this document at
- http://www.w3.org/2009/XMLSchema/datatypes.xsd will change accordingly;
- the version at http://www.w3.org/2012/04/datatypes.xsd will not change.
-
- Previous dated (and unchanging) versions of this schema document
- include:
-
- http://www.w3.org/2012/01/datatypes.xsd
- (XSD 1.1 Proposed Recommendation)
-
- http://www.w3.org/2011/07/datatypes.xsd
- (XSD 1.1 Candidate Recommendation)
-
- http://www.w3.org/2009/04/datatypes.xsd
- (XSD 1.1 Candidate Recommendation)
-
- http://www.w3.org/2004/10/datatypes.xsd
- (XSD 1.0 Recommendation, Second Edition)
-
- http://www.w3.org/2001/05/datatypes.xsd
- (XSD 1.0 Recommendation, First Edition)
-
- </xs:documentation>
- </xs:annotation>
-</xs:schema>
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XSD 1.1//EN" "XMLSchema.dtd" [
+ <!-- provide ID type information even for parsers which only read the
+ internal subset -->
+ <!ATTLIST xs:schema
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:complexType
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:complexContent
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:simpleContent
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:extension
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:element
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:group
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:all
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:choice
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:sequence
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:any
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:anyAttribute
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:attribute
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:attributeGroup
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:unique
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:key
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:keyref
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:selector
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:field
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:assert
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:include
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:import
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:redefine
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:override
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:notation
+ id ID #IMPLIED
+ >
+ <!--
+ Make sure that processors that do not read the external
+ subset will know about the various IDs we declare
+ -->
+ <!ATTLIST xs:simpleType
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:maxExclusive
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:minExclusive
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:maxInclusive
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:minInclusive
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:totalDigits
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:fractionDigits
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:length
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:minLength
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:maxLength
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:enumeration
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:pattern
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:assertion
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:explicitTimezone
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:appinfo
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:documentation
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:list
+ id ID #IMPLIED
+ >
+ <!ATTLIST xs:union
+ id ID #IMPLIED
+ >
+]>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" targetNamespace="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="1.0" xml:lang="EN" vc:minVersion="1.1">
+ <xs:annotation>
+ <xs:documentation>
+ Part 1 version: structures.xsd (rec-20120405)
+ Part 2 version: datatypes.xsd (rec-20120405)
+ </xs:documentation>
+ </xs:annotation>
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html">
+ The schema corresponding to this document is normative,
+ with respect to the syntactic constraints it expresses in the
+ XML Schema Definition Language. The documentation (within 'documentation' elements)
+ below, is not normative, but rather highlights important aspects of
+ the W3C Recommendation of which this is a part.
+
+ See below (at the bottom of this document) for information about
+ the revision and namespace-versioning policy governing this
+ schema document.
+
+ </xs:documentation>
+ </xs:annotation>
+ <xs:annotation>
+ <xs:documentation>
+ The simpleType element and all of its members are defined
+ towards the end of this schema document.</xs:documentation>
+ </xs:annotation>
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
+ <xs:annotation>
+ <xs:documentation>
+ Get access to the xml: attribute groups for xml:lang
+ as declared on 'schema' and 'documentation' below
+ </xs:documentation>
+ </xs:annotation>
+ </xs:import>
+ <xs:complexType name="openAttrs">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by almost all schema types
+ to allow attributes from other namespaces to be
+ added to user schemas.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="annotated">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by all types which allow annotation
+ other than <schema> itself
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:group name="composition">
+ <xs:choice>
+ <xs:element ref="xs:include"/>
+ <xs:element ref="xs:import"/>
+ <xs:element ref="xs:redefine"/>
+ <xs:element ref="xs:override"/>
+ <xs:element ref="xs:annotation"/>
+ </xs:choice>
+ </xs:group>
+ <xs:group name="schemaTop">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which occur freely at the top level of schemas.
+ All of their types are based on the "annotated" type by extension.</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:group ref="xs:redefinable"/>
+ <xs:element ref="xs:element"/>
+ <xs:element ref="xs:attribute"/>
+ <xs:element ref="xs:notation"/>
+ </xs:choice>
+ </xs:group>
+ <xs:group name="redefinable">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which can self-redefine (see <redefine> below).</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:simpleType"/>
+ <xs:element ref="xs:complexType"/>
+ <xs:element ref="xs:group"/>
+ <xs:element ref="xs:attributeGroup"/>
+ </xs:choice>
+ </xs:group>
+ <xs:simpleType name="formChoice">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="qualified"/>
+ <xs:enumeration value="unqualified"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="reducedDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="derivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:reducedDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ <xs:simpleType name="typeDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="fullDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:typeDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ <xs:element name="schema" id="schema">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-schema"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:group ref="xs:composition" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:sequence minOccurs="0">
+ <xs:element ref="xs:defaultOpenContent"/>
+ <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="xs:schemaTop"/>
+ <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:sequence>
+ <xs:attribute name="targetNamespace" type="xs:anyURI"/>
+ <xs:attribute name="version" type="xs:token"/>
+ <xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
+ <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
+ <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="defaultAttributes" type="xs:QName"/>
+ <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace" use="optional" default="##local"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute ref="xml:lang"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:key name="element">
+ <xs:selector xpath="xs:element"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+ <xs:key name="attribute">
+ <xs:selector xpath="xs:attribute"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+ <xs:key name="type">
+ <xs:selector xpath="xs:complexType|xs:simpleType"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+ <xs:key name="group">
+ <xs:selector xpath="xs:group"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+ <xs:key name="attributeGroup">
+ <xs:selector xpath="xs:attributeGroup"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+ <xs:key name="notation">
+ <xs:selector xpath="xs:notation"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+ <xs:key name="identityConstraint">
+ <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+ </xs:element>
+ <xs:simpleType name="allNNI">
+ <xs:annotation>
+ <xs:documentation>
+ for maxOccurs</xs:documentation>
+ </xs:annotation>
+ <xs:union memberTypes="xs:nonNegativeInteger">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="unbounded"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ <xs:attributeGroup name="occurs">
+ <xs:annotation>
+ <xs:documentation>
+ for all particles</xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
+ <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
+ </xs:attributeGroup>
+ <xs:attributeGroup name="defRef">
+ <xs:annotation>
+ <xs:documentation>
+ for element, group and attributeGroup,
+ which both define and reference</xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="name" type="xs:NCName"/>
+ <xs:attribute name="ref" type="xs:QName"/>
+ </xs:attributeGroup>
+ <xs:group name="typeDefParticle">
+ <xs:annotation>
+ <xs:documentation>
+ 'complexType' uses this</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:group>
+ <xs:group name="nestedParticle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+ <xs:group name="particle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+ <xs:complexType name="attribute">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="use" use="optional" default="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="prohibited"/>
+ <xs:enumeration value="optional"/>
+ <xs:enumeration value="required"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ <xs:attribute name="targetNamespace" type="xs:anyURI"/>
+ <xs:attribute name="inheritable" type="xs:boolean"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="topLevelAttribute">
+ <xs:complexContent>
+ <xs:restriction base="xs:attribute">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="use" use="prohibited"/>
+ <xs:attribute name="targetNamespace" use="prohibited"/>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:attribute name="inheritable" type="xs:boolean"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:group name="attrDecls">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="attribute" type="xs:attribute"/>
+ <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
+ </xs:choice>
+ <xs:element ref="xs:anyAttribute" minOccurs="0"/>
+ </xs:sequence>
+ </xs:group>
+ <xs:element name="anyAttribute" id="anyAttribute">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-anyAttribute"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:wildcard">
+ <xs:attribute name="notQName" type="xs:qnameListA" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:group name="assertions">
+ <xs:sequence>
+ <xs:element name="assert" type="xs:assertion" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:group>
+ <xs:complexType name="assertion">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="test" type="xs:string"/>
+ <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:group name="complexTypeModel">
+ <xs:choice>
+ <xs:element ref="xs:simpleContent"/>
+ <xs:element ref="xs:complexContent"/>
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ This branch is short for
+ <complexContent>
+ <restriction base="xs:anyType">
+ ...
+ </restriction>
+ </complexContent></xs:documentation>
+ </xs:annotation>
+ <xs:element ref="xs:openContent" minOccurs="0"/>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ <xs:group ref="xs:assertions"/>
+ </xs:sequence>
+ </xs:choice>
+ </xs:group>
+ <xs:complexType name="complexType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:complexTypeModel"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Will be restricted to required or prohibited</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="mixed" type="xs:boolean" use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ Not allowed if simpleContent child is chosen.
+ May be overridden by setting on complexContent child.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:derivationSet"/>
+ <xs:attribute name="defaultAttributesApply" type="xs:boolean" use="optional" default="true"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="topLevelComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="localComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="block" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="restrictionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:sequence>
+ <xs:element ref="xs:openContent" minOccurs="0"/>
+ <xs:group ref="xs:typeDefParticle"/>
+ </xs:sequence>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ <xs:group ref="xs:assertions"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="complexRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element ref="xs:openContent" minOccurs="0"/>
+ <xs:group ref="xs:typeDefParticle"/>
+ </xs:sequence>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ <xs:group ref="xs:assertions"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="extensionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element ref="xs:openContent" minOccurs="0"/>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ <xs:group ref="xs:assertions"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="complexContent" id="complexContent">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-complexContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:complexRestrictionType"/>
+ <xs:element name="extension" type="xs:extensionType"/>
+ </xs:choice>
+ <xs:attribute name="mixed" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Overrides any setting on complexType parent.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="openContent" id="openContent">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-openContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="any" type="xs:wildcard" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="mode" use="optional" default="interleave">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="none"/>
+ <xs:enumeration value="interleave"/>
+ <xs:enumeration value="suffix"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="defaultOpenContent" id="defaultOpenContent">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-defaultOpenContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="any" type="xs:wildcard"/>
+ </xs:sequence>
+ <xs:attribute name="appliesToEmpty" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="mode" use="optional" default="interleave">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="interleave"/>
+ <xs:enumeration value="suffix"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="simpleRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ <xs:group ref="xs:assertions"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="simpleExtensionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:extensionType">
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ No typeDefParticle group reference</xs:documentation>
+ </xs:annotation>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ <xs:group ref="xs:assertions"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="simpleContent" id="simpleContent">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-simpleContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:simpleRestrictionType"/>
+ <xs:element name="extension" type="xs:simpleExtensionType"/>
+ </xs:choice>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-complexType"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:simpleType name="blockSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {substitution, extension,
+ restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="substitution"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ <xs:complexType name="element" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ The element element can be used either
+ at the top level to define an element-type binding globally,
+ or within a content model to either reference a globally-defined
+ element or type or declare an element-type binding locally.
+ The ref form is not allowed at the top level.</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:element name="alternative" type="xs:altType" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="substitutionGroup">
+ <xs:simpleType>
+ <xs:list itemType="xs:QName"/>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attributeGroup ref="xs:occurs"/>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="nillable" type="xs:boolean" use="optional"/>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:blockSet"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ <xs:attribute name="targetNamespace" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="topLevelElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:element name="alternative" type="xs:altType" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="targetNamespace" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="localElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:element name="alternative" type="xs:altType" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="substitutionGroup" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="element" type="xs:topLevelElement" id="element">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-element"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:complexType name="altType">
+ <xs:annotation>
+ <xs:documentation>
+ This type is used for 'alternative' elements.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:attribute name="test" type="xs:string" use="optional"/>
+ <xs:attribute name="type" type="xs:QName" use="optional"/>
+ <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="group" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ group type for explicit groups, named top-level groups and
+ group references</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="realGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="namedGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element name="all">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:all">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="choice" type="xs:simpleExplicitGroup"/>
+ <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="groupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" type="xs:QName" use="required"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="explicitGroup">
+ <xs:annotation>
+ <xs:documentation>
+ group type for the three kinds of group</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="simpleExplicitGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:group name="allModel">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>This choice with min/max is here to
+ avoid a pblm with the Elt:All/Choice/Seq
+ Particle derivation constraint</xs:documentation>
+ </xs:annotation>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element ref="xs:any"/>
+ <xs:element name="group">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:groupRef">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" fixed="1"/>
+ <xs:attribute name="maxOccurs" type="xs:nonNegativeInteger" fixed="1"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
+ <xs:complexType name="all">
+ <xs:annotation>
+ <xs:documentation>
+ Only elements allowed inside</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="maxOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:allNNI">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="all" type="xs:all" id="all">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-all"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="choice" type="xs:explicitGroup" id="choice">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-choice"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-sequence"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="group" type="xs:namedGroup" id="group">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-group"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:attributeGroup name="anyAttrGroup">
+ <xs:attribute name="namespace" type="xs:namespaceList" use="optional"/>
+ <xs:attribute name="notNamespace" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:basicNamespaceList">
+ <xs:minLength value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="processContents" use="optional" default="strict">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="skip"/>
+ <xs:enumeration value="lax"/>
+ <xs:enumeration value="strict"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
+ <xs:complexType name="wildcard">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attributeGroup ref="xs:anyAttrGroup"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="any" id="any">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-any"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:wildcard">
+ <xs:attribute name="notQName" type="xs:qnameList" use="optional"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:annotation>
+ <xs:documentation>
+ simple type for the value of the 'namespace' attr of
+ 'any' and 'anyAttribute'</xs:documentation>
+ </xs:annotation>
+ <xs:annotation>
+ <xs:documentation>
+ Value is
+ ##any - - any non-conflicting WFXML/attribute at all
+
+ ##other - - any non-conflicting WFXML/attribute from
+ namespace other than targetNS
+
+ ##local - - any unqualified non-conflicting WFXML/attribute
+
+ one or - - any non-conflicting WFXML/attribute from
+ more URI the listed namespaces
+ references
+ (space separated)
+
+ ##targetNamespace or ##local may appear in the above list, to
+ refer to the targetNamespace of the enclosing
+ schema or an absent targetNamespace respectively</xs:documentation>
+ </xs:annotation>
+ <xs:simpleType name="namespaceList">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union memberTypes="xs:specialNamespaceList xs:basicNamespaceList"/>
+ </xs:simpleType>
+ <xs:simpleType name="basicNamespaceList">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:list>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:anyURI">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##targetNamespace"/>
+ <xs:enumeration value="##local"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ <xs:simpleType name="specialNamespaceList">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##any"/>
+ <xs:enumeration value="##other"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="qnameList">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use
+ </xs:documentation>
+ </xs:annotation>
+ <xs:list>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:QName">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##defined"/>
+ <xs:enumeration value="##definedSibling"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ <xs:simpleType name="qnameListA">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use
+ </xs:documentation>
+ </xs:annotation>
+ <xs:list>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:QName">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##defined"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ <xs:simpleType name="xpathDefaultNamespace">
+ <xs:union memberTypes="xs:anyURI">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##defaultNamespace"/>
+ <xs:enumeration value="##targetNamespace"/>
+ <xs:enumeration value="##local"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-attribute"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:complexType name="attributeGroup" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:attrDecls"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="namedAttributeGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="attributeGroupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" type="xs:QName" use="required"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-attributeGroup"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="include" id="include">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-include"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="redefine" id="redefine">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-redefine"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:annotation"/>
+ <xs:group ref="xs:redefinable"/>
+ </xs:choice>
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="override" id="override">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-override"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:schemaTop" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="import" id="import">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-import"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="namespace" type="xs:anyURI"/>
+ <xs:attribute name="schemaLocation" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="selector" id="selector">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-selector"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in selectors</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token"/>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="field" id="field">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-field"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in fields</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token"/>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="keybase">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence minOccurs="0">
+ <xs:element ref="xs:selector"/>
+ <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName"/>
+ <xs:attribute name="ref" type="xs:QName"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:group name="identityConstraint">
+ <xs:annotation>
+ <xs:documentation>The three kinds of identity constraints, all with
+ type of or derived from 'keybase'.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:unique"/>
+ <xs:element ref="xs:key"/>
+ <xs:element ref="xs:keyref"/>
+ </xs:choice>
+ </xs:group>
+ <xs:element name="unique" type="xs:keybase" id="unique">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-unique"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="key" type="xs:keybase" id="key">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-key"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="keyref" id="keyref">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-keyref"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:keybase">
+ <xs:attribute name="refer" type="xs:QName"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="notation" id="notation">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-notation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:attribute name="public" type="xs:public"/>
+ <xs:attribute name="system" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:simpleType name="public">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ A public identifier, per ISO 8879</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token"/>
+ </xs:simpleType>
+ <xs:element name="appinfo" id="appinfo">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-appinfo"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="documentation" id="documentation">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-documentation"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="annotation" id="annotation">
+ <xs:annotation>
+ <xs:documentation source="../structures/structures.html#element-annotation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:appinfo"/>
+ <xs:element ref="xs:documentation"/>
+ </xs:choice>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:annotation>
+ <xs:documentation>
+ notations for use within schema documents</xs:documentation>
+ </xs:annotation>
+ <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
+ <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
+ <xs:complexType name="anyType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ Not the real urType, but as close an approximation as we can
+ get in the XML representation</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+ <xs:annotation>
+ <xs:documentation>
+ In keeping with the XML Schema WG's standard versioning policy,
+ the material in this schema document will persist at the URI
+ http://www.w3.org/2012/04/XMLSchema.xsd.
+
+ At the date of issue it can also be found at the URI
+ http://www.w3.org/2009/XMLSchema/XMLSchema.xsd.
+
+ The schema document at that URI may however change in the future,
+ in order to remain compatible with the latest version of XSD
+ and its namespace. In other words, if XSD or the XML Schema
+ namespace change, the version of this document at
+ http://www.w3.org/2009/XMLSchema/XMLSchema.xsd will change accordingly;
+ the version at http://www.w3.org/2012/04/XMLSchema.xsd will not change.
+
+ Previous dated (and unchanging) versions of this schema document
+ include:
+
+ http://www.w3.org/2012/01/XMLSchema.xsd
+ (XSD 1.1 Proposed Recommendation)
+
+ http://www.w3.org/2011/07/XMLSchema.xsd
+ (XSD 1.1 Candidate Recommendation)
+
+ http://www.w3.org/2009/04/XMLSchema.xsd
+ (XSD 1.1 Candidate Recommendation)
+
+ http://www.w3.org/2004/10/XMLSchema.xsd
+ (XSD 1.0 Recommendation, Second Edition)
+
+ http://www.w3.org/2001/05/XMLSchema.xsd
+ (XSD 1.0 Recommendation, First Edition)
+
+
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType name="derivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="substitution"/>
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:group name="simpleDerivation">
+ <xs:choice>
+ <xs:element ref="xs:restriction"/>
+ <xs:element ref="xs:list"/>
+ <xs:element ref="xs:union"/>
+ </xs:choice>
+ </xs:group>
+ <xs:simpleType name="simpleDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {restriction, extension, union, list}
+ </xs:documentation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="extension"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ <xs:complexType name="simpleType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleDerivation"/>
+ <xs:attribute name="final" type="xs:simpleDerivationSet"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Can be restricted to required or forbidden
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="topLevelSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ Required at the top level
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="localSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited">
+ <xs:annotation>
+ <xs:documentation>
+ Forbidden when nested
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-simpleType"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="facet" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ An abstract element, representing facets in general.
+ The facets defined by this spec are substitutable for
+ this element, and implementation-defined facets should
+ also name this as a substitution-group head.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:group name="simpleRestrictionModel">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:facet"/>
+ <xs:any namespace="##other" processContents="lax"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
+ <xs:element name="restriction" id="restriction">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-restriction">
+ base attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ <xs:attribute name="base" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="list" id="list">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-list">
+ itemType attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="itemType" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="union" id="union">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-union">
+ memberTypes attribute must be non-empty or there must be
+ at least one simpleType child
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="memberTypes" use="optional">
+ <xs:simpleType>
+ <xs:list itemType="xs:QName"/>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="facet">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="value" use="required"/>
+ <xs:attribute name="fixed" type="xs:boolean" use="optional" default="false"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="noFixedFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="fixed" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="minExclusive" type="xs:facet" substitutionGroup="xs:facet" id="minExclusive">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-minExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minInclusive" type="xs:facet" substitutionGroup="xs:facet" id="minInclusive">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-minInclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxExclusive" type="xs:facet" substitutionGroup="xs:facet" id="maxExclusive">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-maxExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxInclusive" type="xs:facet" substitutionGroup="xs:facet" id="maxInclusive">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-maxInclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:complexType name="numFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="intFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:integer" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="totalDigits" substitutionGroup="xs:facet" id="totalDigits">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-totalDigits"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:numFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="fractionDigits" type="xs:numFacet" substitutionGroup="xs:facet" id="fractionDigits">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-fractionDigits"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="length" type="xs:numFacet" substitutionGroup="xs:facet" id="length">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-length"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minLength" type="xs:numFacet" substitutionGroup="xs:facet" id="minLength">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-minLength"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxLength" type="xs:numFacet" substitutionGroup="xs:facet" id="maxLength">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-maxLength"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="enumeration" type="xs:noFixedFacet" substitutionGroup="xs:facet" id="enumeration">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-enumeration"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="whiteSpace" substitutionGroup="xs:facet" id="whiteSpace">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-whiteSpace"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="preserve"/>
+ <xs:enumeration value="replace"/>
+ <xs:enumeration value="collapse"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="pattern" substitutionGroup="xs:facet" id="pattern">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-pattern"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:noFixedFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="assertion" type="xs:assertion" substitutionGroup="xs:facet" id="assertion">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-assertion"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="explicitTimezone" substitutionGroup="xs:facet" id="explicitTimezone">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema11-2/#element-explicitTimezone"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="optional"/>
+ <xs:enumeration value="required"/>
+ <xs:enumeration value="prohibited"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:annotation>
+ <xs:documentation>
+ In keeping with the XML Schema WG's standard versioning policy,
+ this schema document will persist at the URI
+ http://www.w3.org/2012/04/datatypes.xsd.
+
+ At the date of issue it can also be found at the URI
+ http://www.w3.org/2009/XMLSchema/datatypes.xsd.
+
+ The schema document at that URI may however change in the future,
+ in order to remain compatible with the latest version of XSD
+ and its namespace. In other words, if XSD or the XML Schema
+ namespace change, the version of this document at
+ http://www.w3.org/2009/XMLSchema/datatypes.xsd will change accordingly;
+ the version at http://www.w3.org/2012/04/datatypes.xsd will not change.
+
+ Previous dated (and unchanging) versions of this schema document
+ include:
+
+ http://www.w3.org/2012/01/datatypes.xsd
+ (XSD 1.1 Proposed Recommendation)
+
+ http://www.w3.org/2011/07/datatypes.xsd
+ (XSD 1.1 Candidate Recommendation)
+
+ http://www.w3.org/2009/04/datatypes.xsd
+ (XSD 1.1 Candidate Recommendation)
+
+ http://www.w3.org/2004/10/datatypes.xsd
+ (XSD 1.0 Recommendation, Second Edition)
+
+ http://www.w3.org/2001/05/datatypes.xsd
+ (XSD 1.0 Recommendation, First Edition)
+
+ </xs:documentation>
+ </xs:annotation>
+</xs:schema>
+++ /dev/null
-debuttypeChaineAvecBlancs = '\t\t<xs:simpleType name="T_stg">\n\t\t\t <xs:restriction>\n\t\t\t <xs:simpleType>\n\t\t\t\t <xs:list>\n\t\t\t\t <xs:simpleType>\n\t\t\t\t\t <xs:restriction base="xs:string">'
-fintypeChaineAvecBlancs = '\t\t</xs:restriction>\n\t\t </xs:simpleType>\n\t\t </xs:list>\n\t\t </xs:simpleType>\n\t\t'
-
-SequenceChaineAvecBlancs = '\t\t<xs:complexType name="T_{}">\n\t\t\t <xs:sequence> <xs:element name="stg" type="Vimmp:T_stg" minOccurs="1" maxOccurs="1" default="{}">n\t\t\t <\xs:sequence>\n\t\t<xs:complexType name>\n'
-
-
+++ /dev/null
-texteDebut='<?xml version="1.0" encoding="UTF-8"?>\n<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:{}="http://chercheurs.edf.com/logiciels/{}" targetNamespace="http://chercheurs.edf.com/logiciels/{}" elementFormDefault="qualified" attributeFormDefault="qualified"\n>'
-texteFin='</schema>'
-
-# SIMP
-typeSimple = '\t<simpleType name="{}">\n\t\t<restriction base="{}"/>\n\t</simpleType>\n'
-debutTypeSimpleWithInto = '\t<simpleType name="{}">\n\t\t<restriction base="{}">\n'
-typeSimpleWithInto = '\t\t\t<enumeration value="{}"/>\n'
-finTypeSimpleWithInto = '\t\t</restriction>\n\t</simpleType>\n'
-eltDsSequence = '\t\t\t<element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
-
-# COMPO
-debutTypeCompo = '\t<complexType name="{}" >\n\t\t<sequence minOccurs="{}" maxOccurs="{}">\n'
-finTypeCompo = '\t\t</sequence>\n\t</complexType>\n'
-eltCompoDsSequence = '\t\t\t<element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
-eltCompoDsSequenceSiProc = '\t\t\t<element name="{}" type="{}:{}" />\n'
-
-# BLOC
-debutTypeSubst = '\t<group name="{}"> \n\t\t<sequence>\n'
-finTypeSubst = '\t\t</sequence>\n\t</group>\n'
-substDsSequence = '\t\t\t<group ref="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
-
-
-# CATA
-debutTypeCata = '\t<complexType name="{}">\n\t\t<choice minOccurs="0" maxOccurs="unbounded">\n'
-finTypeCata = '\t\t</choice>\n\t</complexType> '
-eltCata = '\t<element name="{}" type="{}:{}"/>\n'
-
-
-if __name__ == '__main__' :
- nomElt='Simple'
- nomDuType='T_Simple'
- nomDuTypeBase='int'
- nomDuComplexe='T_Complexe'
- nomDuCode='monCode'
- minOccurs=1
- maxOccurs=1
-
- texteSimple=typeSimple.format(nomDuType, nomDuTypeBase)
- texteElt=eltDsSequence.format(nomElt,nomDuCode,nomDuType,minOccurs,maxOccurs)
-
- minOccurs=0
- texteComplexe=debutTypeComplexe.format(nomDuComplexe)
- texteComplexe+=texteElt
- texteComplexe+=finTypeComplexe
- texteEltComplexe=eltDsSequence.format(nomElt,nomDuCode,nomDuType,minOccurs,maxOccurs)
-
- texteCata=debutTypeCata.format(nomDuCode)
- texteCata+=texteEltComplexe
- texteCata+=finTypeCata
-
- eltRacine=eltCata.format(nomDuCode, 'T_'+nomDuCode)
- print (texteSimple+texteComplexe+texteCata+eltRacine)
-texteDebut='<?xml version="1.0" encoding="UTF-8"?>\n<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"\nxmlns="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\ntargetNamespace="http://chercheurs.edf.com/logiciels/{}"\nelementFormDefault="qualified" attributeFormDefault="unqualified" version="0">\n'
-texteDebutNiveau2='<?xml version="1.0" encoding="UTF-8"?>\n<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"\nxmlns="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\ntargetNamespace="http://chercheurs.edf.com/logiciels/{}"\nelementFormDefault="qualified" attributeFormDefault="unqualified" version="0">\n'
-texteDebutNiveau3='<?xml version="1.0" encoding="UTF-8"?>\n<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"\nxmlns="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\ntargetNamespace="http://chercheurs.edf.com/logiciels/{}"\nelementFormDefault="qualified" attributeFormDefault="unqualified" version="0">\n'
-texteFin='</xs:schema>'
+texteDebut = '<?xml version="1.0" encoding="UTF-8"?>\n<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"\nxmlns="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\ntargetNamespace="http://chercheurs.edf.com/logiciels/{}"\nelementFormDefault="qualified" attributeFormDefault="unqualified" version="0">\n'
+texteDebutNiveau2 = '<?xml version="1.0" encoding="UTF-8"?>\n<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"\nxmlns="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\ntargetNamespace="http://chercheurs.edf.com/logiciels/{}"\nelementFormDefault="qualified" attributeFormDefault="unqualified" version="0">\n'
+texteDebutNiveau3 = '<?xml version="1.0" encoding="UTF-8"?>\n<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"\nxmlns="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\nxmlns:{}="http://chercheurs.edf.com/logiciels/{}"\ntargetNamespace="http://chercheurs.edf.com/logiciels/{}"\nelementFormDefault="qualified" attributeFormDefault="unqualified" version="0">\n'
+texteFin = "</xs:schema>"
+texteDebut = '<?xml version="1.0" encoding="UTF-8"?>\n<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"\nxmlns="odyssee/cocagne/{}"\nxmlns:{}="odyssee/cocagne/{}"\ntargetNamespace="odyssee/cocagne/{}"\nelementFormDefault="qualified" attributeFormDefault="unqualified" version="0">\n'
-#texteAnnotation= '\t<xs:simpleType name="PNEFdico_{}">\n\t\t<xs:annotation>\n\t\t<xs:documentation>{}\n\t\t</xs:documentation>\n\t\t</xs:annotation>\n\t<xs:restriction base="xs:string"></xs:restriction>\n\t</xs:simpleType>\n'
-texteAnnotation= '\t<xs:simpleType name="PNEFdico">\n\t\t<xs:annotation>\n\t\t<xs:documentation>{}\n\t\t</xs:documentation>\n\t\t</xs:annotation>\n\t<xs:restriction base="xs:string"></xs:restriction>\n\t</xs:simpleType>\n'
+
+# texteAnnotation= '\t<xs:simpleType name="PNEFdico_{}">\n\t\t<xs:annotation>\n\t\t<xs:documentation>{}\n\t\t</xs:documentation>\n\t\t</xs:annotation>\n\t<xs:restriction base="xs:string"></xs:restriction>\n\t</xs:simpleType>\n'
+texteAnnotation = '\t<xs:simpleType name="PNEFdico">\n\t\t<xs:annotation>\n\t\t<xs:documentation>{}\n\t\t</xs:documentation>\n\t\t</xs:annotation>\n\t<xs:restriction base="xs:string"></xs:restriction>\n\t</xs:simpleType>\n'
# SIMP
-debutSimpleType = '\t<xs:simpleType name="{}">\n'
-debutSimpleTypeSsNom = '\t<xs:simpleType>\n'
-fermeSimpleType = '\t</xs:simpleType>\n'
+debutSimpleType = '\t<xs:simpleType name="{}">\n'
+debutSimpleTypeSsNom = "\t<xs:simpleType>\n"
+fermeSimpleType = "\t</xs:simpleType>\n"
debutRestrictionBase = '\t\t<xs:restriction base="{}">\n'
-fermeRestrictionBase = '\t\t</xs:restriction>\n'
-enumeration = '\t\t\t<xs:enumeration value="{}"/>\n'
-maxInclusiveBorne = '\t\t\t<xs:maxInclusive value = "{}"/>\n'
-minInclusiveBorne = '\t\t\t<xs:minInclusive value = "{}"/>\n'
-
-debutTypeSimpleListe = '\t\t<xs:restriction>\n\t\t\t<xs:simpleType>\n\t\t\t\t<xs:list>\n\t\t\t\t\t<xs:simpleType>\n'
-finTypeSimpleListe = '\t\t</xs:restriction>\n\t\t\t</xs:simpleType>\n\t\t\t\t</xs:list>\n\t\t\t\t\t</xs:simpleType>\n'
-fermeBalisesMileu = '\t\t\t\t\t\t</xs:restriction>\n\t\t\t\t\t</xs:simpleType>\n\t\t\t\t</xs:list>\n\t\t\t </xs:simpleType>\n'
-
-maxLengthTypeSimple = '\t\t\t<xs:maxLength value = "{}"/>\n'
-minLengthTypeSimple = '\t\t\t<xs:minLength value = "{}"/>\n'
-eltDsSequence = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+fermeRestrictionBase = "\t\t</xs:restriction>\n"
+enumeration = '\t\t\t<xs:enumeration value="{}"/>\n'
+maxInclusiveBorne = '\t\t\t<xs:maxInclusive value = "{}"/>\n'
+minInclusiveBorne = '\t\t\t<xs:minInclusive value = "{}"/>\n'
+
+typeAvecAttributUnite = '\t<xs:complexType name="{}">\n\t\t<xs:simpleContent>\n\t\t\t<xs:extension base="{}:{}_NoUnit">\n\t\t\t<xs:attribute name="unite_{}" type="xs:string" fixed = "{}"/>\n\t\t\t </xs:extension>\n\t\t</xs:simpleContent>\n\t</xs:complexType>\n'
+debutTypeSimpleListe = "\t\t<xs:restriction>\n\t\t\t<xs:simpleType>\n\t\t\t\t<xs:list>\n\t\t\t\t\t<xs:simpleType>\n"
+finTypeSimpleListe = "\t\t</xs:restriction>\n\t\t\t</xs:simpleType>\n\t\t\t\t</xs:list>\n\t\t\t\t\t</xs:simpleType>\n"
+fermeBalisesMileu = "\t\t\t\t\t\t</xs:restriction>\n\t\t\t\t\t</xs:simpleType>\n\t\t\t\t</xs:list>\n\t\t\t </xs:simpleType>\n"
+
+maxLengthTypeSimple = '\t\t\t<xs:maxLength value = "{}"/>\n'
+minLengthTypeSimple = '\t\t\t<xs:minLength value = "{}"/>\n'
+eltDsSequence = (
+ '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+)
eltDsSequenceWithHelp = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n'
-eltDsSequenceWithDefautAndHelp = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}" default="{}">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n'
-eltDsSequenceWithDefaut = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}" default="{}"/>\n'
+eltDsSequenceWithDefautAndHelp = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}" default="{}">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n'
+eltDsSequenceWithDefaut = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}" default="{}"/>\n'
UsingASSDkeyRefDeclaration = '\n\t<xs:keyref name="{}_Name_ref_a{}" refer="{}:Key_Name_For_{}"> \n\t\t<xs:selector xpath="{}"/>\n\t\t<xs:field xpath="."/>\n\t</xs:keyref>\n'
# <xs:key name="Key_Name_For_ElementarySurface">
# <xs:selector xpath="./Vimmp:CDM/Vimmp:Geometric_Domain/Vimmp:Surface"/>
# <xs:field xpath="./Vimmp:SurfaceName"/>
# </xs:key>
- #<xs:keyref name="MyField_Ref_A_CreateMesh" refer="Test1:Key_Name_In_ReadMesh_CreateMesh">
- #<xs:selector xpath="./Test1:MyField/Test1:onMesh"/>
-
-
+# <xs:keyref name="MyField_Ref_A_CreateMesh" refer="Test1:Key_Name_In_ReadMesh_CreateMesh">
+# <xs:selector xpath="./Test1:MyField/Test1:onMesh"/>
# COMPO
-debutTypeCompo = '\t<xs:complexType name="{}" >\n'
+debutTypeCompo = '\t<xs:complexType name="{}" >\n'
debutTypeCompoEtape = '\t <xs:complexContent>\n\t <xs:extension base="T_step_{}">\n'
-finTypeCompoEtape = '\t </xs:extension>\n\t </xs:complexContent>\n'
-debutTypeCompoSeq = '\t\t<xs:sequence>\n'
-finTypeCompoSeq = '\t\t</xs:sequence>\n'
-finTypeCompo = '\t</xs:complexType>\n'
-eltCompoDsSequence = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
-eltCompoDsSequenceWithHelp = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
-#name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n'
-#eltCompoDsSequenceInExtension = '\t\t\t<xs:element name="{}" type="{}:{}"/>\n'
+finTypeCompoEtape = "\t </xs:extension>\n\t </xs:complexContent>\n"
+debutTypeCompoSeq = "\t\t<xs:sequence>\n"
+finTypeCompoSeq = "\t\t</xs:sequence>\n"
+finTypeCompo = "\t</xs:complexType>\n"
+eltCompoDsSequence = (
+ '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+)
+eltCompoDsSequenceWithHelp = (
+ '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+)
+# name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n'
+# eltCompoDsSequenceInExtension = '\t\t\t<xs:element name="{}" type="{}:{}"/>\n'
# ETAPE
eltEtape = '\t<xs:element name="{}" type="{}:{}" substitutionGroup="step_{}"/>\n'
eltEtapeWithHelp = '\t<xs:element name="{}" type="{}:{}" substitutionGroup="step_{}">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n'
+eltEtapeSimple = (
+ '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+)
+eltEtapeSimpleWithHelp = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n'
+
# BLOC
-debutTypeSubst = '\t<xs:group name="{}"> \n\t\t<xs:sequence>\n'
-finTypeSubst = '\t\t</xs:sequence>\n\t</xs:group>\n'
-substDsSequence = '\t\t\t<xs:group ref="{}:{}" minOccurs="{}" maxOccurs="{}">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:group>\n'
-#choiceDsBloc = '\t\t\t<xs:choice minOccurs={}>\n'
-debutChoiceDsBloc = '\t\t<xs:choice>\n'
+debutTypeSubst = '\t<xs:group name="{}"> \n\t\t<xs:sequence>\n'
+finTypeSubst = "\t\t</xs:sequence>\n\t</xs:group>\n"
+substDsSequence = '\t\t\t<xs:group ref="{}:{}" minOccurs="{}" maxOccurs="{}">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:group>\n'
+# choiceDsBloc = '\t\t\t<xs:choice minOccurs={}>\n'
+debutChoiceDsBloc = "\t\t<xs:choice>\n"
debutChoiceDsBlocAvecMin = '<xs:choice minOccurs="{}">\n'
-finChoiceDsBloc = '\t\t</xs:choice>\n'
-debSequenceDsBloc = '<xs:sequence>\n'
-finSequenceDsBloc = '</xs:sequence>\n'
+finChoiceDsBloc = "\t\t</xs:choice>\n"
+debSequenceDsBloc = "<xs:sequence>\n"
+finSequenceDsBloc = "</xs:sequence>\n"
debutTypeSubstDsBlocFactorise = '\t<xs:group name="{}">\n'
-finTypeSubstDsBlocFactorise = '\t</xs:group>\n'
-debutUnion = '\t\t\t<xs:union>\n'
-finUnion = '\t\t\t</xs:union>\n'
-reconstitueUnion = '{} maxOccurs="1">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n'
-
+finTypeSubstDsBlocFactorise = "\t</xs:group>\n"
+debutUnion = "\t\t\t<xs:union>\n"
+finUnion = "\t\t\t</xs:union>\n"
+reconstitueUnion = '{} maxOccurs="1">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n'
# User OR ASSD
-attributeNameName = '\t\t<xs:attribute name="sdName" type="xs:string"/>\n'
-attributeTypeForASSD = '\t\t<xs:attribute name="sdType" type="xs:string" fixed="ASSD"/>\n'
-attributeTypeUtilisateurName = '\t\t<xs:attribute name="typeUtilisateur" type="xs:string" fixed="{}"/>\n'
-producingASSDkeyRefDeclaration='\t<xs:key name="Key_Name_For_{}">\n\t\t<xs:selector xpath="."/>\n\t\t<xs:field xpath="{}"/>\n\t</xs:key>\n'
-texteFieldUnitaire="./{}:{}/@name |"
-defBaseXSDUserASSD='\t<xs:simpleType name="AccasUserAssd">\n\t\t<xs:restriction base="xs:string">\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
-defBaseXSDUserASSDMultiple='\t<xs:simpleType name="AccasUserAssdMultiple">\n\t\t<xs:restriction base="xs:string">\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
+attributeNameName = '\t\t<xs:attribute name="sdName" type="xs:string"/>\n'
+attributeTypeForASSD = (
+ '\t\t<xs:attribute name="sdType" type="xs:string" fixed="ASSD"/>\n'
+)
+attributeTypeUtilisateurName = (
+ '\t\t<xs:attribute name="typeUtilisateur" type="xs:string" fixed="{}"/>\n'
+)
+producingASSDkeyRefDeclaration = '\t<xs:key name="Key_Name_For_{}">\n\t\t<xs:selector xpath="."/>\n\t\t<xs:field xpath="{}"/>\n\t</xs:key>\n'
+texteFieldUnitaire = "./{}:{}/@name |"
+defBaseXSDASSD = '\t<xs:simpleType name="AccasAssd">\n\t\t<xs:restriction base="xs:string">\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
+defBaseXSDUserASSD = '\t<xs:simpleType name="AccasUserAssd">\n\t\t<xs:restriction base="xs:string">\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
+defBaseXSDUserASSDMultiple = '\t<xs:simpleType name="AccasUserAssdMultiple">\n\t\t<xs:restriction base="xs:string">\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
-defUserASSDMultiple='\t<xs:simpleType name="{}">\n\t\t<xs:restriction base="AccasUserAssdMultiple">\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
-defUserASSD ='\t<xs:simpleType name="{}">\n\t\t<xs:restriction base="AccasUserAssd">\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
+defUserASSDMultiple = '\t<xs:simpleType name="{}">\n\t\t<xs:restriction base="AccasUserAssdMultiple">\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
+defUserASSD = '\t<xs:simpleType name="{}">\n\t\t<xs:restriction base="AccasUserAssd">\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
-defUserASSDOrUserASSDMultiple='\t<xs:simpleType name="{}_{}">\n\t\t<xs:restriction base="{}">\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
+defUserASSDOrUserASSDMultiple = '\t<xs:simpleType name="{}_{}">\n\t\t<xs:restriction base="{}">\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
# CATA
-debutTypeCata = '\t<xs:complexType name="T_{}">\n\t\t<xs:choice minOccurs="0" maxOccurs="unbounded">\n'
+# debutTypeCata = '\t<xs:complexType name="T_{}">\n\t\t<xs:choice minOccurs="0" maxOccurs="unbounded">\n'
+debutTypeCata = (
+ '\t<xs:complexType name="T_{}">\n\t\t<xs:choice minOccurs="0" maxOccurs="1">\n'
+)
debutTypeCataExtension = '\t<xs:complexType name="T_{}">\n'
-finTypeCata = '\t\t</xs:choice>\n\t</xs:complexType>\n'
-finSchema = '</xs:schema>'
-#eltCata = '\t<xs:element name="{}" type="{}:{}"/>\n'
-#eltCodeSpecDsCata = '\t\t\t<xs:element ref="{}_Abstract" minOccurs="0" maxOccurs="1"/>\n'
-#fermeEltCata = '\t</xs:element>\n'
-includeCata = '<xs:include schemaLocation="cata_{}.xsd" />\n\n'
+finTypeCata = "\t\t</xs:choice>\n\t</xs:complexType>\n"
+finSchema = "</xs:schema>"
+# eltCataSimple = '\t<xs:element name="{}" type="{}:{}"/>\n'
+# eltCodeSpecDsCata = '\t\t\t<xs:element ref="{}_Abstract" minOccurs="0" maxOccurs="1"/>\n'
+# fermeEltCata = '\t</xs:element>\n'
+includeCata = '<xs:include schemaLocation="cata_{}.xsd" />\n\n'
# EXTENSION
debutExtension = '\t\t<xs:complexContent>\n\t\t<xs:extension base="{}:T_{}_Abstract">\n\t\t<xs:choice minOccurs="0" maxOccurs="unbounded">\n'
-finExtension = '\t\t</xs:choice>\n\t\t</xs:extension>\n\t\t</xs:complexContent>\n'
+finExtension = "\t\t</xs:choice>\n\t\t</xs:extension>\n\t\t</xs:complexContent>\n"
# TYPE ABSTRAIT
-eltAbstraitCataPPal = '\t<xs:complexType name="T_step_{}" abstract="true"/>\n'
-eltAbstraitCataFils = '\t<xs:complexType name="T_step_{}" abstract="true">\n\t\t<xs:complexContent>\n\t\t\t<xs:extension base="{}:T_step_{}"/>\n\t\t</xs:complexContent>\n\t</xs:complexType>\n'
+eltAbstraitCataPPal = '\t<xs:complexType name="T_step_{}" abstract="true"/>\n'
+eltAbstraitCataFils = '\t<xs:complexType name="T_step_{}" abstract="true">\n\t\t<xs:complexContent>\n\t\t\t<xs:extension base="{}:T_step_{}"/>\n\t\t</xs:complexContent>\n\t</xs:complexType>\n'
eltCataPPal = '\t<xs:element name="step_{}" type="{}:T_step_{}"/>\n'
eltCataPPalWithHelp = '\t<xs:element name="step_{}" type="{}:T_step_{}"/>\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n'
-eltCataFils = '\t<xs:element name="step_{}" type="{}:T_step_{}" substitutionGroup="step_{}"/>\n'
+eltCataFils = (
+ '\t<xs:element name="step_{}" type="{}:T_step_{}" substitutionGroup="step_{}"/>\n'
+)
eltCataFilsWithHelp = '\t<xs:element name="step_{}" type="{}:T_step_{}" substitutionGroup="step_{}"/>\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>{}</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n'
eltCata = '\t<xs:element name="{}" type="{}:T_{}"/>\n\t\t<xs:complexType name="T_{}">\n\t\t <xs:choice minOccurs="0" maxOccurs="unbounded">\n\t\t\t<xs:element ref="step_{}" minOccurs="0" maxOccurs="1"/>\n\t\t </xs:choice>\n\t\t</xs:complexType>\n'
-#\n\t<xs:element name="{}_Abstract" type="{}:T_{}_Abstract"/>\n'
-#implementeAbstrait = '\t<xs:element name="{}" type="{}:{}" substitutionGroup="{}:{}_Abstract"/>\n'
+eltCataSimple = '\t<xs:element name="{}" type="{}:T_{}"/>\n\t\t<xs:complexType name="T_{}">\n\t\t <xs:choice minOccurs="0" maxOccurs="unbounded">\n'
+finEltCataSimple = "\t\t </xs:choice>\n\t\t</xs:complexType>\n"
+
+# \n\t<xs:element name="{}_Abstract" type="{}:T_{}_Abstract"/>\n'
+# implementeAbstrait = '\t<xs:element name="{}" type="{}:{}" substitutionGroup="{}:{}_Abstract"/>\n'
-# MATRICE oldVersion
-# (_matrix ou pas ?)
-#matriceSimpleType = '\t<xs:simpleType name="{}_matrix">\n\t\t<xs:restriction>\n\t\t\t<xs:simpleType>\n\t\t\t\t<xs:list>\n\t\t\t\t\t<xs:simpleType>\n\t\t\t\t\t\t<xs:restriction base="{}_element"/>\n\t\t\t\t\t</xs:simpleType>\n\t\t\t\t</xs:list>\n\t\t\t</xs:simpleType>\n\t\t\t<xs:length value="{}"/>\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
-#matriceSimpleType = '\t<xs:simpleType name="{}">\n\t\t<xs:restriction>\n\t\t\t<xs:simpleType>\n\t\t\t\t<xs:list>\n\t\t\t\t\t<xs:simpleType>\n\t\t\t\t\t\t<xs:restriction base="{}_element"/>\n\t\t\t\t\t</xs:simpleType>\n\t\t\t\t</xs:list>\n\t\t\t</xs:simpleType>\n\t\t\t<xs:length value="{}"/>\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
-#matriceSimpleType +='\t<xs:group name="{}_lines">\n\t\t<xs:sequence>\n\t\t\t<xs:element name="{}" type="{}:{}_matrix" minOccurs="{}" maxOccurs="{}"/>\t\n\t\t</xs:sequence>\n\t</xs:group>\n\t\n'
-#matriceSimpleType +='\t<xs:group name="{}_lines">\n\t\t<xs:sequence>\n\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\t\n\t\t</xs:sequence>\n\t</xs:group>\n\t\n'
-#matriceSimpleType +='\t<xs:group name="{}_content">\n\t\t<xs:sequence>\n\t\t\t<xs:group ref="{}:{}_lines" minOccurs="1" maxOccurs="1"/>\t\n\t\t</xs:sequence>\n\t</xs:group>'
-#eltMatrice = ' <xs:group ref="{}:{}_content" minOccurs="{}" maxOccurs="{}"/>'
# TUPLE
tupleNonHomogeneSimpleType = '\t<xs:simpleType name="{}_n{}_tuple">\n\t\t<xs:restriction base="{}"/>\n\t\t</xs:simpleType>\n'
-tupleNonHomogeneElt = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
-tupleDebutComplexeType = '\t<xs:complexType name="{}">\n\t\t<xs:sequence>'
-tupleMilieuComplexeType = '\n\t\t\t<xs:element name="n{}" type="{}_n{}_tuple" minOccurs="1" maxOccurs="1"/>'
-tupleFinComplexeType = '\n\t\t</xs:sequence>\n\t</xs:complexType>\n'
+tupleNonHomogeneElt = (
+ '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+)
+tupleDebutComplexeType = '\t<xs:complexType name="{}">\n\t\t<xs:sequence>'
+tupleMilieuComplexeType = (
+ '\n\t\t\t<xs:element name="n{}" type="{}_n{}_tuple" minOccurs="1" maxOccurs="1"/>'
+)
+tupleFinComplexeType = '\n\t\t</xs:sequence>\n\t\t<xs:attribute name="sdType" type="xs:string" fixed="Tuple"/>\n\t</xs:complexType>\n'
+tupleDebutComplexeTypeMinZero = '\t<xs:complexType name="{}">\n\t\t<xs:choice>\n\t\t<xs:sequence>\n\t\t</xs:sequence>\n\t\t<xs:sequence maxOccurs={}>'
+tupleFinComplexeTypeMinZero = '\n\t\t</xs:sequence>\n\t\t</xs:choice>\n\t\t<xs:attribute name="sdType" type="xs:string" fixed="Tuple"/>\n\t</xs:complexType>\n'
# MATRICE
-eltMatrice = '\t\t\t <xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
-matriceSimpleType = '\t<xs:simpleType name="{}_line">\n\t\t<xs:restriction>\n\t\t\t<xs:simpleType>\n\t\t\t\t<xs:list>\n\t\t\t\t\t<xs:simpleType>\n\t\t\t\t\t\t<xs:restriction base="{}_element"/>\n\t\t\t\t\t</xs:simpleType>\n\t\t\t\t</xs:list>\n\t\t\t</xs:simpleType>\n\t\t\t<xs:length value="{}"/>\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
-matriceSimpleType +='\t<xs:group name="{}_matrix">\n\t\t<xs:sequence>\n\t\t\t<xs:element name="line" type="{}:{}_line" minOccurs="{}" maxOccurs="{}"/>\n\t\t </xs:sequence>\n\t</xs:group>\n'
-matriceSimpleType +='\t<xs:complexType name="{}"> \n\t\t<xs:group ref="{}:{}_matrix" minOccurs="1" maxOccurs="1"/>\n\t</xs:complexType>\n'
+eltMatrice = (
+ '\t\t\t <xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+)
+matriceSimpleType = '\t<xs:simpleType name="{}_line">\n\t\t<xs:restriction>\n\t\t\t<xs:simpleType>\n\t\t\t\t<xs:list>\n\t\t\t\t\t<xs:simpleType>\n\t\t\t\t\t\t<xs:restriction base="{}_element"/>\n\t\t\t\t\t</xs:simpleType>\n\t\t\t\t</xs:list>\n\t\t\t</xs:simpleType>\n\t\t\t<xs:minLength value="{}"/>\n\t\t\t<xs:maxLength value="{}"/>\n\t\t</xs:restriction>\n\t</xs:simpleType>\n'
+matriceSimpleType += '\t<xs:group name="{}_matrix">\n\t\t<xs:sequence>\n\t\t\t<xs:element name="line" type="{}:{}_line" minOccurs="{}" maxOccurs="{}"/>\n\t\t </xs:sequence>\n\t</xs:group>\n'
+matriceSimpleType += '\t<xs:complexType name="{}"> \n\t\t<xs:group ref="{}:{}_matrix" minOccurs="1" maxOccurs="1"/>\n\t\t<xs:attribute name="sdType" type="xs:string" fixed="Matrice"/>\n\t</xs:complexType>\n'
# CHAINES AVEC BLANC
-debutChaineAvecBlancsInto = '\t<xs:simpleType name="{}_enum">\n\t\t<xs:restriction base="xs:string">\n'
+debutChaineAvecBlancsInto = (
+ '\t<xs:simpleType name="{}_enum">\n\t\t<xs:restriction base="xs:string">\n'
+)
milieuChaineAvecBlancsInto = '\t\t\t<xs:enumeration value="{}"/>\n'
-finChaineAvecBlancsInto = '\t\t</xs:restriction>\n\t\t</xs:simpleType>\n'
-
+finChaineAvecBlancsInto = "\t\t</xs:restriction>\n\t\t</xs:simpleType>\n"
+
complexChaineAvecBlancs = '\t<xs:complexType name="{}">\n\t\t<xs:sequence maxOccurs="{}">\n\t\t\t\t<xs:element name="s__" type="{}_enum"/>\n\t\t\t</xs:sequence>\n\t</xs:complexType>\n'
typeEltChaineAvecBlancSansInto = '\t\t<xs:simpleType name="{}_enum">\n\t\t\t<xs:restriction base="xs:string">\n\t\t\t</xs:restriction>\n\t\t</xs:simpleType>'
-if __name__ == '__main__' :
- print ('ne fait rien')
+if __name__ == "__main__":
+ print("ne fait rien")
+++ /dev/null
-# -*- coding: utf-8 -*-
-from raw.efficas import *
# Demonstrate alternatives for bindings customization
import sys, os
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"..")))
+
+sys.path.append(
+ os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
+)
# Introspection-based customization.
-#from raw.custom import *
-#import raw.custom as raw_custom
+# from raw.custom import *
+# import raw.custom as raw_custom
from Atmo.raw.atmo_test3 import *
import Atmo.raw.atmo_test3 as raw_custom
-#class ta04 (raw_custom.ta04):
+# class ta04 (raw_custom.ta04):
# def xa04 (self):
# return 'extend ta04'
-#raw_custom.ta04._SetSupersedingClass(ta04)
+# raw_custom.ta04._SetSupersedingClass(ta04)
import inspect
+
+
def creationAccasSimp(c):
- print c
+ print(c)
+
+
+# class toto
+# def __init__(self,*args):
+# print dir(self)
+# mro = type(self).mro()
+# for next_class in mro[mro.index(ChildB) + 1:] :
+# if hasattr(next_class, '__init__'):
+# next_class.__init__(self,args)
-class toto
-def __init__(self,*args):
- print dir(self)
- mro = type(self).mro()
- for next_class in mro[mro.index(ChildB) + 1:] :
- if hasattr(next_class, '__init__'):
- next_class.__init__(self,args)
# Utility function to identify classes of interest
-def _isSupersedable (cls):
- return inspect.isclass(cls) and issubclass(cls, pyxb.binding.basis._DynamicCreate_mixin)
+def _isSupersedable(cls):
+ return inspect.isclass(cls) and issubclass(
+ cls, pyxb.binding.basis._DynamicCreate_mixin
+ )
+
-def _injectClasses ():
+def _injectClasses():
import sys
import pyxb.binding.basis
# All PyXB complex type definitions in the original module
- raw_classes = set([_o for (_, _o) in inspect.getmembers(raw_custom) if _isSupersedable(_o)])
- raw_classes_compo=set()
- raw_classes_simp=set()
- for c in raw_classes :
- if issubclass(c,pyxb.binding.basis.complexTypeDefinition) : raw_classes_compo.add(c)
- else : raw_classes_simp.add(c)
- #print 'Original classes complex type: %s' % (raw_classes_compo,)
- print 'Original classes simple type: %s' % (raw_classes_simp,)
+ raw_classes = set(
+ [_o for (_, _o) in inspect.getmembers(raw_custom) if _isSupersedable(_o)]
+ )
+ raw_classes_compo = set()
+ raw_classes_simp = set()
+ for c in raw_classes:
+ if issubclass(c, pyxb.binding.basis.complexTypeDefinition):
+ raw_classes_compo.add(c)
+ else:
+ raw_classes_simp.add(c)
+ # print 'Original classes complex type: %s' % (raw_classes_compo,)
+ # print 'Original classes simple type: %s' % (raw_classes_simp,)
for c in raw_classes_simp:
- setattr(c,'creationAccasSimp',creationAccasSimp)
- oldInit=c.__init__
- print c.__class__
- #setattr(c,'__init__',__init__)
- print c.__mro__
+ setattr(c, "creationAccasSimp", creationAccasSimp)
+ oldInit = c.__init__
+ # print c.__class__
+ # setattr(c,'__init__',__init__)
+ # print c.__mro__
# PyXB complex type definitions in this module that did not come
# from the original import *.
this_module = sys.modules[__name__]
- this_classes = set([_o for (_, _o) in inspect.getmembers(this_module) if _isSupersedable(_o) and _o not in raw_classes])
+ this_classes = set(
+ [
+ _o
+ for (_, _o) in inspect.getmembers(this_module)
+ if _isSupersedable(_o) and _o not in raw_classes
+ ]
+ )
this_classes_tuple = tuple(this_classes)
- #print 'This classes: %s' % (this_classes,)
+ # print 'This classes: %s' % (this_classes,)
# Raw classes superseded by something in this module
- superseded_classes = set([ _o for _o in raw_classes if _o._SupersedingClass() in this_classes ])
+ superseded_classes = set(
+ [_o for _o in raw_classes if _o._SupersedingClass() in this_classes]
+ )
superseded_classes_tuple = tuple(superseded_classes)
- print 'Superseded classes: %s' % (superseded_classes,)
+ # print 'Superseded classes: %s' % (superseded_classes,)
# Raw classes that are subclasses of something superseded by this
# module, but that are not themselves superseded by this module
- need_supersedure_classes = set([_o for _o in raw_classes if issubclass(_o, superseded_classes_tuple) and _o not in superseded_classes])
- print 'Need supersedure classes: %s' % (need_supersedure_classes,)
+ need_supersedure_classes = set(
+ [
+ _o
+ for _o in raw_classes
+ if issubclass(_o, superseded_classes_tuple) and _o not in superseded_classes
+ ]
+ )
+ # print 'Need supersedure classes: %s' % (need_supersedure_classes,)
# Add local definitions to supersede classes all of whose
# ancestors have been superseded as necessary.
assert need_supersedure_classes != new_need_supersedure_classes
need_supersedure_classes = new_need_supersedure_classes
+
_injectClasses()
-m=T_Unit1(1)
-print m
+m = T_Unit1(1)
+# print m
class Tuple:
- def __init__(self,ntuple):
- self.ntuple=ntuple
+ def __init__(self, ntuple):
+ self.ntuple = ntuple
- def __convert__(self,valeur):
+ def __convert__(self, valeur):
if type(valeur) == types.StringType:
return None
if len(valeur) != self.ntuple:
def info(self):
return "Tuple de %s elements" % self.ntuple
- __repr__=info
- __str__=info
+ __repr__ = info
+ __str__ = info
-
-def inverseDico(dicoSource) :
-#---------------------------
+def inverseDico(dicoSource):
+ # ---------------------------
dicoInverse = {}
- for (clef,valeur) in dicoSource.items():
- if not(type(valeur) is tuple):
- dicoInverse[valeur]=clef
+ for clef, valeur in dicoSource.items():
+ if not (type(valeur) is tuple):
+ dicoInverse[valeur] = clef
continue
- (elt,att)=valeur
- if elt not in dicoInverse : dicoInverse[elt]={}
- dicoInverse[elt][att]=clef
+ (elt, att) = valeur
+ if elt not in dicoInverse:
+ dicoInverse[elt] = {}
+ dicoInverse[elt][att] = clef
return dicoInverse
-dictSIMPEficasXML= { 'typ' : 'nomTypeAttendu',
- 'statut' : 'statut',
- 'min' : 'minOccurences',
- 'max' : 'maxOccurences',
- 'homo' : 'homo' ,
- 'position' : 'portee',
- 'validators' : 'validators' ,
- 'sug' : 'valeurSugg',
- 'defaut' : 'valeurDef' ,
- 'into' : ('plageValeur','into'),
- 'val_min' : ('plageValeur','borneInf'),
- 'val_max' : ('plageValeur','borneSup'),
- 'ang' : ('doc','ang'),
- 'fr' : ('doc','fr',),
- 'docu' : ('doc','docu'),
- }
-
-dictSIMPXMLEficas= inverseDico(dictSIMPEficasXML)
-
-
-
-dictFACTEficasXML = { 'statut' : 'statut',
- 'min' : 'minOccurences',
- 'max' : 'maxOccurences',
- 'ang' : ('doc','ang'),
- 'fr' : ('doc','fr',),
- 'docu' : ('doc','docu'),
- 'regles' : 'regles',
- 'validators' : 'validators' ,
- }
-
-dictFACTXMLEficas = inverseDico(dictFACTEficasXML)
-
-dictBLOCEficasXML = { 'statut' : 'statut',
- 'ang' : ('doc','ang'),
- 'fr' : ('doc','fr',),
- 'regles' : 'regles',
- 'condition' : 'condition' ,
- }
-
-dictBLOCXMLEficas = inverseDico(dictBLOCEficasXML)
-
-dictPROCEficasXML = { 'nom' : 'nom',
- 'regles' : 'regles',
- 'ang' : ('doc','ang'),
- 'fr' : ('doc','fr',),
- 'docu' : ('doc','docu'),
- }
+
+dictSIMPEficasXML = {
+ "typ": "nomTypeAttendu",
+ "statut": "statut",
+ "min": "minOccurences",
+ "max": "maxOccurences",
+ "homo": "homo",
+ "position": "portee",
+ "validators": "validators",
+ "sug": "valeurSugg",
+ "defaut": "valeurDef",
+ "into": ("plageValeur", "into"),
+ "val_min": ("plageValeur", "borneInf"),
+ "val_max": ("plageValeur", "borneSup"),
+ "ang": ("doc", "ang"),
+ "fr": (
+ "doc",
+ "fr",
+ ),
+ "docu": ("doc", "docu"),
+}
+
+dictSIMPXMLEficas = inverseDico(dictSIMPEficasXML)
+
+
+dictFACTEficasXML = {
+ "statut": "statut",
+ "min": "minOccurences",
+ "max": "maxOccurences",
+ "ang": ("doc", "ang"),
+ "fr": (
+ "doc",
+ "fr",
+ ),
+ "docu": ("doc", "docu"),
+ "regles": "regles",
+ "validators": "validators",
+}
+
+dictFACTXMLEficas = inverseDico(dictFACTEficasXML)
+
+dictBLOCEficasXML = {
+ "statut": "statut",
+ "ang": ("doc", "ang"),
+ "fr": (
+ "doc",
+ "fr",
+ ),
+ "regles": "regles",
+ "condition": "condition",
+}
+
+dictBLOCXMLEficas = inverseDico(dictBLOCEficasXML)
+
+dictPROCEficasXML = {
+ "nom": "nom",
+ "regles": "regles",
+ "ang": ("doc", "ang"),
+ "fr": (
+ "doc",
+ "fr",
+ ),
+ "docu": ("doc", "docu"),
+}
dictPROCXMLEficas = inverseDico(dictPROCEficasXML)
dictOPEREficasXML = dictPROCEficasXML
dictOPERXMLEficas = dictPROCXMLEficas
-dictPourCast = { 'I' : int, 'R' : float, 'bool' : bool , }
-dictNomsDesTypes = { 'I' : 'xs:int', 'R' : 'xs:float', bool : 'xs:boolean' , 'TXM' : 'xs:string', 'Fichier' : 'xs:string', 'Repertoire':'xs:string', 'FichierNoAbs' : 'xs:string', 'FichierOuRepertoire':'xs:string' }
-
-listeParamDeTypeTypeAttendu = ( 'defaut', 'sug', 'val_min', 'val_max', 'into', 'intoSug')
-listeParamDeTypeStr = ('fr', 'docu', 'ang', 'nom' )
-
-listeParamTjsSequence = ('into' , 'intoSug')
-listeParamSelonType = ('defaut', 'sug', 'into', 'intoSug')
+dictPourCast = {
+ "I": int,
+ "R": float,
+ "bool": bool,
+}
+dictNomsDesTypes = {
+ "I": "xs:int",
+ "R": "xs:float",
+ bool: "xs:boolean",
+ "TXM": "xs:string",
+ "Fichier": "xs:string",
+ "Repertoire": "xs:string",
+ "FichierNoAbs": "xs:string",
+ "FichierOuRepertoire": "xs:string",
+}
+dictTypesAccasToPostgres = {
+ "I": "smallint",
+ "R": "float8",
+ bool: "boolean",
+ "TXM": "text",
+ "Fichier": "text",
+ "Repertoire": "text",
+ "FichierNoAbs": "text",
+ "FichierOuRepertoire": "text",
+ "date": "date",
+}
+# en eficas date %Y-%m-%d
+
+listeParamDeTypeTypeAttendu = ("defaut", "sug", "val_min", "val_max", "into", "intoSug")
+listeParamDeTypeStr = ("fr", "docu", "ang", "nom")
+
+listeParamTjsSequence = ("into", "intoSug")
+listeParamSelonType = ("defaut", "sug", "into", "intoSug")
if __name__ == "__main__":
import pprint
- pp=pprint.PrettyPrinter(indent=4)
- print ('dictSIMPEficasXML')
+
+ pp = pprint.PrettyPrinter(indent=4)
+ print("dictSIMPEficasXML")
pp.pprint(dictSIMPEficasXML)
- print ('\n\n')
- print ('dictSIMPXMLEficas')
+ print("\n\n")
+ print("dictSIMPXMLEficas")
pp.pprint(dictSIMPXMLEficas)
- print ('\n\n')
- print ('dictFACTEficasXML')
+ print("\n\n")
+ print("dictFACTEficasXML")
pp.pprint(dictFACTEficasXML)
- print ('\n\n')
- print ('dictFACTXMLEficas')
+ print("\n\n")
+ print("dictFACTXMLEficas")
pp.pprint(dictFACTXMLEficas)
- print ('\n\n')
- print ('dictPROCEficasXML')
+ print("\n\n")
+ print("dictPROCEficasXML")
pp.pprint(dictPROCEficasXML)
- print ('\n\n')
- print ('dictPROCXMLEficas')
+ print("\n\n")
+ print("dictPROCXMLEficas")
pp.pprint(dictPROCXMLEficas)
- print ('\n\n')
- print ('dictNomsDesTypes')
- pp.pprint(dictNomsDesTypes )
+ print("\n\n")
+ print("dictNomsDesTypes")
+ pp.pprint(dictNomsDesTypes)
--- /dev/null
+debuttypeChaineAvecBlancs = '\t\t<xs:simpleType name="T_stg">\n\t\t\t <xs:restriction>\n\t\t\t <xs:simpleType>\n\t\t\t\t <xs:list>\n\t\t\t\t <xs:simpleType>\n\t\t\t\t\t <xs:restriction base="xs:string">'
+fintypeChaineAvecBlancs = '\t\t</xs:restriction>\n\t\t </xs:simpleType>\n\t\t </xs:list>\n\t\t </xs:simpleType>\n\t\t'
+
+SequenceChaineAvecBlancs = '\t\t<xs:complexType name="T_{}">\n\t\t\t <xs:sequence> <xs:element name="stg" type="Vimmp:T_stg" minOccurs="1" maxOccurs="1" default="{}">n\t\t\t <\xs:sequence>\n\t\t<xs:complexType name>\n'
+
+
--- /dev/null
+texteDebut='<?xml version="1.0" encoding="UTF-8"?>\n<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:{}="http://chercheurs.edf.com/logiciels/{}" targetNamespace="http://chercheurs.edf.com/logiciels/{}" elementFormDefault="qualified" attributeFormDefault="qualified"\n>'
+texteFin='</schema>'
+
+# SIMP
+typeSimple = '\t<simpleType name="{}">\n\t\t<restriction base="{}"/>\n\t</simpleType>\n'
+debutTypeSimpleWithInto = '\t<simpleType name="{}">\n\t\t<restriction base="{}">\n'
+typeSimpleWithInto = '\t\t\t<enumeration value="{}"/>\n'
+finTypeSimpleWithInto = '\t\t</restriction>\n\t</simpleType>\n'
+eltDsSequence = '\t\t\t<element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+
+# COMPO
+debutTypeCompo = '\t<complexType name="{}" >\n\t\t<sequence minOccurs="{}" maxOccurs="{}">\n'
+finTypeCompo = '\t\t</sequence>\n\t</complexType>\n'
+eltCompoDsSequence = '\t\t\t<element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+eltCompoDsSequenceSiProc = '\t\t\t<element name="{}" type="{}:{}" />\n'
+
+# BLOC
+debutTypeSubst = '\t<group name="{}"> \n\t\t<sequence>\n'
+finTypeSubst = '\t\t</sequence>\n\t</group>\n'
+substDsSequence = '\t\t\t<group ref="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
+
+
+# CATA
+debutTypeCata = '\t<complexType name="{}">\n\t\t<choice minOccurs="0" maxOccurs="unbounded">\n'
+finTypeCata = '\t\t</choice>\n\t</complexType> '
+eltCata = '\t<element name="{}" type="{}:{}"/>\n'
+
+
+if __name__ == '__main__' :
+ nomElt='Simple'
+ nomDuType='T_Simple'
+ nomDuTypeBase='int'
+ nomDuComplexe='T_Complexe'
+ nomDuCode='monCode'
+ minOccurs=1
+ maxOccurs=1
+
+ texteSimple=typeSimple.format(nomDuType, nomDuTypeBase)
+ texteElt=eltDsSequence.format(nomElt,nomDuCode,nomDuType,minOccurs,maxOccurs)
+
+ minOccurs=0
+ texteComplexe=debutTypeComplexe.format(nomDuComplexe)
+ texteComplexe+=texteElt
+ texteComplexe+=finTypeComplexe
+ texteEltComplexe=eltDsSequence.format(nomElt,nomDuCode,nomDuType,minOccurs,maxOccurs)
+
+ texteCata=debutTypeCata.format(nomDuCode)
+ texteCata+=texteEltComplexe
+ texteCata+=finTypeCata
+
+ eltRacine=eltCata.format(nomDuCode, 'T_'+nomDuCode)
+ print (texteSimple+texteComplexe+texteCata+eltRacine)
--- /dev/null
+# -*- coding: utf-8 -*-
+from raw.efficas import *
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import sys,os
+import raw.efficas as efficas
+import types
+
+sys.path.insert(0,os.path.abspath(os.path.join(os.getcwd(),'..')))
+
+
+from Accas import *
+
+
+# ds l init du SIMP il manque siValide et fenetreIhm
+
+from mapDesTypes import dictSIMPEficasXML, dictSIMPXMLEficas
+from mapDesTypes import dictFACTEficasXML, dictFACTXMLEficas
+from mapDesTypes import dictPROCEficasXML, dictPROCXMLEficas
+from mapDesTypes import dictOPEREficasXML, dictOPERXMLEficas
+from mapDesTypes import dictBLOCEficasXML, dictBLOCXMLEficas
+from mapDesTypes import dictPourCast
+from mapDesTypes import listeParamDeTypeTypeAttendu, listeParamDeTypeStr, dictPourCast
+from mapDesTypes import listeParamTjsSequence, listeParamSelonType
+
+
+# ------------------------------
+class objetDefinitionAccas:
+# ------------------------------
+
+ def argumentXMLToEficas(self):
+ # ---------------------------
+ # Attention, pas de validation pour l instant
+ # il faut verifier la coherence entre les types contenus dans defaut, sug ... et le typeAttendu
+ # tout cela dans une fonction verifie pas faite -)
+
+ # Recuperation parametres
+ self.dictArgsEficas={}
+ for nomXMLArg in dir(self) :
+ if nomXMLArg in self.dictATraiter :
+ nomEficasArg=self.dictATraiter[nomXMLArg]
+ argu=getattr(self,nomXMLArg)
+ if argu==None : continue
+
+ if type(nomEficasArg) == types.DictionaryType:
+ for nomXML in list(nomEficasArg.keys()):
+ arguDecoupe=getattr(argu,nomXML)
+ nomEficasDecoupe=nomEficasArg[nomXML]
+ if arguDecoupe == None : continue
+ self.dictArgsEficas[nomEficasDecoupe]=arguDecoupe
+ else :
+ self.dictArgsEficas[nomEficasArg] = argu
+
+ # Cast dans le bon type des parametres si necessaire
+ if 'min' in list(self.dictArgsEficas.keys()):
+ self.dictArgsEficas['min']=int(self.dictArgsEficas['min'])
+
+ if 'max' in list(self.dictArgsEficas.keys()):
+ if self.dictArgsEficas['max']== -1 : self.dictArgsEficas['max']="**"
+ else : self.dictArgsEficas['max']=int(self.dictArgsEficas['max'])
+
+ for param in list(self.dictArgsEficas.keys()):
+ if param in listeParamDeTypeStr :
+ self.dictArgsEficas[param]=unicode(self.dictArgsEficas[param])
+
+ # En 2.7 a revoir en 3 ? necessaire
+ self.nomObj=str(self.nom)
+
+ def getAccasEquivalent(self):
+ # ---------------------------
+ return self.nomObj, self.objAccas
+#
+
+# ---------------------------------------------------------
+class objetComposeDefinitionAccas (objetDefinitionAccas):
+# ---------------------------------------------------------
+ def exploreArbre(self,cata):
+ # --------------------------
+ liste=[]
+ for obj in self.content(): liste.append(obj)
+ #liste.reverse()
+ # PNPNPN essayer de comprendre reverse ou non
+
+ for obj in liste:
+ if hasattr(obj,'explore') : obj.explore(cata)
+ if hasattr(obj,'getAccasEquivalent') :
+ nom,objetAccas=obj.getAccasEquivalent()
+ self.dictArgsEficas[nom]=objetAccas
+
+# ----------------------------------------------------
+class monSIMP (efficas.T_SIMP, objetDefinitionAccas):
+# ----------------------------------------------------
+
+ def explore(self,cata):
+ # --------------------
+ #print ("je passe dans explore pour SIMP ", self.nom)
+ self.dictATraiter= dictSIMPXMLEficas
+ self.argumentXMLToEficas()
+ #print (self.dictArgsEficas)
+
+
+ self.objAccas=A_SIMP.SIMP(**self.dictArgsEficas)
+ self.objAccas.nom=self.nomObj
+
+ def argumentXMLToEficas(self):
+ # ----------------------------
+ #print self.nom
+ objetDefinitionAccas.argumentXMLToEficas(self)
+
+ if self.attendTuple() :
+ #nbDElts=type(listeDElt[0])
+ print self.nomTypeAttendu
+
+
+ self.traiteLesSequences()
+ #self.convertitLesTypes()
+
+ def attendListe(self):
+ # ---------------
+ if 'max' in self.dictArgsEficas :
+ if self.dictArgsEficas['max'] > 1 : return True
+ if self.dictArgsEficas['max'] == "**" : return True
+ return False
+
+ def attendTuple(self):
+ # -----------------
+ if self.dictArgsEficas['typ'] != 'tuple' : return False
+ return True
+
+ def attendTXM(self):
+ # ----------------
+ if self.dictArgsEficas['typ'] == 'TXM' : return True
+ return False
+
+
+ def traiteLesSequences(self):
+ # ---------------------------
+ listeDeListe=self.attendListe()
+ for param in listeParamTjsSequence :
+ if param in self.dictArgsEficas :
+ if listeDeListe == False:
+ #print ('________________________________')
+ listeDElt=[]
+ for i in range(len(self.dictArgsEficas[param])):
+ # ou typesimple ?
+ # ici on ne sait pas si on est un type simple ou complexe ?
+ listeDElt.append(self.dictArgsEficas[param][i].content()[0])
+ listeRetour=self.convertitListeDsLeBonType(listeDElt)
+ #print (listeRetour)
+ #print ('________________________________')
+ self.dictArgsEficas[param]=listeRetour
+ else :
+ listeResultat=[]
+ # on transforme en liste pour traiter chaque elt de la liste
+ for i in range(len(self.dictArgsEficas[param])):
+ if self.dictArgsEficas[param][i].typesimple != None :
+ lesElts=self.dictArgsEficas[param][i].typesimple
+ else :
+ lesElts=self.dictArgsEficas[param][i].content()
+ if (not(isinstance(lesElts,list)) and not (isinstance(lesElts,tuple))):
+ lesElts=(lesElts,)
+ lesEltsTransformes=self.convertitListeDsLeBonType(lesElts)
+ lesEltsTransformes=self.convertitListeDsLeBonType(lesElts)
+ listeResultat.append(lesEltsTransformes)
+ self.dictArgsEficas[param]=listeResultat
+ #print ('fin de traiteLesSequences pour', self.nom, ' param :', param, 'listeResultat',self.dictArgsEficas[param])
+
+
+ def convertitListeDsLeBonType(self,listeDElt):
+ # -------------------------------------------
+ # Cas des Tuples non traites
+ typeAttendu = self.dictArgsEficas['typ']
+ if typeAttendu in list(dictPourCast.keys()):
+ nouvelleListe=[]
+ castDsLeTypeAttendu=dictPourCast[typeAttendu]
+ for valeurACaster in listeDElt :
+ val=castDsLeTypeAttendu(valeurACaster)
+ nouvelleListe.append(val)
+ return nouvelleListe
+ elif self.attendTuple() :
+ nbDElts=type(listeDElt[0]).n
+
+ else : return listeDElt
+
+
+
+ def convertitLesTypes(self):
+ # ------------------------
+ # Cas des Tuples non traites
+ # Cas des fonctions utilisateurs non traites
+
+ typeAttendu = self.dictArgsEficas['typ']
+ if typeAttendu in list(dictPourCast.keys()):
+ castDsLeTypeAttendu=dictPourCast[typeAttendu]
+ for param in listeParamDeTypeTypeAttendu :
+ if param in list(self.dictArgsEficas.keys()):
+ if param in listeParamEnListeSelonType or param in listeParamTjsEnListe :
+ print ('typeAttendu',typeAttendu)
+ print (self.dictArgsEficas[param])
+ print (self.dictArgsEficas[param].content())
+ print (self.dictArgsEficas[param].content())
+ return
+ valeurACaster=self.dictArgsEficas[param].typesimple
+ if not isinstance(valeurACaster, (list, tuple)) :
+ val=castDsLeTypeAttendu(valeurACaster)
+ self.dictArgsEficas[param]=val
+ else :
+ liste=[]
+ for val in valeurACaster : liste.append(castDsLeTypeAttendu(val))
+ self.dictArgsEficas[param]=liste
+
+
+# -------------------------------------------------------
+class monFACT(efficas.T_FACT, objetComposeDefinitionAccas):
+# -------------------------------------------------------
+ def explore(self,cata):
+ # --------------------
+ #print "je passe dans explore pour FACT ", self.nom
+
+ self.dictATraiter= dictFACTXMLEficas
+ self.argumentXMLToEficas()
+ self.exploreArbre(cata)
+ self.objAccas=A_FACT.FACT(**self.dictArgsEficas)
+
+
+# ---------------------------------------------------------
+class monPROC(efficas.T_PROC, objetComposeDefinitionAccas):
+# ---------------------------------------------------------
+ def explore(self,cata):
+ # --------------------
+ print "je passe dans explore pour PROC ", self.nom
+ self.dictATraiter= dictPROCXMLEficas
+ self.argumentXMLToEficas()
+ self.exploreArbre(cata)
+ self.dictArgsEficas['op']=None
+
+ self.objAccas=A_PROC.PROC(**self.dictArgsEficas)
+ setattr(cata, self.nomObj,self.objAccas)
+ cata.contexteXML[self.nomObj]=self.objAccas
+
+# ---------------------------------------------------------
+class monOPER(efficas.T_OPER, objetComposeDefinitionAccas):
+# ---------------------------------------------------------
+ def explore(self,cata):
+# ------------------------
+ print "je passe dans explore pour OPER", self.nom
+ self.cata=cata
+ self.dictATraiter= dictOPERXMLEficas
+ self.argumentXMLToEficas()
+ self.exploreArbre(cata)
+
+ textCreationClasse='class '+str(self.typeCree)+'(ASSD): pass\n'
+ exec(textCreationClasse,globals())
+ maClasseCreee=globals()[self.typeCree]
+ self.dictArgsEficas['sd_prod'] = maClasseCreee
+ cata.contexteXML[self.typeCree] = maClasseCreee
+
+ self.dictArgsEficas['op'] = None
+ self.objAccas=A_OPER.OPER(**self.dictArgsEficas)
+ setattr(cata, self.nomObj,self.objAccas)
+ cata.contexteXML[self.nomObj] = self.objAccas
+
+# ---------------------------------------------------------
+class monBLOC(efficas.T_BLOC, objetComposeDefinitionAccas):
+# ---------------------------------------------------------
+ def explore(self,cata):
+# ------------------------
+ print ('je passe dans explore pour BLOC', self.nom)
+ self.cata=cata
+ self.dictATraiter= dictBLOCXMLEficas
+ self.argumentXMLToEficas()
+ self.exploreArbre(cata)
+ self.objAccas=A_BLOC.BLOC(**self.dictArgsEficas)
+ setattr(cata, self.nomObj,self.objAccas)
+ cata.contexteXML[self.nomObj] = self.objAccas
+
+# ------------------------------
+class monCata(efficas.T_cata):
+# ------------------------------
+ def exploreCata(self):
+ # PNPNPN --> il faut revoir ce mecanisme
+ self.modeleMetier = None
+ # On positionne le contexte ACCAS
+ self.JdC = JDC_CATA (code = 'Atmo', execmodul = None,)
+ self.contexteXML={}
+ objAExplorer=self.commandes[0]
+ for obj in objAExplorer.content():
+ if hasattr(obj,'explore') : obj.explore(self)
+ #print dir(self.JdC)
+
+
+ #def dumpXSD(self):
+ # for etape in self.contexteXML.values() :
+ # etape.dumpXSD()
+
+efficas.T_SIMP._SetSupersedingClass(monSIMP)
+efficas.T_FACT._SetSupersedingClass(monFACT)
+efficas.T_PROC._SetSupersedingClass(monPROC)
+efficas.T_OPER._SetSupersedingClass(monOPER)
+efficas.T_BLOC._SetSupersedingClass(monBLOC)
+efficas.T_cata._SetSupersedingClass(monCata)
+
+if __name__ == "__main__":
+# print dir(efficas)
+# print dir(efficas.T_SIMP)
+
+ #xml = open('cata_test1.xml').read()
+ with open('cata.xml') as fd :
+ xml=fd.read()
+ SchemaMed = efficas.CreateFromDocument(xml)
+ SchemaMed.exploreCata()
+ #SchemaMed.dumpXSD()
+
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-import sys,os
-import raw.efficas as efficas
-import types
-
-sys.path.insert(0,os.path.abspath(os.path.join(os.getcwd(),'..')))
-
-
-from Accas import *
-
-
-# ds l init du SIMP il manque siValide et fenetreIhm
-
-from mapDesTypes import dictSIMPEficasXML, dictSIMPXMLEficas
-from mapDesTypes import dictFACTEficasXML, dictFACTXMLEficas
-from mapDesTypes import dictPROCEficasXML, dictPROCXMLEficas
-from mapDesTypes import dictOPEREficasXML, dictOPERXMLEficas
-from mapDesTypes import dictBLOCEficasXML, dictBLOCXMLEficas
-from mapDesTypes import dictPourCast
-from mapDesTypes import listeParamDeTypeTypeAttendu, listeParamDeTypeStr, dictPourCast
-from mapDesTypes import listeParamTjsSequence, listeParamSelonType
-
-
-# ------------------------------
-class objetDefinitionAccas:
-# ------------------------------
-
- def argumentXMLToEficas(self):
- # ---------------------------
- # Attention, pas de validation pour l instant
- # il faut verifier la coherence entre les types contenus dans defaut, sug ... et le typeAttendu
- # tout cela dans une fonction verifie pas faite -)
-
- # Recuperation parametres
- self.dictArgsEficas={}
- for nomXMLArg in dir(self) :
- if nomXMLArg in self.dictATraiter :
- nomEficasArg=self.dictATraiter[nomXMLArg]
- argu=getattr(self,nomXMLArg)
- if argu==None : continue
-
- if type(nomEficasArg) == types.DictionaryType:
- for nomXML in list(nomEficasArg.keys()):
- arguDecoupe=getattr(argu,nomXML)
- nomEficasDecoupe=nomEficasArg[nomXML]
- if arguDecoupe == None : continue
- self.dictArgsEficas[nomEficasDecoupe]=arguDecoupe
- else :
- self.dictArgsEficas[nomEficasArg] = argu
-
- # Cast dans le bon type des parametres si necessaire
- if 'min' in list(self.dictArgsEficas.keys()):
- self.dictArgsEficas['min']=int(self.dictArgsEficas['min'])
-
- if 'max' in list(self.dictArgsEficas.keys()):
- if self.dictArgsEficas['max']== -1 : self.dictArgsEficas['max']="**"
- else : self.dictArgsEficas['max']=int(self.dictArgsEficas['max'])
-
- for param in list(self.dictArgsEficas.keys()):
- if param in listeParamDeTypeStr :
- self.dictArgsEficas[param]=unicode(self.dictArgsEficas[param])
-
- # En 2.7 a revoir en 3 ? necessaire
- self.nomObj=str(self.nom)
-
- def getAccasEquivalent(self):
- # ---------------------------
- return self.nomObj, self.objAccas
-#
-
-# ---------------------------------------------------------
-class objetComposeDefinitionAccas (objetDefinitionAccas):
-# ---------------------------------------------------------
- def exploreArbre(self,cata):
- # --------------------------
- liste=[]
- for obj in self.content(): liste.append(obj)
- #liste.reverse()
- # PNPNPN essayer de comprendre reverse ou non
-
- for obj in liste:
- if hasattr(obj,'explore') : obj.explore(cata)
- if hasattr(obj,'getAccasEquivalent') :
- nom,objetAccas=obj.getAccasEquivalent()
- self.dictArgsEficas[nom]=objetAccas
-
-# ----------------------------------------------------
-class monSIMP (efficas.T_SIMP, objetDefinitionAccas):
-# ----------------------------------------------------
-
- def explore(self,cata):
- # --------------------
- #print ("je passe dans explore pour SIMP ", self.nom)
- self.dictATraiter= dictSIMPXMLEficas
- self.argumentXMLToEficas()
- #print (self.dictArgsEficas)
-
-
- self.objAccas=A_SIMP.SIMP(**self.dictArgsEficas)
- self.objAccas.nom=self.nomObj
-
- def argumentXMLToEficas(self):
- # ----------------------------
- #print self.nom
- objetDefinitionAccas.argumentXMLToEficas(self)
-
- if self.attendTuple() :
- #nbDElts=type(listeDElt[0])
- print self.nomTypeAttendu
-
-
- self.traiteLesSequences()
- #self.convertitLesTypes()
-
- def attendListe(self):
- # ---------------
- if 'max' in self.dictArgsEficas :
- if self.dictArgsEficas['max'] > 1 : return True
- if self.dictArgsEficas['max'] == "**" : return True
- return False
-
- def attendTuple(self):
- # -----------------
- if self.dictArgsEficas['typ'] != 'tuple' : return False
- return True
-
- def attendTXM(self):
- # ----------------
- if self.dictArgsEficas['typ'] == 'TXM' : return True
- return False
-
-
- def traiteLesSequences(self):
- # ---------------------------
- listeDeListe=self.attendListe()
- for param in listeParamTjsSequence :
- if param in self.dictArgsEficas :
- if listeDeListe == False:
- #print ('________________________________')
- listeDElt=[]
- for i in range(len(self.dictArgsEficas[param])):
- # ou typesimple ?
- # ici on ne sait pas si on est un type simple ou complexe ?
- listeDElt.append(self.dictArgsEficas[param][i].content()[0])
- listeRetour=self.convertitListeDsLeBonType(listeDElt)
- #print (listeRetour)
- #print ('________________________________')
- self.dictArgsEficas[param]=listeRetour
- else :
- listeResultat=[]
- # on transforme en liste pour traiter chaque elt de la liste
- for i in range(len(self.dictArgsEficas[param])):
- if self.dictArgsEficas[param][i].typesimple != None :
- lesElts=self.dictArgsEficas[param][i].typesimple
- else :
- lesElts=self.dictArgsEficas[param][i].content()
- if (not(isinstance(lesElts,list)) and not (isinstance(lesElts,tuple))):
- lesElts=(lesElts,)
- lesEltsTransformes=self.convertitListeDsLeBonType(lesElts)
- lesEltsTransformes=self.convertitListeDsLeBonType(lesElts)
- listeResultat.append(lesEltsTransformes)
- self.dictArgsEficas[param]=listeResultat
- #print ('fin de traiteLesSequences pour', self.nom, ' param :', param, 'listeResultat',self.dictArgsEficas[param])
-
-
- def convertitListeDsLeBonType(self,listeDElt):
- # -------------------------------------------
- # Cas des Tuples non traites
- typeAttendu = self.dictArgsEficas['typ']
- if typeAttendu in list(dictPourCast.keys()):
- nouvelleListe=[]
- castDsLeTypeAttendu=dictPourCast[typeAttendu]
- for valeurACaster in listeDElt :
- val=castDsLeTypeAttendu(valeurACaster)
- nouvelleListe.append(val)
- return nouvelleListe
- elif self.attendTuple() :
- nbDElts=type(listeDElt[0]).n
-
- else : return listeDElt
-
-
-
- def convertitLesTypes(self):
- # ------------------------
- # Cas des Tuples non traites
- # Cas des fonctions utilisateurs non traites
-
- typeAttendu = self.dictArgsEficas['typ']
- if typeAttendu in list(dictPourCast.keys()):
- castDsLeTypeAttendu=dictPourCast[typeAttendu]
- for param in listeParamDeTypeTypeAttendu :
- if param in list(self.dictArgsEficas.keys()):
- if param in listeParamEnListeSelonType or param in listeParamTjsEnListe :
- print ('typeAttendu',typeAttendu)
- print (self.dictArgsEficas[param])
- print (self.dictArgsEficas[param].content())
- print (self.dictArgsEficas[param].content())
- return
- valeurACaster=self.dictArgsEficas[param].typesimple
- if not isinstance(valeurACaster, (list, tuple)) :
- val=castDsLeTypeAttendu(valeurACaster)
- self.dictArgsEficas[param]=val
- else :
- liste=[]
- for val in valeurACaster : liste.append(castDsLeTypeAttendu(val))
- self.dictArgsEficas[param]=liste
-
-
-# -------------------------------------------------------
-class monFACT(efficas.T_FACT, objetComposeDefinitionAccas):
-# -------------------------------------------------------
- def explore(self,cata):
- # --------------------
- #print "je passe dans explore pour FACT ", self.nom
-
- self.dictATraiter= dictFACTXMLEficas
- self.argumentXMLToEficas()
- self.exploreArbre(cata)
- self.objAccas=A_FACT.FACT(**self.dictArgsEficas)
-
-
-# ---------------------------------------------------------
-class monPROC(efficas.T_PROC, objetComposeDefinitionAccas):
-# ---------------------------------------------------------
- def explore(self,cata):
- # --------------------
- print "je passe dans explore pour PROC ", self.nom
- self.dictATraiter= dictPROCXMLEficas
- self.argumentXMLToEficas()
- self.exploreArbre(cata)
- self.dictArgsEficas['op']=None
-
- self.objAccas=A_PROC.PROC(**self.dictArgsEficas)
- setattr(cata, self.nomObj,self.objAccas)
- cata.contexteXML[self.nomObj]=self.objAccas
-
-# ---------------------------------------------------------
-class monOPER(efficas.T_OPER, objetComposeDefinitionAccas):
-# ---------------------------------------------------------
- def explore(self,cata):
-# ------------------------
- print "je passe dans explore pour OPER", self.nom
- self.cata=cata
- self.dictATraiter= dictOPERXMLEficas
- self.argumentXMLToEficas()
- self.exploreArbre(cata)
-
- textCreationClasse='class '+str(self.typeCree)+'(ASSD): pass\n'
- exec(textCreationClasse,globals())
- maClasseCreee=globals()[self.typeCree]
- self.dictArgsEficas['sd_prod'] = maClasseCreee
- cata.contexteXML[self.typeCree] = maClasseCreee
-
- self.dictArgsEficas['op'] = None
- self.objAccas=A_OPER.OPER(**self.dictArgsEficas)
- setattr(cata, self.nomObj,self.objAccas)
- cata.contexteXML[self.nomObj] = self.objAccas
-
-# ---------------------------------------------------------
-class monBLOC(efficas.T_BLOC, objetComposeDefinitionAccas):
-# ---------------------------------------------------------
- def explore(self,cata):
-# ------------------------
- print ('je passe dans explore pour BLOC', self.nom)
- self.cata=cata
- self.dictATraiter= dictBLOCXMLEficas
- self.argumentXMLToEficas()
- self.exploreArbre(cata)
- self.objAccas=A_BLOC.BLOC(**self.dictArgsEficas)
- setattr(cata, self.nomObj,self.objAccas)
- cata.contexteXML[self.nomObj] = self.objAccas
-
-# ------------------------------
-class monCata(efficas.T_cata):
-# ------------------------------
- def exploreCata(self):
- # PNPNPN --> il faut revoir ce mecanisme
- self.modeleMetier = None
- # On positionne le contexte ACCAS
- self.JdC = JDC_CATA (code = 'Atmo', execmodul = None,)
- self.contexteXML={}
- objAExplorer=self.commandes[0]
- for obj in objAExplorer.content():
- if hasattr(obj,'explore') : obj.explore(self)
- #print dir(self.JdC)
-
-
- #def dumpXSD(self):
- # for etape in self.contexteXML.values() :
- # etape.dumpXSD()
-
-efficas.T_SIMP._SetSupersedingClass(monSIMP)
-efficas.T_FACT._SetSupersedingClass(monFACT)
-efficas.T_PROC._SetSupersedingClass(monPROC)
-efficas.T_OPER._SetSupersedingClass(monOPER)
-efficas.T_BLOC._SetSupersedingClass(monBLOC)
-efficas.T_cata._SetSupersedingClass(monCata)
-
-if __name__ == "__main__":
-# print dir(efficas)
-# print dir(efficas.T_SIMP)
-
- #xml = open('cata_test1.xml').read()
- with open('cata.xml') as fd :
- xml=fd.read()
- SchemaMed = efficas.CreateFromDocument(xml)
- SchemaMed.exploreCata()
- #SchemaMed.dumpXSD()
-
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-from __future__ import absolute_import
-from __future__ import print_function
-try :
- from builtins import str
-except : pass
-import os,traceback
+
+from builtins import str
+import os, traceback
import re
from Noyau.N_CR import CR
from Ihm import I_OBJECT
from Extensions.i18n import tr
-class COMMANDE_COMM(N_OBJECT.OBJECT,I_OBJECT.OBJECT) :
+
+class COMMANDE_COMM(N_OBJECT.OBJECT, I_OBJECT.OBJECT):
"""
Cette classe sert a definir les objets de type Commande commentarisee
"""
+
nature = "COMMANDE_COMMENTARISEE"
- idracine='_comm'
+ idracine = "_comm"
- def __init__(self,texte='',parent=None,reg='oui'):
+ def __init__(self, texte="", parent=None, reg="oui"):
self.valeur = texte
- if not parent :
+ if not parent:
self.jdc = self.parent = CONTEXT.getCurrentStep()
else:
self.jdc = self.parent = parent
- if hasattr(self.parent,'etape'):
+ if hasattr(self.parent, "etape"):
self.etape = self.parent.etape
- else :
+ else:
self.etape = None
- self.definition=self
- self.nom = ''
+ self.definition = self
+ self.nom = ""
self.niveau = self.parent.niveau
- self.actif=1
- self.state="unchanged"
- #self.appel = N_utils.calleeWhere(niveau=2)
- if reg=='oui' : self.register()
+ self.actif = 1
+ self.state = "unchanged"
+ # self.appel = N_utils.calleeWhere(niveau=2)
+ if reg == "oui":
+ self.register()
def isValid(self):
return 1
"""
Genere l'objet rapport (classe CR)
"""
- self.cr=CR()
- if not self.isValid(): self.cr.warn(tr("Objet commande commentarise invalide"))
+ self.cr = CR()
+ if not self.isValid():
+ self.cr.warn(tr("Objet commande commentarise invalide"))
return self.cr
def copy(self):
Retourne une copie de self cad un objet COMMANDE_COMM
"""
# XXX self.texte ne semble pas exister ???
- return COMMANDE_COMM(self.texte,parent = self.parent,reg='non')
+ return COMMANDE_COMM(self.texte, parent=self.parent, reg="non")
def initModif(self):
- self.state = 'modified'
+ self.state = "modified"
self.parent.initModif()
- def setValeur(self,new_valeur):
+ def setValeur(self, new_valeur):
"""
Remplace la valeur de self(si elle existe) par new_valeur)
"""
self.valeur = new_valeur
self.initModif()
- def getValeur(self) :
+ def getValeur(self):
"""
Retourne la valeur de self, cad le texte de la commande commentarisee
"""
"""
return 1
- def getAttribut(self,nom_attribut) :
+ def getAttribut(self, nom_attribut):
"""
Retourne l'attribut de nom nom_attribut de self (ou herite)
"""
- if hasattr(self,nom_attribut) :
- return getattr(self,nom_attribut)
- else :
+ if hasattr(self, nom_attribut):
+ return getattr(self, nom_attribut)
+ else:
return None
def getFr(self):
"""
Retourne l'attribut fr de self.definition
"""
- if self.jdc.code=='ASTER' : return self.definition.fr
- try :
- return getattr(self.definition,self.jdc.lang)
+ if self.jdc.code == "ASTER":
+ return self.definition.fr
+ try:
+ return getattr(self.definition, self.jdc.lang)
except:
- return ''
+ return ""
def listeMcPresents(self):
return []
def supprimeSdProds(self):
pass
- def updateContext(self,d):
+ def updateContext(self, d):
"""
Update le dictionnaire d avec les concepts ou objets produits par self
--> ne fait rien pour une commande en commentaire
"""
pass
- def deleteConcept(self,sd):
+ def deleteConcept(self, sd):
pass
- def replaceConcept (self,old_sd,sd):
+ def replaceConcept(self, old_sd, sd):
pass
- def getSdprods(self,nom_sd):
+ def getSdprods(self, nom_sd):
return None
def unComment(self):
try:
# on essaie de creer un objet JDC...
CONTEXT.unsetCurrentStep()
- if re.search('Fin Commentaire',self.valeur) :
- self.valeur=self.valeur.replace('Fin Commentaire','')
- J=self.jdc.__class__(procedure=self.valeur,
- definition=self.jdc.definition,
- cata=self.jdc.cata,
- cata_ord_dico=self.jdc.cata_ordonne_dico,
- context_ini = context_ini,
- )
+ if re.search("Fin Commentaire", self.valeur):
+ self.valeur = self.valeur.replace("Fin Commentaire", "")
+ J = self.jdc.__class__(
+ procedure=self.valeur,
+ definition=self.jdc.definition,
+ cata=self.jdc.cata,
+ cata_ord_dico=self.jdc.cata_ordonne_dico,
+ context_ini=context_ini,
+ )
J.analyse()
except Exception as e:
traceback.print_exc()
- #self.jdc.set_context()
- raise AsException(tr("Erreur"),e.__str__())
- if len(J.cr.crfatal)>0 :
+ # self.jdc.set_context()
+ raise AsException(tr("Erreur"), e.__str__())
+ if len(J.cr.crfatal) > 0:
# des erreurs fatales ont ete rencontrees
- #self.jdc.set_context()
- print ('erreurs fatales !!!')
- raise AsException(tr("Erreurs fatales"),''.join(J.cr.crfatal))
- if not J.etapes :
+ # self.jdc.set_context()
+ print("erreurs fatales !!!")
+ raise AsException(tr("Erreurs fatales"), "".join(J.cr.crfatal))
+ if not J.etapes:
# des erreurs ont ete rencontrees
- raise AsException(tr("Impossible reconstruire commande\n"),str(J.cr))
- #self.jdc.set_context()
+ raise AsException(tr("Impossible reconstruire commande\n"), str(J.cr))
+ # self.jdc.set_context()
new_etape = J.etapes[0]
- if new_etape.sd :
+ if new_etape.sd:
nom_sd = new_etape.sd.nom
else:
nom_sd = None
- #new_etape=new_etape.copy()
- #print "unComment",new_etape.sd
+ # new_etape=new_etape.copy()
+ # print "unComment",new_etape.sd
- pos=self.parent.etapes.index(self)
+ pos = self.parent.etapes.index(self)
# L'ordre d'appel est important : suppEntite fait le menage des concepts dans les etapes suivantes
- self.parent.addEntite(new_etape,pos)
+ self.parent.addEntite(new_etape, pos)
self.parent.suppEntite(self)
- return new_etape,nom_sd
+ return new_etape, nom_sd
def active(self):
"""
def verifConditionBloc(self):
"""
- Evalue les conditions de tous les blocs fils possibles
- (en fonction du catalogue donc de la definition) de self et
- retourne deux listes :
- - la premiere contient les noms des blocs a rajouter
- - la seconde contient les noms des blocs a supprimer
+ Evalue les conditions de tous les blocs fils possibles
+ (en fonction du catalogue donc de la definition) de self et
+ retourne deux listes :
+ - la premiere contient les noms des blocs a rajouter
+ - la seconde contient les noms des blocs a supprimer
"""
- return [],[]
+ return [], []
- def verifConditionRegles(self,liste_presents):
+ def verifConditionRegles(self, liste_presents):
"""
- Retourne la liste des mots-cles a rajouter pour satisfaire les regles
- en fonction de la liste des mots-cles presents
+ Retourne la liste des mots-cles a rajouter pour satisfaire les regles
+ en fonction de la liste des mots-cles presents
"""
return []
- def reparent(self,parent):
+ def reparent(self, parent):
"""
- Cette methode sert a reinitialiser la parente de l'objet
+ Cette methode sert a reinitialiser la parente de l'objet
"""
- self.parent=parent
- self.jdc=parent.getJdcRoot()
- self.etape=self
+ self.parent = parent
+ self.jdc = parent.getJdcRoot()
+ self.etape = self
def verifExistenceSd(self):
"""
- Verifie que les structures de donnees utilisees dans self existent bien dans le contexte
- avant etape, sinon enleve la reference a ces concepts
- --> sans objet pour les commandes commentarisees
+ Verifie que les structures de donnees utilisees dans self existent bien dans le contexte
+ avant etape, sinon enleve la reference a ces concepts
+ --> sans objet pour les commandes commentarisees
"""
pass
- def controlSdprods(self,d):
+ def controlSdprods(self, d):
"""sans objet pour les commandes commentarisees"""
pass
pour gerer les commentaires dans un JDC
"""
-from __future__ import absolute_import
from Noyau.N_CR import CR
from Noyau import N_OBJECT
from Ihm import I_OBJECT
from Extensions.i18n import tr
-class COMMENTAIRE(N_OBJECT.OBJECT,I_OBJECT.OBJECT) :
+
+class COMMENTAIRE(N_OBJECT.OBJECT, I_OBJECT.OBJECT):
"""
- Cette classe permet de creer des objets de type COMMENTAIRE
+ Cette classe permet de creer des objets de type COMMENTAIRE
"""
- nature = 'COMMENTAIRE'
- idracine = '_comm'
- def __init__(self,valeur,parent=None):
+ nature = "COMMENTAIRE"
+ idracine = "_comm"
+
+ def __init__(self, valeur, parent=None):
# parent est un objet de type OBJECT (ETAPE ou MC ou JDC...)
- self.valeur=valeur
- if not parent :
+ self.valeur = valeur
+ if not parent:
self.jdc = self.parent = CONTEXT.getCurrentStep()
else:
self.jdc = self.parent = parent
# La classe COMMENTAIRE n'a pas de definition. On utilise self
# pour completude
- self.definition=self
- self.nom=''
+ self.definition = self
+ self.nom = ""
self.niveau = self.parent.niveau
- self.actif=1
- self.state="unchanged"
+ self.actif = 1
+ self.state = "unchanged"
self.register()
- self.fenetreIhm=None
+ self.fenetreIhm = None
def register(self):
"""
- Enregistre le commentaire dans la liste des etapes de son parent
- lorsque celui-ci est un JDC
+ Enregistre le commentaire dans la liste des etapes de son parent
+ lorsque celui-ci est un JDC
"""
- if self.parent.nature == 'JDC':
+ if self.parent.nature == "JDC":
# le commentaire est entre deux commandes:
# il faut l'enregistrer dans la liste des etapes
self.parent.register(self)
def copy(self):
- c=COMMENTAIRE(valeur=self.valeur,parent=self.jdc)
+ c = COMMENTAIRE(valeur=self.valeur, parent=self.jdc)
return c
def isValid(self):
return 1
def isOblig(self):
- """ Indique si self est obligatoire ou non : retourne toujours 0 """
+ """Indique si self est obligatoire ou non : retourne toujours 0"""
return 0
def isRepetable(self):
- """ Indique si self est repetable ou non : retourne toujours 1 """
+ """Indique si self est repetable ou non : retourne toujours 1"""
return 1
def active(self):
Methode qui supprime toutes les boucles de references afin que
l'objet puisse etre correctement detruit par le garbage collector
"""
- self.parent=None
- self.jdc=None
+ self.parent = None
+ self.jdc = None
self.definition = None
self.niveau = None
def listeMcPresents(self):
return []
- def getValeur(self) :
- """ Retourne la valeur de self, cad le contenu du commentaire """
- try :
+ def getValeur(self):
+ """Retourne la valeur de self, cad le contenu du commentaire"""
+ try:
return self.valeur
except:
return None
- def setValeur(self,new_valeur):
+ def setValeur(self, new_valeur):
"""
- Remplace la valeur de self(si elle existe) par new_valeur
+ Remplace la valeur de self(si elle existe) par new_valeur
"""
self.valeur = new_valeur
self.initModif()
def initModif(self):
- self.state = 'modified'
+ self.state = "modified"
if self.parent:
self.parent.initModif()
def supprimeSdProds(self):
pass
- def updateContext(self,d):
+ def updateContext(self, d):
"""
- Update le dictionnaire d avec les concepts ou objets produits par self
- --> ne fait rien pour un commentaire
+ Update le dictionnaire d avec les concepts ou objets produits par self
+ --> ne fait rien pour un commentaire
"""
pass
def report(self):
- """ Genere l'objet rapport (classe CR) """
- self.cr=CR()
- if not self.isValid(): self.cr.warn(tr("Objet commentaire non valorise"))
+ """Genere l'objet rapport (classe CR)"""
+ self.cr = CR()
+ if not self.isValid():
+ self.cr.warn(tr("Objet commentaire non valorise"))
return self.cr
def ident(self):
- """ Retourne le nom interne associe a self
- Ce nom n'est jamais vu par l'utilisateur dans EFICAS
+ """Retourne le nom interne associe a self
+ Ce nom n'est jamais vu par l'utilisateur dans EFICAS
"""
return self.nom
- def deleteConcept(self,sd):
+ def deleteConcept(self, sd):
pass
- def replaceConcept (self,old_sd,sd):
+ def replaceConcept(self, old_sd, sd):
pass
def verifConditionBloc(self):
"""
- Evalue les conditions de tous les blocs fils possibles
- (en fonction du catalogue donc de la definition) de self et
- retourne deux listes :
- - la premiere contient les noms des blocs a rajouter
- - la seconde contient les noms des blocs a supprimer
+ Evalue les conditions de tous les blocs fils possibles
+ (en fonction du catalogue donc de la definition) de self et
+ retourne deux listes :
+ - la premiere contient les noms des blocs a rajouter
+ - la seconde contient les noms des blocs a supprimer
"""
- return [],[]
+ return [], []
- def verifConditionRegles(self,liste_presents):
+ def verifConditionRegles(self, liste_presents):
"""
- Retourne la liste des mots-cles a rajouter pour satisfaire les regles
- en fonction de la liste des mots-cles presents
+ Retourne la liste des mots-cles a rajouter pour satisfaire les regles
+ en fonction de la liste des mots-cles presents
"""
return []
- def getSdprods(self,nom_sd):
+ def getSdprods(self, nom_sd):
"""
- Retourne les concepts produits par la commande
+ Retourne les concepts produits par la commande
"""
return None
"""
Retourne le commentaire lui meme tronque a la 1ere ligne
"""
- return self.valeur.split('\n',1)[0]
+ return self.valeur.split("\n", 1)[0]
- def controlSdprods(self,d):
- """sans objet """
+ def controlSdprods(self, d):
+ """sans objet"""
pass
def close(self):
the ``i18n`` module.
"""
-from __future__ import absolute_import
+
class EficasException(Exception):
"""
``EficasException`` class, which embeds the translation mechanism.
have no effect, since its input would not be among the source
strings to be translated.
"""
+
def __init__(self, msg=""):
"""
Initializes the EficasException instances. The output message,
mechanism.
"""
Exception.__init__(self)
- #import sys, os
- #sys.path.append(os.path.realpath(".."))
+ # import sys, os
+ # sys.path.append(os.path.realpath(".."))
from Extensions.i18n import tr
+
self.args = (tr(msg),)
if __name__ == "__main__":
import sys
+
raise EficasException(sys.argv[1])
Ce module contient la classe ETAPE_NIVEAU qui sert a
concretiser les niveaux au sein d'un JDC
"""
-from __future__ import absolute_import
import traceback
-
from Noyau import N_OBJECT
-class ETAPE_NIVEAU(N_OBJECT.OBJECT):
- def __init__(self,niveau,parent):
+class ETAPE_NIVEAU(N_OBJECT.OBJECT):
+ def __init__(self, niveau, parent):
self.parent = parent
self.jdc = self.parent.getJdcRoot()
self.niveau = self
self.definition = niveau
- self.etapes=[]
+ self.etapes = []
self.etapes_niveaux = []
- self.dict_niveaux={}
+ self.dict_niveaux = {}
self.editmode = 0
- self.state="undetermined"
+ self.state = "undetermined"
self.buildNiveaux()
def buildNiveaux(self):
- for niveau in self.definition.l_niveaux:
- etape_niveau = ETAPE_NIVEAU(niveau,self)
+ for niveau in self.definition.lNiveaux:
+ etape_niveau = ETAPE_NIVEAU(niveau, self)
self.etapes_niveaux.append(etape_niveau)
- self.dict_niveaux[niveau.nom]=etape_niveau
+ self.dict_niveaux[niveau.nom] = etape_niveau
- def register(self,etape):
+ def register(self, etape):
"""
- Enregistre la commande etape :
- - si editmode = 0 : on est en mode relecture d'un fichier de commandes
- auquel cas on ajoute etape a la fin de la liste self.etapes
- - si editmode = 1 : on est en mode ajout d'etape depuis eficas auquel cas
- cette methode ne fait rien, c'est addEntite qui enregistre etape
- a la bonne place dans self.etapes
+ Enregistre la commande etape :
+ - si editmode = 0 : on est en mode relecture d'un fichier de commandes
+ auquel cas on ajoute etape a la fin de la liste self.etapes
+ - si editmode = 1 : on est en mode ajout d'etape depuis eficas auquel cas
+ cette methode ne fait rien, c'est addEntite qui enregistre etape
+ a la bonne place dans self.etapes
"""
- if self.editmode : return
+ if self.editmode:
+ return
self.etapes.append(etape)
- def unregister(self,etape):
+ def unregister(self, etape):
"""
- Desenregistre l'etape du niveau
+ Desenregistre l'etape du niveau
"""
self.etapes.remove(etape)
return self.definition.label
def isActif(self):
- #print 'Niveau : ',self.definition.nom
- #print '\tactif =',self.definition.actif
- if self.definition.actif == 1 :
+ # print 'Niveau : ',self.definition.nom
+ # print '\tactif =',self.definition.actif
+ if self.definition.actif == 1:
return 1
- else :
+ else:
# self.actif est une condition a evaluer dans un certain contexte ...
d = self.creeDictValeurs()
try:
- t=eval(self.definition.actif,d)
+ t = eval(self.definition.actif, d)
return t
except:
traceback.print_exc()
Retourne le dictionnaire des freres aines de self compose des couples :
{nom_frere isValid()}
"""
- d={}
+ d = {}
for niveau in self.parent.etapes_niveaux:
- if niveau is self : break
- d[niveau.definition.nom]=niveau.isValid()
+ if niveau is self:
+ break
+ d[niveau.definition.nom] = niveau.isValid()
return d
def isValid(self):
- """ Methode booleenne qui retourne 0 si le niveau est invalide, 1 sinon """
+ """Methode booleenne qui retourne 0 si le niveau est invalide, 1 sinon"""
if self.etapes_niveaux == []:
if len(self.etapes) == 0:
return self.definition.valide_vide
else:
- for etape in self.etapes :
- if not etape.isValid() : return 0
+ for etape in self.etapes:
+ if not etape.isValid():
+ return 0
return 1
else:
- for etape_niveau in self.etapes_niveaux :
- if not etape_niveau.isValid() : return 0
+ for etape_niveau in self.etapes_niveaux:
+ if not etape_niveau.isValid():
+ return 0
return 1
- def accept(self,visitor):
+ def accept(self, visitor):
visitor.visitETAPE_NIVEAU(self)
- def addEntite(self,name,pos_rel):
+ def addEntite(self, name, pos_rel):
self.editmode = 1
- try :
- pos_abs=self.jdc.getNbEtapesAvant(self)+pos_rel
- cmd = self.jdc.addEntite(name,pos_abs)
- self.etapes.insert(pos_rel,cmd)
+ try:
+ pos_abs = self.jdc.getNbEtapesAvant(self) + pos_rel
+ cmd = self.jdc.addEntite(name, pos_abs)
+ self.etapes.insert(pos_rel, cmd)
self.editmode = 0
return cmd
except:
self.editmode = 0
return None
- def suppEntite(self,etape) :
- """ Classe ETAPE_NIVEAU
- Supprime une etape
+ def suppEntite(self, etape):
+ """Classe ETAPE_NIVEAU
+ Supprime une etape
"""
self.jdc.suppEntite(etape)
-
def getFr(self):
"""
- Retourne le texte d'aide dans la langue choisie
+ Retourne le texte d'aide dans la langue choisie
"""
- try :
- return getattr(self.definition,self.jdc.lang)
+ try:
+ return getattr(self.definition, self.jdc.lang)
except:
- return ''
+ return ""
It is usable from both Qt and non-Qt environments.
``PyQt4`` is currently supported.
"""
-from __future__ import absolute_import
from .translation import tr, tr_qt
from .localisation import localise
-__all__ = ['tr', 'tr_qt', 'localise']
+__all__ = ["tr", "tr_qt", "localise"]
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-from __future__ import absolute_import
-from __future__ import print_function
-try :
- from builtins import str
- from builtins import object
-except : pass
+from builtins import str
+from builtins import object
-import re,sys,types
+import re, sys, types
from Noyau.N_CR import CR
from Extensions.i18n import tr
-#def group(*choices): return '(' + ''.join(choices, '|') + ')'
-#def any(*choices): return apply(group, choices) + '*'
-#def maybe(*choices): return apply(group, choices) + '?'
+# def group(*choices): return '(' + ''.join(choices, '|') + ')'
+# def any(*choices): return apply(group, choices) + '*'
+# def maybe(*choices): return apply(group, choices) + '?'
-Intnumber = r'[1-9]\d*'
-Exponent = r'[eEdD][-+]?\d+'
-Expfloat = r'[1-9]\d*' + Exponent
-#Pointfloat = group(r'\d+\.\d*', r'\.\d+') + maybe(Exponent)
-#Floatnumber = group(Pointfloat, Expfloat)
-Pointfloat=r'(\d+\.\d*|\.\d+)([eEdD][-+]?\d+)?'
-Floatnumber=r'((\d+\.\d*|\.\d+)([eEdD][-+]?\d+)?|[1-9]\d*[eEdD][-+]?\d+)'
+Intnumber = r"[1-9]\d*"
+Exponent = r"[eEdD][-+]?\d+"
+Expfloat = r"[1-9]\d*" + Exponent
+# Pointfloat = group(r'\d+\.\d*', r'\.\d+') + maybe(Exponent)
+# Floatnumber = group(Pointfloat, Expfloat)
+Pointfloat = r"(\d+\.\d*|\.\d+)([eEdD][-+]?\d+)?"
+Floatnumber = r"((\d+\.\d*|\.\d+)([eEdD][-+]?\d+)?|[1-9]\d*[eEdD][-+]?\d+)"
-pat_number = re.compile(r'^([+-]?)([0-9]+)(\.\d*)?(.*)')
-pat_number_complet = re.compile(r'^([+-]?)([0-9]+)(\.\d*)?([eEdD][+-]?\d+)(.*)')
-pat_constante = re.compile(r'^([+-]?)([a-zA-Z][a-zA-Z_0-9]*\s*)(.*)')
+pat_number = re.compile(r"^([+-]?)([0-9]+)(\.\d*)?(.*)")
+pat_number_complet = re.compile(r"^([+-]?)([0-9]+)(\.\d*)?([eEdD][+-]?\d+)(.*)")
+pat_constante = re.compile(r"^([+-]?)([a-zA-Z][a-zA-Z_0-9]*\s*)(.*)")
-def cmp_function(arg1,arg2):
+
+def cmp_function(arg1, arg2):
"""
Fonction de comparaison permettant de classer les listes de
fonctions unaires et binaires selon la longueur de leurs arguments
else:
return 1
+
class InterpreteurException(Exception):
"""
Classe servant a definir les exceptions levees par l'interpreteur de formule
"""
- def __init__(self,args=None):
+
+ def __init__(self, args=None):
self.args = args
def __str__(self):
return str(self.args)
+
class Interpreteur_Formule(object):
"""
Cette classe sert a construire un interpreteur de formules Aster
"""
- l_fonctions_binaires = ['+','-','*','/','**','=','MOD','MIN','MAX','ATAN2']
- l_fonctions_unaires = ['+','-','INT','REAL','AIMAG','ABS','SQRT','EXP','LOG',
- 'LOG10','SIN','COS','TAN','ASIN','ACOS','ATAN','SINH',
- 'COSH','TANH','HEAVYSID']
- l_constantes = ['PI','RD_RG','DG_RD']
- def __init__(self,formule=None,constantes=[],fonctions=[],parent=None):
+ l_fonctions_binaires = ["+", "-", "*", "/", "**", "=", "MOD", "MIN", "MAX", "ATAN2"]
+ l_fonctions_unaires = [
+ "+",
+ "-",
+ "INT",
+ "REAL",
+ "AIMAG",
+ "ABS",
+ "SQRT",
+ "EXP",
+ "LOG",
+ "LOG10",
+ "SIN",
+ "COS",
+ "TAN",
+ "ASIN",
+ "ACOS",
+ "ATAN",
+ "SINH",
+ "COSH",
+ "TANH",
+ "HEAVYSID",
+ ]
+ l_constantes = ["PI", "RD_RG", "DG_RD"]
+
+ def __init__(self, formule=None, constantes=[], fonctions=[], parent=None):
"""
Constructeur d'interpreteurs de formule Aster
- formule = tuple (nom,type,arguments,corps)
self.l_operateurs = []
self.parent = parent
self.l_children = []
- if formule :
+ if formule:
self.setFormule(formule)
- if self.parent :
+ if self.parent:
self.parent.enregistre(self)
- def setFormule(self,formule):
+ def setFormule(self, formule):
"""
Stocke formule (tuple) dans l'attribut t_formule
Methode externe
"""
- #if type(formule) != types.TupleType:
+ # if type(formule) != types.TupleType:
if type(formule) != types.tuple:
- raise InterpreteurException(tr("La formule passee a l'interpreteur doit etre sous forme de tuple"))
+ raise InterpreteurException(
+ tr("La formule passee a l'interpreteur doit etre sous forme de tuple")
+ )
self.t_formule = formule
- #self.initCr()
+ # self.initCr()
self.modifyListes()
self.ordonneListes()
Initialise le cr,cad valorise les chaines debut et fin
"""
nom = self.t_formule[0]
- if nom :
- if nom[0] in ('+','-') : nom = nom[1:]
+ if nom:
+ if nom[0] in ("+", "-"):
+ nom = nom[1:]
self.cr.debut = tr("Debut Fonction %s", nom)
self.cr.fin = tr("Fin Fonction %s", nom)
l_txt.append(txt)
return l_txt
- def report(self,decalage=1):
+ def report(self, decalage=1):
"""
Retourne le rapport de FORMULE
"""
txt = self.cr.report()
return txt
- def enregistre(self,fils):
+ def enregistre(self, fils):
"""
Enregistre un operateur fils dans la liste des children
"""
Methode externe
"""
self.l_operateurs = []
- self.cr.purge() # on vide le cr
- self.initCr() # on initialise le cr
+ self.cr.purge() # on vide le cr
+ self.initCr() # on initialise le cr
self.interpreteFormule()
return self.cr.estvide()
Realise l'interpretation du corps de la formule
"""
texte = self.t_formule[3]
- if not texte : return
+ if not texte:
+ return
if type(texte) != list:
- texte = [texte,]
+ texte = [
+ texte,
+ ]
for text_arg in texte:
- text_arg = text_arg.replace('\n','')
+ text_arg = text_arg.replace("\n", "")
# Enleve les espaces
- text_arg = text_arg.replace(' ','')
+ text_arg = text_arg.replace(" ", "")
try:
self.l_operateurs.append(self.splitOperateurs(text_arg))
except InterpreteurException as e:
args = self.t_formule[2]
# l'interpreteur de formule sert aussi a evaluer les EVAL
# dans ce cas il n'y a pas d'arguments puisque pas de fonction ...
- if args :
- args = args[1:-1] # on enleve les parentheses ouvrante et fermante
- l_args = args.split(',')
+ if args:
+ args = args[1:-1] # on enleve les parentheses ouvrante et fermante
+ l_args = args.split(",")
for arg in l_args:
- typ,nom = arg.split(':')
+ typ, nom = arg.split(":")
nom = nom.strip()
self.l_constantes.append(nom)
# on considere que les fonctions unaires de base sont toutes a un seul argument :
l_f = []
self.d_fonctions_unaires = {}
for fct in self.l_fonctions_unaires:
- self.d_fonctions_unaires[fct]=1
+ self.d_fonctions_unaires[fct] = 1
# on ajoute les constantes externes
for cte in self.new_constantes:
self.l_constantes.append(cte)
# on ajoute les fonctions unaires externes au dictionnaire des fonctions unaires
for new_fonc in self.new_fonctions_unaires:
self.d_fonctions_unaires[new_fonc[0]] = self.getNbArgs(new_fonc)
- #self.d_fonctions_unaires.update(self.new_fonctions_unaires)
+ # self.d_fonctions_unaires.update(self.new_fonctions_unaires)
self.l_fonctions_unaires = list(self.d_fonctions_unaires.keys())
def ordonneListes(self):
self.l_fonctions_unaires.sort(cmp_function)
self.l_constantes.sort(cmp_function)
-
- def splitOperateurs(self,texte):
+ def splitOperateurs(self, texte):
"""
Splite le texte passe en argument en operateurs plus elementaires.
N'analyse pas l'interieur des operateurs (ne fait qu'une passe)
texte = texte.strip()
# on recherche un nombre en debut de texte
try:
- oper,reste = self.chercheNombre(texte)
+ oper, reste = self.chercheNombre(texte)
except InterpreteurException as e:
- raise InterpreteurException (e.__str__())
- if not oper :
+ raise InterpreteurException(e.__str__())
+ if not oper:
# on recherche une constante en debut de texte
try:
- oper,reste = self.chercheConstante(texte)
+ oper, reste = self.chercheConstante(texte)
except InterpreteurException as e:
- raise InterpreteurException (e.__str__())
- if not oper :
+ raise InterpreteurException(e.__str__())
+ if not oper:
# on recherche une expression entre parentheses...
try:
- oper,reste = self.chercheExpressionEntreParentheses(texte)
+ oper, reste = self.chercheExpressionEntreParentheses(texte)
except InterpreteurException as e:
raise InterpreteurException(e.__str__())
- if not oper :
+ if not oper:
# on recherche le debut d'un operateur unaire en debut de texte
try:
- oper,reste = self.chercheOperateurUnaire(texte)
+ oper, reste = self.chercheOperateurUnaire(texte)
except InterpreteurException as e:
raise InterpreteurException(e.__str__())
- if not oper :
- type_objet,nom_objet = self.getType(texte)
- if type_objet == 'constante':
- raise InterpreteurException( "Constante %s inconnue" %nom_objet)
- elif type_objet == 'fonction':
- raise InterpreteurException( "Fonction %s inconnue dans %s" %(nom_objet,texte))
+ if not oper:
+ type_objet, nom_objet = self.getType(texte)
+ if type_objet == "constante":
+ raise InterpreteurException(
+ "Constante %s inconnue" % nom_objet
+ )
+ elif type_objet == "fonction":
+ raise InterpreteurException(
+ "Fonction %s inconnue dans %s" % (nom_objet, texte)
+ )
else:
- raise InterpreteurException( "Impossible d'interpreter : %s" %texte)
+ raise InterpreteurException(
+ "Impossible d'interpreter : %s" % texte
+ )
# on a trouve un operateur (nombre, constante ou unaire)
# il faut encore verifier que l'on est en fin de texte ou qu'il est bien suivi
# d'un operateur binaire
l_operateurs.append(oper)
- if reste :
+ if reste:
texte = reste.strip()
- oper,reste = self.chercheOperateurBinaire(texte)
- if not oper :
+ oper, reste = self.chercheOperateurBinaire(texte)
+ if not oper:
# on a un reste et pas d'operateur binaire --> erreur
- raise InterpreteurException("L'operateur %s doit etre suivi d'un operateur binaire" %l_operateurs[-1])
+ raise InterpreteurException(
+ "L'operateur %s doit etre suivi d'un operateur binaire"
+ % l_operateurs[-1]
+ )
else:
# on a bien trouve un operateur binaire:
l_operateurs.append(oper)
# on a fini d'analyser texte
return l_operateurs
- def chercheNombre(self,texte):
+ def chercheNombre(self, texte):
"""
Cherche un nombre en debut de texte
Retourne ce nombre et le reste ou None et le texte initial
sgn = l_groups[0]
nb = l_groups[1]
if l_groups[2]:
- nb = nb+l_groups[2]
+ nb = nb + l_groups[2]
if l_groups[3]:
- nb = nb+l_groups[3]
- nombre = sgn+nb
- return nombre,l_groups[4]
+ nb = nb + l_groups[3]
+ nombre = sgn + nb
+ return nombre, l_groups[4]
else:
m = pat_number.match(texte)
- if m :
+ if m:
# on a trouve un nombre sans exposant
l_groups = m.groups()
sgn = l_groups[0]
nb = l_groups[1]
if l_groups[2]:
- nb = nb+l_groups[2]
- nombre = sgn+nb
+ nb = nb + l_groups[2]
+ nombre = sgn + nb
# il faut verifier si ce nombre n'est pas suivi d'un exposant incomplet ...
reste = l_groups[3].strip()
- if reste == '':
- return nombre,l_groups[3]
- if reste[0] in ('e','E','d','D') :
- raise InterpreteurException("La syntaxe de l'exposant de %s est erronee " %nb)
+ if reste == "":
+ return nombre, l_groups[3]
+ if reste[0] in ("e", "E", "d", "D"):
+ raise InterpreteurException(
+ "La syntaxe de l'exposant de %s est erronee " % nb
+ )
else:
- return nombre,l_groups[3]
+ return nombre, l_groups[3]
else:
# on n'a pas trouve de nombre
- return None,texte
+ return None, texte
- def chercheConstanteOld(self,texte):
+ def chercheConstanteOld(self, texte):
"""
Recherche une constante en debut de texte parmi la liste des constantes.
Retourne le texte representant la constante et le reste du texte ou
texte = texte.strip()
for cte in self.l_constantes:
index = texte.find(cte)
- #if index == 0 : print 'on a trouve %s dans %s en %d' %(cte,texte,index)
- if index == 0 :
+ # if index == 0 : print 'on a trouve %s dans %s en %d' %(cte,texte,index)
+ if index == 0:
txt = cte
- zz,reste = texte.split(cte,1)
+ zz, reste = texte.split(cte, 1)
break
- if txt :
- return txt,reste
+ if txt:
+ return txt, reste
else:
# aucune constante trouvee
- return None,texte
+ return None, texte
- def chercheConstante(self,texte):
+ def chercheConstante(self, texte):
"""
Recherche une constante en debut de texte parmi la liste des constantes.
Retourne le texte representant la constante et le reste du texte ou
txt = None
texte = texte.strip()
m = pat_constante.match(texte)
- if m :
+ if m:
# on a trouve un identificateur en debut de texte
l_groups = m.groups()
sgn = l_groups[0]
identificateur = l_groups[1].strip()
reste = l_groups[2]
# il faut verifier qu'il ne s'agit pas d'un appel a une fonction
- if reste :
- if reste[0] == '(' :
+ if reste:
+ if reste[0] == "(":
# --> appel de fonction
- return None,texte
+ return None, texte
# il faut encore verifier qu'elle est bien dans la liste des constantes...
- if identificateur not in self.l_constantes :
- raise InterpreteurException("La constante %s est inconnue dans %s" %(identificateur,texte))
+ if identificateur not in self.l_constantes:
+ raise InterpreteurException(
+ "La constante %s est inconnue dans %s" % (identificateur, texte)
+ )
else:
- return sgn+identificateur,reste
+ return sgn + identificateur, reste
else:
# aucune constante trouvee
- return None,texte
+ return None, texte
- def chercheArgs(self,texte):
+ def chercheArgs(self, texte):
"""
Cherche au debut de texte une liste d'arguments entre parentheses
"""
- if texte[0]!='(':
- return None,texte
+ if texte[0] != "(":
+ return None, texte
else:
- n=0
- cpt=1
+ n = 0
+ cpt = 1
while cpt != 0:
- n=n+1
- if n>= len(texte):
+ n = n + 1
+ if n >= len(texte):
# on a atteint la fin de texte sans avoir trouve la parenthese fermante --> erreur
- raise InterpreteurException("Manque parenthese fermante dans %s" %texte)
- if texte[n] == '(':
- cpt=cpt+1
- elif texte[n]==')':
- cpt=cpt-1
- if (n+1 < len(texte)):
- return texte[0:n+1],texte[n+1:]
+ raise InterpreteurException(
+ "Manque parenthese fermante dans %s" % texte
+ )
+ if texte[n] == "(":
+ cpt = cpt + 1
+ elif texte[n] == ")":
+ cpt = cpt - 1
+ if n + 1 < len(texte):
+ return texte[0 : n + 1], texte[n + 1 :]
else:
# on a fini d'analyser le texte : reste = None
- return texte,None
+ return texte, None
- def chercheOperateurUnaireOld(self,texte):
+ def chercheOperateurUnaireOld(self, texte):
"""
Cherche dans texte un operateur unaire
"""
texte = texte.strip()
for oper in self.l_fonctions_unaires:
index = texte.find(oper)
- if index == 0 :
+ if index == 0:
txt = oper
- zz,reste = texte.split(oper,1)
+ zz, reste = texte.split(oper, 1)
break
- if txt :
- #print 'on a trouve :',txt
+ if txt:
+ # print 'on a trouve :',txt
operateur = txt
texte = reste
try:
- args,reste = self.chercheArgs(texte)
+ args, reste = self.chercheArgs(texte)
except InterpreteurException as e:
raise InterpreteurException(e.__str__())
- if not args :
+ if not args:
# operateur unaire sans arguments
- raise InterpreteurException('operateur unaire %s sans arguments' %operateur)
+ raise InterpreteurException(
+ "operateur unaire %s sans arguments" % operateur
+ )
else:
- #operateur = operateur+args
- args = self.splitArgs(txt,args,self.d_fonctions_unaires[operateur])
- formule_operateur = (txt,'',self.t_formule[2],args)
- operateur = Interpreteur_Formule(formule = formule_operateur,
- constantes = self.new_constantes,
- fonctions_unaires = self.new_fonctions_unaires,
- parent = self)
+ # operateur = operateur+args
+ args = self.splitArgs(txt, args, self.d_fonctions_unaires[operateur])
+ formule_operateur = (txt, "", self.t_formule[2], args)
+ operateur = Interpreteur_Formule(
+ formule=formule_operateur,
+ constantes=self.new_constantes,
+ fonctions_unaires=self.new_fonctions_unaires,
+ parent=self,
+ )
operateur.interpreteFormule()
texte = reste
- return operateur,reste
+ return operateur, reste
else:
# aucun operateur unaire trouve
- return None,texte
+ return None, texte
- def chercheOperateurUnaire(self,texte):
+ def chercheOperateurUnaire(self, texte):
"""
Cherche dans texte un operateur unaire
"""
txt = None
texte = texte.strip()
m = pat_constante.match(texte)
- if m :
+ if m:
# on a trouve un identificateur en debut de texte
# il faut encore verifier que l'on a bien a faire a un appel de fonction ...
l_groups = m.groups()
identificateur = l_groups[1].strip()
reste = l_groups[2]
try:
- args,reste = self.chercheArgs(reste)
+ args, reste = self.chercheArgs(reste)
except InterpreteurException as e:
- raise InterpreteurException (e.__str__())
- if not args :
+ raise InterpreteurException(e.__str__())
+ if not args:
# operateur unaire sans arguments
# en principe on ne doit jamais etre dans ce cas car il est deja trappe par chercheConstante ...
- raise InterpreteurException ('Fonction %s sans arguments !' %identificateur)
+ raise InterpreteurException(
+ "Fonction %s sans arguments !" % identificateur
+ )
else:
# il faut encore verifier que l'on a bien a faire a une fonction connue
if identificateur not in self.l_fonctions_unaires:
- raise InterpreteurException ('Fonction %s inconnue dans %s !' %(identificateur,texte))
- args = self.splitArgs(identificateur,args,self.d_fonctions_unaires[identificateur])
- formule_operateur = (sgn+identificateur,'',self.t_formule[2],args)
- operateur = Interpreteur_Formule(formule = formule_operateur,
- constantes = self.new_constantes,
- fonctions = self.new_fonctions_unaires,
- parent = self)
+ raise InterpreteurException(
+ "Fonction %s inconnue dans %s !" % (identificateur, texte)
+ )
+ args = self.splitArgs(
+ identificateur, args, self.d_fonctions_unaires[identificateur]
+ )
+ formule_operateur = (sgn + identificateur, "", self.t_formule[2], args)
+ operateur = Interpreteur_Formule(
+ formule=formule_operateur,
+ constantes=self.new_constantes,
+ fonctions=self.new_fonctions_unaires,
+ parent=self,
+ )
operateur.interpreteFormule()
texte = reste
- return operateur,reste
- elif texte[0] == '-':
+ return operateur, reste
+ elif texte[0] == "-":
# Il faut pouvoir trapper les expressions du type exp(-(x+1)) ...
- try :
- args,reste = self.chercheArgs(texte[1:])
+ try:
+ args, reste = self.chercheArgs(texte[1:])
except InterpreteurException as e:
- raise InterpreteurException (e.__str__())
- if not args :
+ raise InterpreteurException(e.__str__())
+ if not args:
# Il ne s'agit pas de '-' comme operateur unaire --> on retourne None
- return None,texte
+ return None, texte
else:
- identificateur = '-'
- args = self.splitArgs(identificateur,args,self.d_fonctions_unaires[identificateur])
- formule_operateur = (identificateur,'',self.t_formule[2],args)
- operateur = Interpreteur_Formule(formule = formule_operateur,
- constantes = self.new_constantes,
- fonctions = self.new_fonctions_unaires,
- parent = self)
+ identificateur = "-"
+ args = self.splitArgs(
+ identificateur, args, self.d_fonctions_unaires[identificateur]
+ )
+ formule_operateur = (identificateur, "", self.t_formule[2], args)
+ operateur = Interpreteur_Formule(
+ formule=formule_operateur,
+ constantes=self.new_constantes,
+ fonctions=self.new_fonctions_unaires,
+ parent=self,
+ )
operateur.interpreteFormule()
texte = reste
- return operateur,reste
+ return operateur, reste
else:
- return None,texte
+ return None, texte
- def chercheOperateurBinaire(self,texte):
+ def chercheOperateurBinaire(self, texte):
"""
Cherche dans texte un operateur unaire
"""
texte = texte.strip()
for oper in self.l_fonctions_binaires:
index = texte.find(oper)
- #if index != -1 : print 'on a trouve %s dans %s en %d' %(oper,texte,index)
- if index == 0 :
+ # if index != -1 : print 'on a trouve %s dans %s en %d' %(oper,texte,index)
+ if index == 0:
txt = oper
- zz,reste = texte.split(oper,1)
+ zz, reste = texte.split(oper, 1)
break
- if txt :
- return txt,reste
+ if txt:
+ return txt, reste
else:
# aucun operateur unaire trouve
- return None,texte
+ return None, texte
- def chercheExpressionEntreParentheses(self,texte):
+ def chercheExpressionEntreParentheses(self, texte):
"""
Cherche en debut de texte une expression entre parentheses
"""
- args,reste = self.chercheArgs(texte.strip())
- if not args :
- return None,texte
+ args, reste = self.chercheArgs(texte.strip())
+ if not args:
+ return None, texte
else:
# on a trouve une expression entre parentheses en debut de texte
# --> on retourne un objet Interpreteur_Formule
- formule_operateur = ('','',self.t_formule[2],args[1:-1])
- operateur = Interpreteur_Formule(formule = formule_operateur,
- constantes = self.new_constantes,
- fonctions = self.new_fonctions_unaires,
- parent = self)
+ formule_operateur = ("", "", self.t_formule[2], args[1:-1])
+ operateur = Interpreteur_Formule(
+ formule=formule_operateur,
+ constantes=self.new_constantes,
+ fonctions=self.new_fonctions_unaires,
+ parent=self,
+ )
operateur.interpreteFormule()
texte = reste
- return operateur,reste
+ return operateur, reste
- def splitArgs(self,nom_fonction,args,nb_args):
+ def splitArgs(self, nom_fonction, args, nb_args):
"""
Tente de partager args en nb_args elements
Retourne une liste de chaines de caracteres (liste de longueur nb_args)
"""
- args = args[1:-1] # on enleve les parentheses ouvrante et fermante
- if nb_args == 1 : return args
- l_args = args.split(',')
+ args = args[1:-1] # on enleve les parentheses ouvrante et fermante
+ if nb_args == 1:
+ return args
+ l_args = args.split(",")
if len(l_args) != nb_args:
- raise InterpreteurException ("La fonction %s requiert %d arguments : %d fourni(s)" %(nom_fonction,nb_args,len(l_args)))
+ raise InterpreteurException(
+ "La fonction %s requiert %d arguments : %d fourni(s)"
+ % (nom_fonction, nb_args, len(l_args))
+ )
else:
return l_args
- def getType(self,texte):
+ def getType(self, texte):
"""
Retourne le type de l'objet defini dans texte, a savoir:
- constante
et son nom
"""
texte = texte.strip()
- if '(' not in texte:
- return 'constante',texte
- if texte[-1] != ')':
- return 'unknown',''
- nom_oper,args = texte.split('(',1)
- return 'fonction',nom_oper
+ if "(" not in texte:
+ return "constante", texte
+ if texte[-1] != ")":
+ return "unknown", ""
+ nom_oper, args = texte.split("(", 1)
+ return "fonction", nom_oper
- def getNbArgs(self,formule):
+ def getNbArgs(self, formule):
"""
Retourne le nombre d'arguments dans la definition de formule (sous forme de tuple)
"""
- args = formule[2][1:-1] # on enleve les parentheses ouvrante et fermante
- l_args = args.split(',')
+ args = formule[2][1:-1] # on enleve les parentheses ouvrante et fermante
+ l_args = args.split(",")
return len(l_args)
-if __name__ == '__main__':
- constantes = ['FREQ3','AMOR1']
- fonctions_unaires=[('ACC','REEL','(REEL:x)','''bidon'''),]
- f1 = ('f1','REEL','(REEL:x)','''SIN(x)+3*x''')
- f2 = ('f2','REEL','(REEL:x)','''ATAN(x+3)+3*x''')
- f3 = ('f3','REEL','(REEL:INST)','''ACC(INST,FREQ3,AMOR1)''')
- f4 = ('f4','REEL','(REEL:INST)','''ACC(INST,FREQ2,AMOR1)''')
- f5 = ('f5','REEL','(REEL:INST,REEL:Y)','''ACC(INST,FREQ3,AMOR1)+Y*INST''')
- f6 = ('f6','REEL','(REEL:x)','''(x+ 3)/ 35.698''')
- f7 = ('f7','REEL','(REEL:x)','''(x+ 3)/ 35.698E-10''')
- f8 = ('f8','REEL','(REEL:x)','''(x+ 3)/ 35.698E''')
- f9 = ('f9','REEL','(REEL:INSTA,REEl:INSTB)','''2.*SIN((PI/4)+((INSTA-INSTB)/2.))* COS((PI/4)-((INSTA+INSTB)/2.))''')
- f10 = ('f10','REEL','(REEL:X)','''EXP(-(X+1))''')
- for formule in (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10):
- i = Interpreteur_Formule(formule = formule,
- constantes = constantes,
- fonctions = fonctions_unaires)
+
+if __name__ == "__main__":
+ constantes = ["FREQ3", "AMOR1"]
+ fonctions_unaires = [
+ ("ACC", "REEL", "(REEL:x)", """bidon"""),
+ ]
+ f1 = ("f1", "REEL", "(REEL:x)", """SIN(x)+3*x""")
+ f2 = ("f2", "REEL", "(REEL:x)", """ATAN(x+3)+3*x""")
+ f3 = ("f3", "REEL", "(REEL:INST)", """ACC(INST,FREQ3,AMOR1)""")
+ f4 = ("f4", "REEL", "(REEL:INST)", """ACC(INST,FREQ2,AMOR1)""")
+ f5 = ("f5", "REEL", "(REEL:INST,REEL:Y)", """ACC(INST,FREQ3,AMOR1)+Y*INST""")
+ f6 = ("f6", "REEL", "(REEL:x)", """(x+ 3)/ 35.698""")
+ f7 = ("f7", "REEL", "(REEL:x)", """(x+ 3)/ 35.698E-10""")
+ f8 = ("f8", "REEL", "(REEL:x)", """(x+ 3)/ 35.698E""")
+ f9 = (
+ "f9",
+ "REEL",
+ "(REEL:INSTA,REEl:INSTB)",
+ """2.*SIN((PI/4)+((INSTA-INSTB)/2.))* COS((PI/4)-((INSTA+INSTB)/2.))""",
+ )
+ f10 = ("f10", "REEL", "(REEL:X)", """EXP(-(X+1))""")
+ for formule in (f1, f2, f3, f4, f5, f6, f7, f8, f9, f10):
+ i = Interpreteur_Formule(
+ formule=formule, constantes=constantes, fonctions=fonctions_unaires
+ )
txt = i.str()
- print(('\nformule %s = %s' %(str(formule),txt)))
- #if i.isValid() :
+ print(("\nformule %s = %s" % (str(formule), txt)))
+ # if i.isValid() :
# print "\n\tPas d'erreur !"
- #else:
+ # else:
# print i.report()
Ce module contient la classe mixin qui porte les methodes
pour traiter les niveaux au sein d'un JDC
"""
-from __future__ import absolute_import
-try :
- from builtins import object
-except : pass
+from builtins import object
from . import etape_niveau
+
class JDC(object):
def __init__(self):
- self.dict_niveaux={}
+ self.dict_niveaux = {}
self.buildNiveaux()
def buildNiveaux(self):
- for niveau in self.definition.l_niveaux:
- etape_niv = etape_niveau.ETAPE_NIVEAU(niveau,self)
+ for niveau in self.definition.lNiveaux:
+ etape_niv = etape_niveau.ETAPE_NIVEAU(niveau, self)
self.etapes_niveaux.append(etape_niv)
- self.dict_niveaux[niveau.nom]=etape_niv
+ self.dict_niveaux[niveau.nom] = etape_niv
self.dict_niveaux.update(etape_niv.dict_niveaux)
que le jeu de commandes inclus est valide et compatible
avec le contexte avant et apres l'insertion
"""
-from __future__ import absolute_import
import string
-from Accas import JDC,ASSD,AsException,JDC_CATA
+from Accas import JDC, ASSD, AsException, JDC_CATA
from Ihm import CONNECTOR
+
class JDC_POURSUITE(JDC):
- def __init__(self,definition=None,procedure=None,cata=None,
- cata_ord_dico=None,parent=None,
- nom='SansNom',appli=None,context_ini=None,
- jdc_pere=None,etape_include=None,prefix_include=None,
- recorded_units=None,old_recorded_units=None,**args):
-
- JDC.__init__(self, definition=definition,
- procedure=procedure,
- cata=cata,
- cata_ord_dico=cata_ord_dico,
- parent=parent,
- nom=nom,
- appli=appli,
- context_ini=context_ini,
- **args
- )
- self.jdc_pere=jdc_pere
- self.etape_include=etape_include
- self.prefix_include=prefix_include
- if recorded_units is not None:self.recorded_units=recorded_units
- if old_recorded_units is not None:self.old_recorded_units=old_recorded_units
-
- def o_register(self,sd):
+ def __init__(
+ self,
+ definition=None,
+ procedure=None,
+ cata=None,
+ cata_ord_dico=None,
+ parent=None,
+ nom="SansNom",
+ appli=None,
+ context_ini=None,
+ jdc_pere=None,
+ etape_include=None,
+ prefix_include=None,
+ recorded_units=None,
+ old_recorded_units=None,
+ **args
+ ):
+ JDC.__init__(
+ self,
+ definition=definition,
+ procedure=procedure,
+ cata=cata,
+ cata_ord_dico=cata_ord_dico,
+ parent=parent,
+ nom=nom,
+ appli=appli,
+ context_ini=context_ini,
+ **args
+ )
+ self.jdc_pere = jdc_pere
+ self.etape_include = etape_include
+ self.prefix_include = prefix_include
+ if recorded_units is not None:
+ self.recorded_units = recorded_units
+ if old_recorded_units is not None:
+ self.old_recorded_units = old_recorded_units
+
+ def o_register(self, sd):
return self.jdc_pere.o_register(sd)
- def nommerSDProd(self,sd,sdnom,restrict='non'):
+ def nommerSDProd(self, sd, sdnom, restrict="non"):
"""
- Nomme la SD apres avoir verifie que le nommage est possible : nom
- non utilise
- Ajoute un prefixe s'il est specifie (INCLUDE_MATERIAU)
- Si le nom est deja utilise, leve une exception
- Met le concept cree dans le contexe global g_context
+ Nomme la SD apres avoir verifie que le nommage est possible : nom
+ non utilise
+ Ajoute un prefixe s'il est specifie (INCLUDE_MATERIAU)
+ Si le nom est deja utilise, leve une exception
+ Met le concept cree dans le contexe global g_context
"""
- #print "nommerSDProd",sd,sdnom,restrict
+ # print "nommerSDProd",sd,sdnom,restrict
if self.prefix_include:
- if sdnom != self.prefix_include:sdnom=self.prefix_include+sdnom
+ if sdnom != self.prefix_include:
+ sdnom = self.prefix_include + sdnom
- if sdnom != '' and sdnom[0] == '_':
+ if sdnom != "" and sdnom[0] == "_":
# Si le nom du concept commence par le caractere _ on lui attribue
# un identificateur automatique comme dans JEVEUX (voir gcncon)
#
# commence par _ mais qui sont des concepts nommes automatiquement par
# une eventuelle sous macro.
if sdnom[1] in string.digits:
- # Ce concept provient probablement d'une sous macro (cas improbable)
- #pas de renommage
+ # Ce concept provient probablement d'une sous macro (cas improbable)
+ # pas de renommage
pass
- elif sdnom[1] == '_':
- #cas d'un concept a ne pas conserver apres execution de la commande
- sdnom=sd.id[2:]
+ elif sdnom[1] == "_":
+ # cas d'un concept a ne pas conserver apres execution de la commande
+ sdnom = sd.id[2:]
pass
else:
- sdnom=sd.id[2:]
+ sdnom = sd.id[2:]
pass
- o=self.sdsDict.get(sdnom,None)
- if isinstance(o,ASSD):
- raise AsException(tr("Nom de concept deja defini : %s" ,sdnom))
+ o = self.sdsDict.get(sdnom, None)
+ if isinstance(o, ASSD):
+ raise AsException(tr("Nom de concept deja defini : %s", sdnom))
# On pourrait verifier que le jdc_pere apres l'etape etape_include
# ne contient pas deja un concept de ce nom
- #if self.jdc_pere.getSdApresEtapeAvecDetruire(sdnom,etape=self.etape_include):
- # Il existe un concept apres self => impossible d'inserer
+ # if self.jdc_pere.getSdApresEtapeAvecDetruire(sdnom,etape=self.etape_include):
+ # Il existe un concept apres self => impossible d'inserer
# raise AsException("Nom de concept deja defini : %s" % sdnom)
# On a choisi de ne pas faire ce test ici mais de le faire en bloc
# si necessaire apres en appelant la methode verifContexte
# ATTENTION : Il ne faut pas ajouter sd dans sds car il s y trouve deja.
# Ajoute a la creation (appel de regSD).
- self.sdsDict[sdnom]=sd
- sd.nom=sdnom
+ self.sdsDict[sdnom] = sd
+ sd.nom = sdnom
# En plus si restrict vaut 'non', on insere le concept dans le contexte du JDC
- if restrict == 'non':
- self.g_context[sdnom]=sd
+ if restrict == "non":
+ self.g_context[sdnom] = sd
def getVerifContexte(self):
- #print "getVerifContexte"
- j_context=self.getContexteAvant(None)
+ # print "getVerifContexte"
+ j_context = self.getContexteAvant(None)
self.verifContexte(j_context)
return j_context
- def forceContexte(self,contexte):
- for nom_sd,sd in list(contexte.items()):
- if not isinstance(sd,ASSD):continue
- autre_sd= self.jdc_pere.getSdApresEtapeAvecDetruire(nom_sd,sd,
- etape=self.etape_include)
- if autre_sd is None:continue
+ def forceContexte(self, contexte):
+ for nom_sd, sd in list(contexte.items()):
+ if not isinstance(sd, ASSD):
+ continue
+ autre_sd = self.jdc_pere.getSdApresEtapeAvecDetruire(
+ nom_sd, sd, etape=self.etape_include
+ )
+ if autre_sd is None:
+ continue
if sd is not autre_sd:
# Il existe un autre concept de meme nom produit par une etape apres self
# on detruit ce concept pour pouvoir inserer les etapes du jdc_include
return contexte
- def verifContexte(self,context):
- """
- Cette methode verifie si le contexte passe en argument (context)
- peut etre insere dans le jdc pere de l'include.
- Elle verifie que les concepts contenus dans ce contexte n'entrent
- pas en conflit avec les concepts produits dans le jdc pere
- apres l'include.
- Si le contexte ne peut pas etre insere, la methode leve une
- exception sinon elle retourne le contexte inchange
- """
- #print "verifContexte"
- for nom_sd,sd in list(context.items()):
- if not isinstance(sd,ASSD):continue
- autre_sd= self.jdc_pere.getSdApresEtapeAvecDetruire(nom_sd,sd,
- etape=self.etape_include)
- if autre_sd is None:continue
+ def verifContexte(self, context):
+ """
+ Cette methode verifie si le contexte passe en argument (context)
+ peut etre insere dans le jdc pere de l'include.
+ Elle verifie que les concepts contenus dans ce contexte n'entrent
+ pas en conflit avec les concepts produits dans le jdc pere
+ apres l'include.
+ Si le contexte ne peut pas etre insere, la methode leve une
+ exception sinon elle retourne le contexte inchange
+ """
+ # print "verifContexte"
+ for nom_sd, sd in list(context.items()):
+ if not isinstance(sd, ASSD):
+ continue
+ autre_sd = self.jdc_pere.getSdApresEtapeAvecDetruire(
+ nom_sd, sd, etape=self.etape_include
+ )
+ if autre_sd is None:
+ continue
if sd is not autre_sd:
# Il existe un concept produit par une etape apres self
# => impossible d'inserer
- raise Exception("Impossible d'inclure le fichier. Un concept de nom " +
- "%s existe deja dans le jeu de commandes." % nom_sd)
+ raise Exception(
+ "Impossible d'inclure le fichier. Un concept de nom "
+ + "%s existe deja dans le jeu de commandes." % nom_sd
+ )
return context
def getListeCmd(self):
"""
- Retourne la liste des commandes du catalogue
+ Retourne la liste des commandes du catalogue
"""
if self.jdc_pere is None:
return JDC.getListeCmd(self)
def getGroups(self):
"""
- Retourne la liste des commandes du catalogue par groupes
+ Retourne la liste des commandes du catalogue par groupes
"""
if self.jdc_pere is None:
return JDC.getGroups(self)
def initModif(self):
"""
- Met l'etat de l'etape a : modifie
- Propage la modification au parent
+ Met l'etat de l'etape a : modifie
+ Propage la modification au parent
- Attention : initModif doit etre appele avant de realiser une modification
- La validite devra etre recalculee apres cette modification
- mais par un appel a finModif pour preserver l'etat modified
- de tous les objets entre temps
+ Attention : initModif doit etre appele avant de realiser une modification
+ La validite devra etre recalculee apres cette modification
+ mais par un appel a finModif pour preserver l'etat modified
+ de tous les objets entre temps
"""
- #print "jdc_include.initModif",self,self.etape_include
- self.state = 'modified'
+ # print "jdc_include.initModif",self,self.etape_include
+ self.state = "modified"
if self.etape_include:
self.etape_include.initModif()
def finModif(self):
"""
- Methode appelee une fois qu'une modification a ete faite afin de
- declencher d'eventuels traitements post-modification
- ex : INCLUDE et POURSUITE
+ Methode appelee une fois qu'une modification a ete faite afin de
+ declencher d'eventuels traitements post-modification
+ ex : INCLUDE et POURSUITE
"""
- #print "jdc_include.finModif",self,self.etape_include
- CONNECTOR.Emit(self,"valid")
+ # print "jdc_include.finModif",self,self.etape_include
+ CONNECTOR.Emit(self, "valid")
if self.etape_include:
self.etape_include.finModif()
def supprime(self):
"""
- On ne supprime rien directement pour un jdc auxiliaire d'include ou de poursuite
- Utiliser supprime_aux
+ On ne supprime rien directement pour un jdc auxiliaire d'include ou de poursuite
+ Utiliser supprime_aux
"""
pass
def supprime_aux(self):
- #print "supprime_aux",self
+ # print "supprime_aux",self
JDC.supprime(self)
- self.jdc_pere=None
- self.etape_include=None
- # self.cata_ordonne_dico={}
- self.appli=None
+ self.jdc_pere = None
+ self.etape_include = None
+ # self.cata_ordonne_dico={}
+ self.appli = None
+
# self.context_ini={}
# self.procedure=None
- def getContexteAvant(self,etape):
+ def getContexteAvant(self, etape):
"""
- Retourne le dictionnaire des concepts connus avant etape
- On tient compte des concepts produits par le jdc pere
- en reactualisant le contexte initial context_ini
- On tient compte des commandes qui modifient le contexte
- comme DETRUIRE ou les macros
- Si etape == None, on retourne le contexte en fin de JDC
+ Retourne le dictionnaire des concepts connus avant etape
+ On tient compte des concepts produits par le jdc pere
+ en reactualisant le contexte initial context_ini
+ On tient compte des commandes qui modifient le contexte
+ comme DETRUIRE ou les macros
+ Si etape == None, on retourne le contexte en fin de JDC
"""
- #print "jdc_include.getContexteAvant",etape,etape and etape.nom
+ # print "jdc_include.getContexteAvant",etape,etape and etape.nom
if self.etape_include:
- new_context=self.etape_include.parent.getContexteAvant(self.etape_include).copy()
- self.context_ini=new_context
- d= JDC.getContexteAvant(self,etape)
+ new_context = self.etape_include.parent.getContexteAvant(
+ self.etape_include
+ ).copy()
+ self.context_ini = new_context
+ d = JDC.getContexteAvant(self, etape)
return d
def resetContext(self):
- #print "jdc_include.resetContext",self,self.nom
+ # print "jdc_include.resetContext",self,self.nom
if self.etape_include:
self.etape_include.parent.resetContext()
- new_context=self.etape_include.parent.getContexteAvant(self.etape_include).copy()
- self.context_ini=new_context
+ new_context = self.etape_include.parent.getContexteAvant(
+ self.etape_include
+ ).copy()
+ self.context_ini = new_context
JDC.resetContext(self)
- def getSdApresEtape(self,nom_sd,etape,avec='non'):
+ def getSdApresEtape(self, nom_sd, etape, avec="non"):
"""
- Cette methode retourne la SD de nom nom_sd qui est eventuellement
- definie apres etape
- Si avec vaut 'non' exclut etape de la recherche
+ Cette methode retourne la SD de nom nom_sd qui est eventuellement
+ definie apres etape
+ Si avec vaut 'non' exclut etape de la recherche
"""
if self.etape_include:
- sd=self.etape_include.parent.getSdApresEtape(nom_sd,self.etape_include,'non')
- if sd:return sd
- return JDC.getSdApresEtape(self,nom_sd,etape,avec)
-
- def getSdApresEtapeAvecDetruire(self,nom_sd,sd,etape,avec='non'):
- """
- On veut savoir ce que devient le concept sd de nom nom_sd apres etape.
- Il peut etre detruit, remplace ou conserve
- Cette methode retourne la SD sd de nom nom_sd qui est eventuellement
- definie apres etape en tenant compte des concepts detruits
- Si avec vaut 'non' exclut etape de la recherche
- """
- #print "jdc_include.getSdApresEtapeAvecDetruire",nom_sd,sd,id(sd)
- autre_sd=JDC.getSdApresEtapeAvecDetruire(self,nom_sd,sd,etape,avec)
+ sd = self.etape_include.parent.getSdApresEtape(
+ nom_sd, self.etape_include, "non"
+ )
+ if sd:
+ return sd
+ return JDC.getSdApresEtape(self, nom_sd, etape, avec)
+
+ def getSdApresEtapeAvecDetruire(self, nom_sd, sd, etape, avec="non"):
+ """
+ On veut savoir ce que devient le concept sd de nom nom_sd apres etape.
+ Il peut etre detruit, remplace ou conserve
+ Cette methode retourne la SD sd de nom nom_sd qui est eventuellement
+ definie apres etape en tenant compte des concepts detruits
+ Si avec vaut 'non' exclut etape de la recherche
+ """
+ # print "jdc_include.getSdApresEtapeAvecDetruire",nom_sd,sd,id(sd)
+ autre_sd = JDC.getSdApresEtapeAvecDetruire(self, nom_sd, sd, etape, avec)
# si autre_sd vaut None le concept sd a ete detruit. On peut terminer
# la recherche en retournant None
# Si autre_sd ne vaut pas sd, le concept a ete redefini. On peut terminer
# la recherche en retournant le concept nouvellement defini
# Sinon, on poursuit la recherche dans les etapes du niveau superieur.
- if autre_sd is None or autre_sd is not sd :return autre_sd
- return self.etape_include.parent.getSdApresEtapeAvecDetruire(nom_sd,sd,self.etape_include,'non')
+ if autre_sd is None or autre_sd is not sd:
+ return autre_sd
+ return self.etape_include.parent.getSdApresEtapeAvecDetruire(
+ nom_sd, sd, self.etape_include, "non"
+ )
- def deleteConcept(self,sd):
+ def deleteConcept(self, sd):
"""
- Fonction : Mettre a jour les etapes du JDC suite a la disparition du
- concept sd
- Seuls les mots cles simples MCSIMP font un traitement autre
- que de transmettre aux fils
+ Fonction : Mettre a jour les etapes du JDC suite a la disparition du
+ concept sd
+ Seuls les mots cles simples MCSIMP font un traitement autre
+ que de transmettre aux fils
"""
# Nettoyage des etapes de l'include
- JDC.deleteConcept(self,sd)
+ JDC.deleteConcept(self, sd)
# Nettoyage des etapes du parent
if self.etape_include:
- self.etape_include.parent.deleteConceptAfterEtape(self.etape_include,sd)
+ self.etape_include.parent.deleteConceptAfterEtape(self.etape_include, sd)
- def deleteConceptAfterEtape(self,etape,sd):
+ def deleteConceptAfterEtape(self, etape, sd):
"""
- Fonction : Mettre a jour les etapes du JDC qui sont apres etape suite a
- la disparition du concept sd
+ Fonction : Mettre a jour les etapes du JDC qui sont apres etape suite a
+ la disparition du concept sd
"""
# Nettoyage des etapes de l'include
- JDC.deleteConceptAfterEtape(self,etape,sd)
+ JDC.deleteConceptAfterEtape(self, etape, sd)
# Nettoyage des etapes du parent
if self.etape_include:
- self.etape_include.parent.deleteConceptAfterEtape(self.etape_include,sd)
+ self.etape_include.parent.deleteConceptAfterEtape(self.etape_include, sd)
- def updateConceptAfterEtape(self,etape,sd):
+ def updateConceptAfterEtape(self, etape, sd):
"""
- Fonction : mettre a jour les etapes du JDC suite a une modification
- du concept sd (principalement renommage)
+ Fonction : mettre a jour les etapes du JDC suite a une modification
+ du concept sd (principalement renommage)
"""
- JDC.updateConceptAfterEtape(self,etape,sd)
+ JDC.updateConceptAfterEtape(self, etape, sd)
if self.etape_include:
- self.etape_include.parent.updateConceptAfterEtape(self.etape_include,sd)
+ self.etape_include.parent.updateConceptAfterEtape(self.etape_include, sd)
- def replaceConceptAfterEtape(self,etape,old_sd,sd):
+ def replaceConceptAfterEtape(self, etape, old_sd, sd):
"""
- Fonction : Mettre a jour les etapes du JDC qui sont apres etape suite au
- remplacement du concept old_sd par sd
+ Fonction : Mettre a jour les etapes du JDC qui sont apres etape suite au
+ remplacement du concept old_sd par sd
"""
# Nettoyage des etapes de l'include
- JDC.replaceConceptAfterEtape(self,etape,old_sd,sd)
+ JDC.replaceConceptAfterEtape(self, etape, old_sd, sd)
# Nettoyage des etapes du parent
if self.etape_include:
- self.etape_include.parent.replaceConceptAfterEtape(self.etape_include,old_sd,sd)
+ self.etape_include.parent.replaceConceptAfterEtape(
+ self.etape_include, old_sd, sd
+ )
- def changeFichier(self,fichier):
+ def changeFichier(self, fichier):
if self.etape_include:
- self.etape_include.fichier_ini=fichier
+ self.etape_include.fichier_ini = fichier
self.finModif()
- def controlContextApres(self,etape):
+ def controlContextApres(self, etape):
"""
- Cette methode verifie que les etapes apres l'etape etape
- ont bien des concepts produits acceptables (pas de conflit de
- nom principalement)
- Si des concepts produits ne sont pas acceptables ils sont supprimes.
- Effectue les verifications sur les etapes du jdc mais aussi sur les
- jdc parents s'ils existent.
+ Cette methode verifie que les etapes apres l'etape etape
+ ont bien des concepts produits acceptables (pas de conflit de
+ nom principalement)
+ Si des concepts produits ne sont pas acceptables ils sont supprimes.
+ Effectue les verifications sur les etapes du jdc mais aussi sur les
+ jdc parents s'ils existent.
"""
- #print "jdc_include.controlContextApres",self,etape
- #Regularise les etapes du jdc apres l'etape etape
+ # print "jdc_include.controlContextApres",self,etape
+ # Regularise les etapes du jdc apres l'etape etape
self.controlJdcContextApres(etape)
if self.etape_include:
- #print "CONTROL_INCLUDE:",self.etape_include,self.etape_include.nom
+ # print "CONTROL_INCLUDE:",self.etape_include,self.etape_include.nom
# il existe un jdc pere. On propage la regularisation
self.etape_include.parent.controlContextApres(self.etape_include)
+
class JDC_INCLUDE(JDC_POURSUITE):
def getListeCmd(self):
"""
- Retourne la liste des commandes du catalogue
+ Retourne la liste des commandes du catalogue
"""
if self.jdc_pere is None:
return JDC.getListeCmd(self)
- return [e for e in self.jdc_pere.getListeCmd() if e not in ("DEBUT","POURSUITE","FIN") ]
+ return [
+ e
+ for e in self.jdc_pere.getListeCmd()
+ if e not in ("DEBUT", "POURSUITE", "FIN")
+ ]
def activeEtapes(self):
for e in self.etapes:
e.active()
+
class JDC_CATA_INCLUDE(JDC_CATA):
- class_instance=JDC_INCLUDE
+ class_instance = JDC_INCLUDE
+
class JDC_CATA_POURSUITE(JDC_CATA):
- class_instance=JDC_POURSUITE
+ class_instance = JDC_POURSUITE
-from Accas import AU_MOINS_UN,A_CLASSER
+
+from Accas import AU_MOINS_UN, A_CLASSER
import prefs
-c=prefs.code
-JdC_include=JDC_CATA_INCLUDE(code=c, execmodul=None)
-
-JdC_poursuite=JDC_CATA_POURSUITE(code='ASTER', execmodul=None,
- regles = (AU_MOINS_UN('DEBUT','POURSUITE'),
- AU_MOINS_UN('FIN'),
- A_CLASSER(('DEBUT','POURSUITE'),'FIN')
- )
- )
+
+c = prefs.code
+JdC_include = JDC_CATA_INCLUDE(code=c, execmodul=None)
+
+JdC_poursuite = JDC_CATA_POURSUITE(
+ code="ASTER",
+ execmodul=None,
+ regles=(
+ AU_MOINS_UN("DEBUT", "POURSUITE"),
+ AU_MOINS_UN("FIN"),
+ A_CLASSER(("DEBUT", "POURSUITE"), "FIN"),
+ ),
+)
"""
-from __future__ import absolute_import
-from __future__ import print_function
import os
-try :
+try:
from PyQt5.QtCore import QTranslator
+
code_translator = QTranslator()
eficas_translator = QTranslator()
-except :
+except:
code_translator = None
eficas_translator = None
- print ('pas d import de qt, pas de traduction')
-
+ print("pas d import de qt, pas de traduction")
-def localise(application, locale=None,file=None,translatorFichier=None, debug=False ):
- """
- """
- if code_translator == None :
- print ('qt not avalaible, no translation')
+def localise(application, locale=None, file=None, translatorFichier=None, debug=False):
+ """ """
+ if code_translator == None:
+ print("qt not avalaible, no translation")
return
from PyQt5.QtCore import QLibraryInfo
from PyQt5.QtCore import QLocale
from PyQt5.QtWidgets import QApplication
- monPath=os.path.join(os.path.dirname(__file__),'..','UiQT5')
+
+ monPath = os.path.join(os.path.dirname(__file__), "..", "UiQT5")
sys_locale = QLocale.system().name()
- if locale is None: locale="fr"
- if locale=="ang" : locale="en"
+ if locale is None:
+ locale = "fr"
+ if locale == "ang":
+ locale = "en"
- if file != None and debug :
- print ('chargement de ', file,monPath)
- print (eficas_translator.load(file,monPath))
- print (QApplication.installTranslator(eficas_translator))
+ if file != None and debug:
+ print("chargement de ", file, monPath)
+ print(eficas_translator.load(file, monPath))
+ print(QApplication.installTranslator(eficas_translator))
elif eficas_translator.load("eficas_" + locale, monPath):
QApplication.installTranslator(eficas_translator)
elif debug:
- print ("Unable to load Eficas translator!")
+ print("Unable to load Eficas translator!")
- if debug : print ('translatorFichier :' ,translatorFichier)
- if translatorFichier != None :
+ if debug:
+ print("translatorFichier :", translatorFichier)
+ if translatorFichier != None:
if (code_translator.load(translatorFichier)) and debug:
- print (translatorFichier, ' loaded')
- elif (code_translator.load(translatorFichier+'_'+locale) and debug):
- print(translatorFichier+'_'+locale+ ' loaded')
- elif debug :
- print ("Unable to load Code translator! No file or No translation" + translatorFichier)
- if debug : print (QApplication.installTranslator(code_translator))
- else : QApplication.installTranslator(code_translator)
+ print(translatorFichier, " loaded")
+ elif code_translator.load(translatorFichier + "_" + locale) and debug:
+ print(translatorFichier + "_" + locale + " loaded")
+ elif debug:
+ print(
+ "Unable to load Code translator! No file or No translation"
+ + translatorFichier
+ )
+ if debug:
+ print(QApplication.installTranslator(code_translator))
+ else:
+ QApplication.installTranslator(code_translator)
if __name__ == "__main__":
import sys
+
localise(sys.argv[1])
"""
"""
# Modules Python
-from __future__ import absolute_import
-try :
- from builtins import str
-except : pass
+from builtins import str
# Modules Eficas
from Noyau import N_MCCOMPO
from Validation import V_MCCOMPO
from Extensions.i18n import tr
-class MCNUPLET(V_MCCOMPO.MCCOMPO,N_MCCOMPO.MCCOMPO):
- """
- """
+
+class MCNUPLET(V_MCCOMPO.MCCOMPO, N_MCCOMPO.MCCOMPO):
+ """ """
+
nature = "MCNUPLET"
- txt_nat="Nuplet : "
+ txt_nat = "Nuplet : "
- def __init__(self,val,definition,nom,parent):
+ def __init__(self, val, definition, nom, parent):
# val contient la valeur initial du nuplet
self.val = val
- if val == None: self.val=()
- self.definition=definition
- self.nom=nom
+ if val == None:
+ self.val = ()
+ self.definition = definition
+ self.nom = nom
self.parent = parent
# getValeurEffective affecte la valeur par defaut si necessaire
- self.valeur=self.getValeurEffective(self.val)
- if parent :
+ self.valeur = self.getValeurEffective(self.val)
+ if parent:
self.jdc = self.parent.jdc
self.niveau = self.parent.niveau
self.etape = self.parent.etape
self.jdc = None
self.niveau = None
self.etape = None
- self.state = 'undetermined'
- self.actif=1
- self.mcListe=self.buildMc()
+ self.state = "undetermined"
+ self.actif = 1
+ self.mcListe = self.buildMc()
def buildMc(self):
"""
- Construit la liste des sous-entites de MCNUPLET
- a partir de la liste des arguments (valeur)
+ Construit la liste des sous-entites de MCNUPLET
+ a partir de la liste des arguments (valeur)
"""
args = self.valeur
- if args ==None : args =()
- mcListe=[]
+ if args == None:
+ args = ()
+ mcListe = []
# on cree les sous entites du NUPLET a partir des valeurs initiales
- k=0
+ k = 0
for v in self.definition.entites:
if k < len(args):
- val=args[k]
+ val = args[k]
else:
- val=None
- objet=v(val=val,nom=repr(k),parent=self)
- if hasattr(objet.definition,'position'):
- if objet.definition.position == 'global' :
+ val = None
+ objet = v(val=val, nom=repr(k), parent=self)
+ if hasattr(objet.definition, "position"):
+ if objet.definition.position == "global":
self.append_mc_global(objet)
- #XXX et global_jdc ??
+ # XXX et global_jdc ??
mcListe.append(objet)
- k=k+1
+ k = k + 1
# Un nuplet n'a pas de mots inconnus
- self.reste_val={}
+ self.reste_val = {}
return mcListe
- def isValid(self,cr='non'):
+ def isValid(self, cr="non"):
"""
- Indique si self (MCNUPLET) est un objet valide ou non : retourne 1 si oui, 0 sinon
+ Indique si self (MCNUPLET) est un objet valide ou non : retourne 1 si oui, 0 sinon
"""
- if self.state == 'unchanged' :
+ if self.state == "unchanged":
return self.valid
else:
valid = 1
- if hasattr(self,'valid'):
+ if hasattr(self, "valid"):
old_valid = self.valid
else:
old_valid = None
- for child in self.mcListe :
+ for child in self.mcListe:
if not child.isValid():
valid = 0
break
if len(self.mcListe) != len(self.definition.entites):
- valid=0
- if cr == 'oui' :
- self.cr.fatal(''.join(("Nuplet : ",self.nom,tr("Longueur incorrecte"))))
+ valid = 0
+ if cr == "oui":
+ self.cr.fatal(
+ "".join(("Nuplet : ", self.nom, tr("Longueur incorrecte")))
+ )
self.valid = valid
- self.state = 'unchanged'
+ self.state = "unchanged"
if old_valid:
- if old_valid != self.valid : self.initModifUp()
+ if old_valid != self.valid:
+ self.initModifUp()
return self.valid
- def __getitem__(self,key):
+ def __getitem__(self, key):
"""
- Retourne le key eme element du nuplet
+ Retourne le key eme element du nuplet
"""
# Un nuplet est toujours une liste de mots cles simples
# On retourne donc la valeur
def __str__(self):
"""
- Retourne une representation du nuplet sous forme de chaine
- de caracteres
+ Retourne une representation du nuplet sous forme de chaine
+ de caracteres
"""
- s='('
+ s = "("
for e in self.mcListe:
- s=s + str(e.valeur) + ','
- return s + ')'
+ s = s + str(e.valeur) + ","
+ return s + ")"
def __repr__(self):
"""
- Retourne une representation du nuplet sous forme de chaine
- de caracteres
+ Retourne une representation du nuplet sous forme de chaine
+ de caracteres
"""
- s='('
+ s = "("
for e in self.mcListe:
- s=s + str(e.valeur) + ','
- return s + ')'
+ s = s + str(e.valeur) + ","
+ return s + ")"
def getRegles(self):
"""
- Retourne la liste des regles attachees au nuplet
+ Retourne la liste des regles attachees au nuplet
"""
return []
def verifConditionBloc(self):
"""
- Verifie s'il y a des blocs sous le nuplet et retourne
- les blocs en question
+ Verifie s'il y a des blocs sous le nuplet et retourne
+ les blocs en question
"""
# Il n y a pas de BLOCs sous un NUPLET
- return [],[]
+ return [], []
def isRepetable(self):
"""
- Indique si le NUPLET peut etre repete.
- Retourne 1 si c'est le cas.
- Retourne 0 dans le cas contraire.
- L'information est donnee par le catalogue, cad la definition de self
+ Indique si le NUPLET peut etre repete.
+ Retourne 1 si c'est le cas.
+ Retourne 0 dans le cas contraire.
+ L'information est donnee par le catalogue, cad la definition de self
"""
- if self.definition.min != self.definition.max :
+ if self.definition.min != self.definition.max:
return 1
- else :
+ else:
return 0
def makeobjet(self):
- return self.definition(val = None, nom = self.nom,parent = self.parent)
+ return self.definition(val=None, nom=self.nom, parent=self.parent)
def getValeur(self):
"""
- Cette methode doit retourner la valeur de l'objet. Elle est utilisee par
- creeDictValeurs pour construire un dictionnaire contenant les mots cles
- d'une etape.
- Dans le cas d'un nuplet, on retournera comme valeur une liste des valeurs
- des mots cle simples contenus.
+ Cette methode doit retourner la valeur de l'objet. Elle est utilisee par
+ creeDictValeurs pour construire un dictionnaire contenant les mots cles
+ d'une etape.
+ Dans le cas d'un nuplet, on retournera comme valeur une liste des valeurs
+ des mots cle simples contenus.
"""
- l=[]
+ l = []
for v in self.mcListe:
l.append(v.valeur)
return l
def getVal(self):
"""
- Une autre methode qui retourne une "autre" valeur du mot cle facteur.
- Elle est utilisee par la methode getMocle
+ Une autre methode qui retourne une "autre" valeur du mot cle facteur.
+ Elle est utilisee par la methode getMocle
"""
- l=[]
+ l = []
for v in self.mcListe:
l.append(v.valeur)
return l
def isOblig(self):
- return self.definition.statut=='o'
+ return self.definition.statut == "o"
def getFr(self):
"""
- Retourne le texte d'aide dans la langue choisie
+ Retourne le texte d'aide dans la langue choisie
"""
- try :
- return getattr(self.definition,self.jdc.lang)
+ try:
+ return getattr(self.definition, self.jdc.lang)
except:
- return ''
+ return ""
- def creeDictValeurs(self,liste=[],condition=0):
- dico={}
+ def creeDictValeurs(self, liste=[], condition=0):
+ dico = {}
return dico
def updateConditionBloc(self):
"""
- Realise l'update des blocs conditionnels fils de self
- et propage au parent (rien a faire pour nuplet)
+ Realise l'update des blocs conditionnels fils de self
+ et propage au parent (rien a faire pour nuplet)
"""
Ce module contient la classe NIVEAU qui sert a definir
des groupes de commandes dans le catalogue
"""
+from builtins import object
-try :
- from builtins import object
-except : pass
class NIVEAU(object):
- def __init__(self,nom='',label='',niveaux=(),valide_vide=1,actif=1):
+ def __init__(self, nom="", label="", niveaux=(), valide_vide=1, actif=1):
self.nom = nom
self.label = label
- self.statut='o'
+ self.statut = "o"
self.min = 1
self.max = 1
self.entites = []
- self.l_noms_entites=[]
+ self.l_noms_entites = []
self.valide_vide = valide_vide
self.actif = actif
self.d_niveaux = {}
- self.l_niveaux = niveaux
+ self.lNiveaux = niveaux
for niveau in niveaux:
- self.d_niveaux[niveau.nom]=niveau
+ self.d_niveaux[niveau.nom] = niveau
self.d_niveaux.update(niveau.d_niveaux)
- def enregistre(self,commande):
+ def enregistre(self, commande):
self.entites.append(commande)
self.l_noms_entites.append(commande.nom)
Ce module contient la classe de definition pour les nuplets NUPL
"""
# Modules Python
-from __future__ import absolute_import
-try :
- from builtins import str
-except : pass
-
+from builtins import str
import types
# Modules Eficas
-from Noyau import N_ENTITE,N_MCLIST,N_CR
+from Noyau import N_ENTITE, N_MCLIST, N_CR
from Ihm import I_ENTITE
from Extensions.i18n import tr
from . import mcnuplet
-class NUPL(N_ENTITE.ENTITE,I_ENTITE.ENTITE):
- """
- """
+
+class NUPL(N_ENTITE.ENTITE, I_ENTITE.ENTITE):
+ """ """
+
class_instance = mcnuplet.MCNUPLET
list_instance = N_MCLIST.MCList
- label='NUPLET'
- CR=N_CR.CR
+ label = "NUPLET"
+ CR = N_CR.CR
- def __init__(self,fr="",ang="",docu="",statut='f',defaut=None,min=0,max=1,
- elements=None):
+ def __init__(
+ self,
+ fr="",
+ ang="",
+ docu="",
+ statut="f",
+ defaut=None,
+ min=0,
+ max=1,
+ elements=None,
+ ):
N_ENTITE.ENTITE.__init__(self)
I_ENTITE.ENTITE.__init__(self)
- self.fr=fr
- self.ang=ang
- self.docu=docu
- self.statut=statut
- self.defaut=defaut
- self.min=min
- self.max=max
- if self.max =='**' : self.max=float('inf')
- if self.min =='**' : self.min=float('-inf')
- self.entites=elements
- self.regles=()
+ self.fr = fr
+ self.ang = ang
+ self.docu = docu
+ self.statut = statut
+ self.defaut = defaut
+ self.min = min
+ self.max = max
+ if self.max == "**":
+ self.max = float("inf")
+ if self.min == "**":
+ self.min = float("-inf")
+ self.entites = elements
+ self.regles = ()
# on force le statut des sous entites a obligatoire
- for e in elements:e.statut='o'
- self.idracine="NUPLET"
+ for e in elements:
+ e.statut = "o"
+ self.idracine = "NUPLET"
self.affecter_parente()
def verifCata(self):
"""
- Cette methode sert a valider les attributs de l'objet de definition
- de la classe NUPL
+ Cette methode sert a valider les attributs de l'objet de definition
+ de la classe NUPL
"""
- if type(self.min) != int :
- if self.min != '**' and self.min != float('-inf'):
- self.cr.fatal(tr("L'attribut 'min' doit etre un entier : ")+str(self.min))
- if type(self.max) != int :
- if self.max != '**' and self.max != float('inf'):
- self.cr.fatal(tr("L'attribut 'max' doit etre un entier : ")+str(self.max))
- if self.min > self.max :
- self.cr.fatal(tr("Nombres d'occurrence min et max invalides :") +str(self.min)+","+str(self.max))
- if type(self.fr) != bytes and type(self.fr) != str :
+ if type(self.min) != int:
+ if self.min != "**" and self.min != float("-inf"):
+ self.cr.fatal(
+ tr("L'attribut 'min' doit etre un entier : ") + str(self.min)
+ )
+ if type(self.max) != int:
+ if self.max != "**" and self.max != float("inf"):
+ self.cr.fatal(
+ tr("L'attribut 'max' doit etre un entier : ") + str(self.max)
+ )
+ if self.min > self.max:
+ self.cr.fatal(
+ tr("Nombres d'occurrence min et max invalides :")
+ + str(self.min)
+ + ","
+ + str(self.max)
+ )
+ if type(self.fr) != bytes and type(self.fr) != str:
self.cr.fatal(tr("L'attribut 'fr' doit etre une chaine de caracteres"))
- if self.statut not in ['o','f','c','d']:
+ if self.statut not in ["o", "f", "c", "d"]:
self.cr.fatal(tr("L'attribut 'statut' doit valoir 'o','f','c' ou 'd'"))
- if type(self.docu) != bytes and type(self.docu) != str :
+ if type(self.docu) != bytes and type(self.docu) != str:
self.cr.fatal(tr("L'attribut 'docu' doit etre une chaine de caracteres"))
self.verifCataRegles()
- def __call__(self,val,nom,parent):
+ def __call__(self, val, nom, parent):
"""
- Construit la structure de donnees pour un NUPLET a partir de sa definition (self)
- de sa valeur (val), de son nom (nom) et de son parent dans l arboresence (parent)
+ Construit la structure de donnees pour un NUPLET a partir de sa definition (self)
+ de sa valeur (val), de son nom (nom) et de son parent dans l arboresence (parent)
"""
if (type(val) == tuple or type(val) == list) and type(val[0]) == tuple:
# On est en presence d une liste de nuplets
- l=self.list_instance()
- l.init(nom=nom,parent=parent)
+ l = self.list_instance()
+ l.init(nom=nom, parent=parent)
for v in val:
- objet=self.class_instance(nom=nom,definition=self,val=v,parent=parent)
+ objet = self.class_instance(
+ nom=nom, definition=self, val=v, parent=parent
+ )
l.append(objet)
return l
else:
# on est en presence d un seul nuplet
- return self.class_instance(nom=nom,definition=self,val=val,parent=parent)
+ return self.class_instance(nom=nom, definition=self, val=val, parent=parent)
def report(self):
"""
- Methode qui cree le rapport de verification du catalogue du nuplet
+ Methode qui cree le rapport de verification du catalogue du nuplet
"""
self.cr = self.CR()
self.verifCata()
- for v in self.entites :
+ for v in self.entites:
cr = v.report()
- cr.debut =tr("Debut ")+v.__class__.__name__+ ' : '
- cr.fin =tr("Fin ")+v.__class__.__name__+ ' : '
+ cr.debut = tr("Debut ") + v.__class__.__name__ + " : "
+ cr.fin = tr("Fin ") + v.__class__.__name__ + " : "
self.cr.add(cr)
return self.cr
def affecter_parente(self):
"""
- Cette methode a pour fonction de donner un nom et un pere aux
- sous entites qui n'ont aucun moyen pour atteindre leur parent
- directement
- Il s'agit principalement des mots cles
+ Cette methode a pour fonction de donner un nom et un pere aux
+ sous entites qui n'ont aucun moyen pour atteindre leur parent
+ directement
+ Il s'agit principalement des mots cles
"""
- k=0
+ k = 0
for v in self.entites:
v.pere = self
v.nom = str(k)
- k=k+1
+ k = k + 1
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-from __future__ import division
-from __future__ import absolute_import
-try :
- from builtins import str
- from builtins import object
-except : pass
+
+from builtins import str
+from builtins import object
import math
import types
-# PNPN a resorber
-import six
+
try:
import Numeric
except:
try:
import numpy
+
Numeric = numpy
except ImportError:
Numeric = None
def mkf(value):
- if type(value) in (type(1), type(1), type(1.5), type(1j),type("hh")) :
+ if type(value) in (type(1), type(1), type(1.5), type(1j), type("hh")):
return Constant(value)
elif isinstance(value, Formula):
return value
elif type(value) == type([]):
return Constant(value)
else:
-# return Constant(value)
+ # return Constant(value)
raise TypeError("Can't make formula from", value)
-#class Formula(object):
+
+# class Formula(object):
class Formula(object):
def __len__(self):
- val=self.eval()
- if val is None:return 0
+ val = self.eval()
+ if val is None:
+ return 0
try:
return len(val)
except:
return 1
- def __complex__(self): return complex(self.eval())
- def __int__(self): return int(self.eval())
- def __long__(self): return int(self.eval())
- def __float__(self): return float(self.eval())
- def __pos__(self): return self # positive
- def __neg__(self): return Unop('-', self)
- def __abs__(self): return Unop('abs', self)
- def __add__(self, other): return Binop('+', self, other)
- def __radd__(self, other): return Binop('+', other, self)
- def __sub__(self, other): return Binop('-', self, other)
- def __rsub__(self, other): return Binop('-', other, self)
- def __mul__(self, other): return Binop('*', self, other)
- def __rmul__(self, other): return Binop('*', other, self)
- def __div__(self, other): return Binop('/', self, other)
- def __rdiv__(self, other): return Binop('/', other, self)
- def __truediv__(self, other): return Binop('/', self, other)
- def __rtruediv__(self, other): return Binop('/', other, self)
- def __floordiv__(self, other): return Binop('//', self, other)
- def __rfloordiv__(self, other): return Binop('//', other, self)
- def __pow__(self, other): return Binop('**', self, other)
- def __rpow__(self, other): return Binop('**', other, self)
- def __getitem__(self,i):
- if i > len(self) : raise StopIteration
- return Binop('[]',self,i)
- def __cmp__( self, other ): return self.eval().__cmp__(other)
- def __eq__( self, other ): return self.eval() == other
- def __ne__( self, other ): return self.eval() != other
- def __lt__( self, other ): return self.eval() < other
- def __le__( self, other ): return self.eval() <= other
- def __gt__( self, other ): return self.eval() > other
- def __ge__( self, other ): return self.eval() >= other
- def __hash__(self):return id(self)
-
-def _div(a,b):
- if isinstance(a,six.integer_types) and isinstance(b,six.integer_types):
- if a%b:
- return a/b
+
+ def __complex__(self):
+ return complex(self.eval())
+
+ def __int__(self):
+ return int(self.eval())
+
+ def __long__(self):
+ return int(self.eval())
+
+ def __float__(self):
+ return float(self.eval())
+
+ def __pos__(self):
+ return self # positive
+
+ def __neg__(self):
+ return Unop("-", self)
+
+ def __abs__(self):
+ return Unop("abs", self)
+
+ def __add__(self, other):
+ return Binop("+", self, other)
+
+ def __radd__(self, other):
+ return Binop("+", other, self)
+
+ def __sub__(self, other):
+ return Binop("-", self, other)
+
+ def __rsub__(self, other):
+ return Binop("-", other, self)
+
+ def __mul__(self, other):
+ return Binop("*", self, other)
+
+ def __rmul__(self, other):
+ return Binop("*", other, self)
+
+ def __div__(self, other):
+ return Binop("/", self, other)
+
+ def __rdiv__(self, other):
+ return Binop("/", other, self)
+
+ def __truediv__(self, other):
+ return Binop("/", self, other)
+
+ def __rtruediv__(self, other):
+ return Binop("/", other, self)
+
+ def __floordiv__(self, other):
+ return Binop("//", self, other)
+
+ def __rfloordiv__(self, other):
+ return Binop("//", other, self)
+
+ def __pow__(self, other):
+ return Binop("**", self, other)
+
+ def __rpow__(self, other):
+ return Binop("**", other, self)
+
+ def __getitem__(self, i):
+ if i > len(self):
+ raise StopIteration
+ return Binop("[]", self, i)
+
+ def __cmp__(self, other):
+ return self.eval().__cmp__(other)
+
+ def __eq__(self, other):
+ return self.eval() == other
+
+ def __ne__(self, other):
+ return self.eval() != other
+
+ def __lt__(self, other):
+ return self.eval() < other
+
+ def __le__(self, other):
+ return self.eval() <= other
+
+ def __gt__(self, other):
+ return self.eval() > other
+
+ def __ge__(self, other):
+ return self.eval() >= other
+
+ def __hash__(self):
+ return id(self)
+
+
+def _div(a, b):
+ import six
+
+ if isinstance(a, six.integer_types) and isinstance(b, six.integer_types):
+ if a % b:
+ return a / b
else:
- return a//b
+ return a // b
else:
- return a/b
+ return a / b
class Binop(Formula):
- opmap = { '+': lambda a, b: a + b,
- '*': lambda a, b: a * b,
- '-': lambda a, b: a - b,
- '/': _div,
- '//': lambda a, b: a // b,
- '**': lambda a, b: a ** b,
- '[]': lambda a, b: a[b] ,
- }
+ opmap = {
+ "+": lambda a, b: a + b,
+ "*": lambda a, b: a * b,
+ "-": lambda a, b: a - b,
+ "/": _div,
+ "//": lambda a, b: a // b,
+ "**": lambda a, b: a**b,
+ "[]": lambda a, b: a[b],
+ }
+
def __init__(self, op, value1, value2):
self.op = op
self.values = mkf(value1), mkf(value2)
def __str__(self):
- if self.op == '[]':
+ if self.op == "[]":
return "%s[%s]" % (self.values[0], self.values[1])
else:
return "(%s %s %s)" % (self.values[0], self.op, self.values[1])
+
def __repr__(self):
- if self.op == '[]':
+ if self.op == "[]":
return "%s[%s]" % (self.values[0], self.values[1])
else:
return "(%s %s %s)" % (self.values[0], self.op, self.values[1])
+
def eval(self):
- result= self.opmap[self.op](self.values[0].eval(),
- self.values[1].eval())
- while isinstance(result,Formula):
- result=result.eval()
+ result = self.opmap[self.op](self.values[0].eval(), self.values[1].eval())
+ while isinstance(result, Formula):
+ result = result.eval()
return result
- def __adapt__(self,validator):
+
+ def __adapt__(self, validator):
return validator.adapt(self.eval())
class Unop(Formula):
- opmap = { '-': lambda x: -x,
- 'abs': lambda x: abs(x),
- }
+ opmap = {
+ "-": lambda x: -x,
+ "abs": lambda x: abs(x),
+ }
+
def __init__(self, op, arg):
self._op = op
self._arg = mkf(arg)
+
def __str__(self):
return "%s(%s)" % (self._op, self._arg)
+
def __repr__(self):
return "%s(%s)" % (self._op, self._arg)
+
def eval(self):
return self.opmap[self._op](self._arg.eval())
- def __adapt__(self,validator):
+
+ def __adapt__(self, validator):
return validator.adapt(self.eval())
+
class Unop2(Unop):
def __init__(self, nom, op, arg):
self._nom = nom
self._op = op
- self._arg=[]
+ self._arg = []
for a in arg:
self._arg.append(mkf(a))
+
def __str__(self):
- s="%s(" % self._nom
+ s = "%s(" % self._nom
for a in self._arg:
- s=s+str(a)+','
- s=s+")"
+ s = s + str(a) + ","
+ s = s + ")"
return s
+
def __repr__(self):
- s="%s(" % self._nom
+ s = "%s(" % self._nom
for a in self._arg:
- s=s+str(a)+','
- s=s+")"
+ s = s + str(a) + ","
+ s = s + ")"
return s
+
def eval(self):
- l=[]
+ l = []
for a in self._arg:
l.append(a.eval())
return self._op(*l)
+
class Constant(Formula):
- def __init__(self, value): self._value = value
- def eval(self): return self._value
- def __str__(self): return str(self._value)
- def __adapt__(self,validator):
+ def __init__(self, value):
+ self._value = value
+
+ def eval(self):
+ return self._value
+
+ def __str__(self):
+ return str(self._value)
+
+ def __adapt__(self, validator):
return validator.adapt(self._value)
+
class Variable(Formula):
- def __init__(self,name,value):
- self._name=name
- self._value=value
- def eval(self): return self._value
- def __repr__(self): return "Variable('%s',%s)" % (self._name, self._value)
- def __str__(self): return self._name
- def __adapt__(self,validator):
+ def __init__(self, name, value):
+ self._name = name
+ self._value = value
+
+ def eval(self):
+ return self._value
+
+ def __repr__(self):
+ return "Variable('%s',%s)" % (self._name, self._value)
+
+ def __str__(self):
+ return self._name
+
+ def __adapt__(self, validator):
return validator.adapt(self._value)
+
+
def Eval(f):
- if isinstance(f,Formula):
- f=f.eval()
- elif type(f) in (list, ):
- f=[Eval(i) for i in f]
+ if isinstance(f, Formula):
+ f = f.eval()
+ elif type(f) in (list,):
+ f = [Eval(i) for i in f]
elif type(f) in (tuple,):
- f=tuple([Eval(i) for i in f])
+ f = tuple([Eval(i) for i in f])
return f
-def cos(f): return Unop('ncos', f)
-def sin(f): return Unop('nsin', f)
-def array(f,*tup,**args):
+def cos(f):
+ return Unop("ncos", f)
+
+
+def sin(f):
+ return Unop("nsin", f)
+
+
+def array(f, *tup, **args):
"""array de Numeric met en defaut la mecanique des parametres
- on la supprime dans ce cas. Il faut que la valeur du parametre soit bien definie
+ on la supprime dans ce cas. Il faut que la valeur du parametre soit bien definie
"""
- originalMath=OriginalMath()
- original_narray=originalMath.original_narray
- return original_narray(Eval(f),*tup,**args)
-def sin(f): return Unop('sin', f)
-def cos(f): return Unop('cos', f)
-def ceil(f): return Unop('ceil', f)
-def sqrt(f): return Unop('sqrt', f)
+ originalMath = OriginalMath()
+ original_narray = originalMath.original_narray
+ return original_narray(Eval(f), *tup, **args)
+
+
+def sin(f):
+ return Unop("sin", f)
+
+
+def cos(f):
+ return Unop("cos", f)
+
+
+def ceil(f):
+ return Unop("ceil", f)
+
-def pi2():return Unop('pi')
+def sqrt(f):
+ return Unop("sqrt", f)
-class OriginalMath(object):
+
+def pi2():
+ return Unop("pi")
+
+
+class OriginalMath(object):
_instance = None
+
def __new__(cls, *args, **kwargs):
if not cls._instance:
- cls._instance = super(OriginalMath, cls).__new__(
- cls, *args, **kwargs)
+ cls._instance = super(OriginalMath, cls).__new__(cls, *args, **kwargs)
return cls._instance
def __init__(self):
- if hasattr(self,'pi') :return
+ if hasattr(self, "pi"):
+ return
import math
- try :
+
+ try:
self.toSurcharge()
- except : pass
+ except:
+ pass
def toSurcharge(self):
- self.numeric_ncos=Numeric.cos
- self.numeric_nsin=Numeric.sin
- self.numeric_narray=Numeric.array
- self.sin=math.sin
- self.cos=math.cos
- self.sqrt=math.sqrt
- self.ceil=math.ceil
- self.pi=math.pi
-
- #surcharge de la fonction cos de Numeric pour les parametres
- original_ncos=Numeric.cos
- Unop.opmap['ncos']=lambda x: original_ncos(x)
- Numeric.cos=cos
-
- #surcharge de la fonction sin de Numeric pour les parametres
- original_nsin=Numeric.sin
- Unop.opmap['nsin']=lambda x: original_nsin(x)
- Numeric.sin=sin
-
- #surcharge de la fonction array de Numeric pour les parametres
- original_narray=Numeric.array
- self.original_narray=Numeric.array
- Numeric.array=array
-
- #surcharge de la fonction sin de math pour les parametres
- original_sin=math.sin
- Unop.opmap['sin']=lambda x: original_sin(x)
- math.sin=sin
-
- #surcharge de la fonction cos de math pour les parametres
- original_cos=math.cos
- Unop.opmap['cos']=lambda x: original_cos(x)
- math.cos=cos
-
- #surcharge de la fonction sqrt de math pour les parametres
- original_sqrt=math.sqrt
- Unop.opmap['sqrt']=lambda x: original_sqrt(x)
- math.sqrt=sqrt
-
- #surcharge de la fonction ceil de math pour les parametres
- original_ceil=math.ceil
- Unop.opmap['ceil']=lambda x: original_ceil(x)
- math.ceil=ceil
-
- original_pi=math.pi
- Unop.opmap['pi']=lambda x: original_pi
- pi=Variable('pi',pi2)
- math.pi=pi
+ self.numeric_ncos = Numeric.cos
+ self.numeric_nsin = Numeric.sin
+ self.numeric_narray = Numeric.array
+ self.sin = math.sin
+ self.cos = math.cos
+ self.sqrt = math.sqrt
+ self.ceil = math.ceil
+ self.pi = math.pi
+
+ # surcharge de la fonction cos de Numeric pour les parametres
+ original_ncos = Numeric.cos
+ Unop.opmap["ncos"] = lambda x: original_ncos(x)
+ Numeric.cos = cos
+
+ # surcharge de la fonction sin de Numeric pour les parametres
+ original_nsin = Numeric.sin
+ Unop.opmap["nsin"] = lambda x: original_nsin(x)
+ Numeric.sin = sin
+
+ # surcharge de la fonction array de Numeric pour les parametres
+ original_narray = Numeric.array
+ self.original_narray = Numeric.array
+ Numeric.array = array
+
+ # surcharge de la fonction sin de math pour les parametres
+ original_sin = math.sin
+ Unop.opmap["sin"] = lambda x: original_sin(x)
+ math.sin = sin
+
+ # surcharge de la fonction cos de math pour les parametres
+ original_cos = math.cos
+ Unop.opmap["cos"] = lambda x: original_cos(x)
+ math.cos = cos
+
+ # surcharge de la fonction sqrt de math pour les parametres
+ original_sqrt = math.sqrt
+ Unop.opmap["sqrt"] = lambda x: original_sqrt(x)
+ math.sqrt = sqrt
+
+ # surcharge de la fonction ceil de math pour les parametres
+ original_ceil = math.ceil
+ Unop.opmap["ceil"] = lambda x: original_ceil(x)
+ math.ceil = ceil
+
+ original_pi = math.pi
+ Unop.opmap["pi"] = lambda x: original_pi
+ pi = Variable("pi", pi2)
+ math.pi = pi
def toOriginal(self):
import math
+
try:
import Numeric
except:
import numpy
+
Numeric = numpy
- try :
- Numeric.cos=originalMath.numeric_ncos
- Numeric.sin=originalMath.numeric_nsin
- Numeric.array=originalMath.numeric_narray
- except : pass
- math.sin=originalMath.sin
- math.cos=originalMath.cos
- math.sqrt=originalMath.sqrt
- math.ceil=originalMath.ceil
- math.pi=originalMath.pi
+ try:
+ Numeric.cos = originalMath.numeric_ncos
+ Numeric.sin = originalMath.numeric_nsin
+ Numeric.array = originalMath.numeric_narray
+ except:
+ pass
+ math.sin = originalMath.sin
+ math.cos = originalMath.cos
+ math.sqrt = originalMath.sqrt
+ math.ceil = originalMath.ceil
+ math.pi = originalMath.pi
-originalMath=OriginalMath()
+originalMath = OriginalMath()
"""
# import de modules Python
-from __future__ import absolute_import
-from __future__ import print_function
-try :
- from builtins import str
- from builtins import object
-except : pass
+from builtins import str
+from builtins import object
import types
from math import *
from Extensions.i18n import tr
-class PARAMETRE(N_OBJECT.OBJECT,I_OBJECT.OBJECT,Formula) :
+class PARAMETRE(N_OBJECT.OBJECT, I_OBJECT.OBJECT, Formula):
"""
- Cette classe permet de creer des objets de type PARAMETRE
- cad des affectations directes dans le jeu de commandes (ex: a=10.)
- qui sont interpretees par le parseur de fichiers Python.
- Les objets ainsi crees constituent des parametres pour le jdc
+ Cette classe permet de creer des objets de type PARAMETRE
+ cad des affectations directes dans le jeu de commandes (ex: a=10.)
+ qui sont interpretees par le parseur de fichiers Python.
+ Les objets ainsi crees constituent des parametres pour le jdc
"""
- nature = 'PARAMETRE'
- idracine = 'param'
+ nature = "PARAMETRE"
+ idracine = "param"
- def __new__(cls,nom,valeur=None):
- # on est en relecture du .comm: l objet a ete detecte comme parametre par le parsing
- # mais il s agit d une reference, une UserASDD
- if (issubclass(valeur.__class__, UserASSDMultiple)):
+ def __new__(cls, nom, valeur=None):
+ # on est en relecture du .comm: l objet a ete detecte comme parametre par le parsing
+ # mais il s agit d une reference, une UserASDD
+ if issubclass(valeur.__class__, UserASSDMultiple):
valeur.initialiseNom(nom)
return valeur
- if (issubclass(valeur.__class__, UserASSD)):
+ if issubclass(valeur.__class__, UserASSD):
valeur.initialiseNom(nom)
return valeur
- try :
- return super(PARAMETRE, cls).__new__(cls,*args,**kwargs)
- except :
+ try:
+ return super(PARAMETRE, cls).__new__(cls, *args, **kwargs)
+ except:
return super(PARAMETRE, cls).__new__(cls)
-
- def __init__(self,nom,valeur=None):
- #print ('__init__ de parametre pour', nom,valeur)
+ def __init__(self, nom, valeur=None):
+ # print ('__init__ de parametre pour', nom,valeur)
self.nom = nom
# La classe PARAMETRE n'a pas de definition : on utilise self pour
# completude
- self.definition=self
+ self.definition = self
# parent ne peut etre qu'un objet de type JDC
self.jdc = self.parent = CONTEXT.getCurrentStep()
- self.niveau=self.parent.niveau
- self.actif=1
- self.state='undetermined'
+ self.niveau = self.parent.niveau
+ self.actif = 1
+ self.state = "undetermined"
self.register()
- self.dict_valeur=[]
- #self.valeur = self.interpreteValeur(valeur)
- #self.val=valeur
+ self.dict_valeur = []
+ # self.valeur = self.interpreteValeur(valeur)
+ # self.val=valeur
self.valeur = valeur
- self.val=repr(valeur)
- self.fenetreIhm=None
+ self.val = repr(valeur)
+ self.fenetreIhm = None
- def interpreteValeur(self,val):
+ def interpreteValeur(self, val):
"""
Essaie d'interpreter val (chaine de caracteres)comme :
- un entier
- une liste d'items d'un type qui precede
Retourne la valeur interpretee
"""
- #if not val : return None
+ # if not val : return None
valeur = None
if type(val) == list:
- # Un premier traitement a ete fait lors de la saisie
- # permet de tester les parametres qui sont des listes
+ # Un premier traitement a ete fait lors de la saisie
+ # permet de tester les parametres qui sont des listes
l_new_val = []
- for v in val :
- try :
- valeur=eval(str(v))
+ for v in val:
+ try:
+ valeur = eval(str(v))
l_new_val.append(v)
- except :
+ except:
return None
return l_new_val
- if type(val) == bytes or type(val) == str:
+ if type(val) == bytes or type(val) == str:
# on tente l'evaluation dans un contexte fourni par le parent s'il existe
if self.parent:
- valeur=self.parent.evalInContext(val,self)
+ valeur = self.parent.evalInContext(val, self)
else:
- try :
+ try:
valeur = eval(val)
except:
- #traceback.print_exc()
+ # traceback.print_exc()
pass
- #PN je n ose pas modifier je rajoute
+ # PN je n ose pas modifier je rajoute
# refus des listes heterogenes : ne dvrait pas etre la
- if valeur != None :
+ if valeur != None:
if type(valeur) == tuple:
l_new_val = []
typ = None
- for v in valeur :
+ for v in valeur:
if not typ:
typ = type(v)
else:
- if type(v) != typ :
+ if type(v) != typ:
# la liste est heterogene --> on refuse d'interpreter
# self comme une liste
# on retourne la string initiale
- print(('liste heterogene ',val))
+ print(("liste heterogene ", val))
return val
l_new_val.append(v)
return tuple(l_new_val)
- if valeur != None :
- if type(valeur).__name__ == 'list':
- self.dict_valeur=[]
+ if valeur != None:
+ if type(valeur).__name__ == "list":
+ self.dict_valeur = []
for i in range(len(valeur)):
self.dict_valeur.append(valeur[i])
return valeur
return val
def getValeurs(self):
- valeurretour=[]
+ valeurretour = []
if self.dict_valeur != []:
for val in self.dict_valeur:
valeurretour.append(val)
valeurretour.append(self.valeur)
return valeurretour
- def setValeur(self,new_valeur):
+ def setValeur(self, new_valeur):
"""
Remplace la valeur de self par new_valeur interpretee
"""
self.valeur = self.interpreteValeur(new_valeur)
- self.val=repr(self.valeur)
- self.parent.updateConceptAfterEtape(self,self)
+ self.val = repr(self.valeur)
+ self.parent.updateConceptAfterEtape(self, self)
self.initModif()
- def setNom(self,new_nom):
+ def setNom(self, new_nom):
"""
Change le nom du parametre
"""
self.initModif()
- self.nom=new_nom
+ self.nom = new_nom
self.finModif()
def initModif(self):
Methode qui declare l'objet courant comme modifie et propage
cet etat modifie a ses ascendants
"""
- self.state = 'modified'
+ self.state = "modified"
if self.parent:
self.parent.initModif()
self.parent.registerParametre(self)
self.parent.register(self)
- def isValid(self,cr='non'):
+ def isValid(self, cr="non"):
"""
Retourne 1 si self est valide, 0 sinon
Un parametre est considere comme valide si :
- il a un nom
- il a une valeur
"""
- if self.nom == '' :
- if cr == 'oui':
+ if self.nom == "":
+ if cr == "oui":
self.cr.fatal(tr("Pas de nom donne au parametre "))
return 0
else:
- if self.valeur == None :
- if cr == 'oui' :
- self.cr.fatal(tr("Le parametre %s ne peut valoir None" , self.nom))
+ if self.valeur == None:
+ if cr == "oui":
+ self.cr.fatal(tr("Le parametre %s ne peut valoir None", self.nom))
return 0
return 1
"""
self.parent = None
self.jdc = None
- self.definition=None
- self.niveau=None
+ self.definition = None
+ self.niveau = None
def active(self):
"""
self.jdc.appendParam(self)
except:
pass
- CONNECTOR.Emit(self,"add",None)
- CONNECTOR.Emit(self,"valid")
+ CONNECTOR.Emit(self, "add", None)
+ CONNECTOR.Emit(self, "valid")
def inactive(self):
"""
"""
self.actif = 0
self.jdc.delParam(self)
- self.jdc.deleteConceptAfterEtape(self,self)
- CONNECTOR.Emit(self,"supp",None)
- CONNECTOR.Emit(self,"valid")
+ self.jdc.deleteConceptAfterEtape(self, self)
+ CONNECTOR.Emit(self, "supp", None)
+ CONNECTOR.Emit(self, "valid")
def isActif(self):
"""
"""
return self.actif
- def setAttribut(self,nom_attr,new_valeur):
+ def setAttribut(self, nom_attr, new_valeur):
"""
Remplace la valeur de self.nom_attr par new_valeur)
"""
- if hasattr(self,nom_attr):
- setattr(self,nom_attr,new_valeur)
+ if hasattr(self, nom_attr):
+ setattr(self, nom_attr, new_valeur)
self.initModif()
def supprimeSdProds(self):
self.jdc.deleteParam(self)
self.parent.deleteConcept(self)
- def updateContext(self,d):
+ def updateContext(self, d):
"""
Update le dictionnaire d avec le parametre que produit self
"""
- d[self.nom]=self
+ d[self.nom] = self
def __repr__(self):
"""
- Donne un echo de self sous la forme nom = valeur
+ Donne un echo de self sous la forme nom = valeur
"""
- if type(self.valeur) == bytes or type(self.valeur) == str :
- if self.valeur.find('\n') == -1:
+ if type(self.valeur) == bytes or type(self.valeur) == str:
+ if self.valeur.find("\n") == -1:
# pas de retour chariot, on utilise repr
- return self.nom+' = '+ repr(self.valeur)
+ return self.nom + " = " + repr(self.valeur)
elif self.valeur.find('"""') == -1:
# retour chariot mais pas de triple ", on formatte
- return self.nom+' = """'+self.valeur+'"""'
+ return self.nom + ' = """' + self.valeur + '"""'
else:
- return self.nom+' = '+ repr(self.valeur)
+ return self.nom + " = " + repr(self.valeur)
else:
- if type(self.valeur) == list :
- aRetourner=self.nom+' = ['
- for l in self.valeur :
- aRetourner=aRetourner+str(l) +","
- aRetourner=aRetourner[0:-1]+']'
+ if type(self.valeur) == list:
+ aRetourner = self.nom + " = ["
+ for l in self.valeur:
+ aRetourner = aRetourner + str(l) + ","
+ aRetourner = aRetourner[0:-1] + "]"
return aRetourner
- return self.nom+' = '+ str(self.valeur)
+ return self.nom + " = " + str(self.valeur)
def __str__(self):
"""
- Retourne le nom du parametre comme representation de self
+ Retourne le nom du parametre comme representation de self
"""
return self.nom
- def getSdprods(self,nom_sd):
+ def getSdprods(self, nom_sd):
"""
- Retourne les concepts produits par la commande
+ Retourne les concepts produits par la commande
"""
return None
def report(self):
- """ Genere l'objet rapport (classe CR) """
- self.cr=CR()
- self.isValid(cr='oui')
+ """Genere l'objet rapport (classe CR)"""
+ self.cr = CR()
+ self.isValid(cr="oui")
return self.cr
def ident(self):
"""
return self.nom
- def deleteConcept(self,sd):
+ def deleteConcept(self, sd):
pass
- def replaceConcept(self,old_sd,sd):
+ def replaceConcept(self, old_sd, sd):
pass
def verifConditionBloc(self):
"""
- Evalue les conditions de tous les blocs fils possibles
- (en fonction du catalogue donc de la definition) de self et
- retourne deux listes :
- - la premiere contient les noms des blocs a rajouter
- - la seconde contient les noms des blocs a supprimer
+ Evalue les conditions de tous les blocs fils possibles
+ (en fonction du catalogue donc de la definition) de self et
+ retourne deux listes :
+ - la premiere contient les noms des blocs a rajouter
+ - la seconde contient les noms des blocs a supprimer
"""
- return [],[]
+ return [], []
- def verifConditionRegles(self,liste_presents):
+ def verifConditionRegles(self, liste_presents):
"""
- Retourne la liste des mots-cles a rajouter pour satisfaire les regles
- en fonction de la liste des mots-cles presents
+ Retourne la liste des mots-cles a rajouter pour satisfaire les regles
+ en fonction de la liste des mots-cles presents
"""
return []
def verifExistenceSd(self):
pass
- def controlSdprods(self,d):
- """sans objet """
+ def controlSdprods(self, d):
+ """sans objet"""
pass
def close(self):
pass
def eval(self):
- if isinstance(self.valeur,Formula):
+ if isinstance(self.valeur, Formula):
return self.valeur.eval()
else:
return self.valeur
- def __adapt__(self,validator):
+ def __adapt__(self, validator):
return validator.adapt(self.eval())
-class COMBI_PARAMETRE(object) :
- def __init__(self,chainevaleur,valeur):
- self.chainevaleur=chainevaleur
- self.valeur=valeur
+
+class COMBI_PARAMETRE(object):
+ def __init__(self, chainevaleur, valeur):
+ self.chainevaleur = chainevaleur
+ self.valeur = valeur
def __repr__(self):
return self.chainevaleur
if self.valeur and self.chainevaleur:
return 1
-class ITEM_PARAMETRE(object) :
- def __init__(self,param_pere,item=None):
+
+class ITEM_PARAMETRE(object):
+ def __init__(self, param_pere, item=None):
self.param_pere = param_pere
self.item = item
-
def __repr__(self):
- return self.param_pere.nom+'['+str(self.item)+']'
-
+ return self.param_pere.nom + "[" + str(self.item) + "]"
def isValid(self):
isValid = 1
if self.item < 0:
- isValid = 0
+ isValid = 0
try:
- longueur= len(self.param_pere.dict_valeur) - 1
+ longueur = len(self.param_pere.dict_valeur) - 1
except:
- longueur=0
- if self.item > longueur :
- isValid= 0
+ longueur = 0
+ if self.item > longueur:
+ isValid = 0
return isValid
de l'utilisateur par le parseur de fichiers Python
"""
# import de modules Python
-from __future__ import absolute_import
-from __future__ import print_function
-import types,re
+import types, re
import traceback
# import modules Eficas
from Extensions.i18n import tr
from . import parametre
-pattern_eval = re.compile(r'^(EVAL)([ \t\r\f\v]*)\(([\w\W]*)')
+pattern_eval = re.compile(r"^(EVAL)([ \t\r\f\v]*)\(([\w\W]*)")
-class PARAMETRE_EVAL(parametre.PARAMETRE) :
+
+class PARAMETRE_EVAL(parametre.PARAMETRE):
"""
Cette classe permet de creer des objets de type PARAMETRE_EVAL
cad des affectations directes evaluees dans le jeu de commandes (ex: a=EVAL('''10.*SQRT(25)'''))
qui sont interpretees par le parseur de fichiers Python.
Les objets ainsi crees constituent des parametres evalues pour le jdc
"""
- nature = 'PARAMETRE_EVAL'
- idracine='param_eval'
- def __init__(self,nom,valeur=None):
+ nature = "PARAMETRE_EVAL"
+ idracine = "param_eval"
+
+ def __init__(self, nom, valeur=None):
# parent ne peut etre qu'un objet de type JDC
import Accas
- self.Accas_EVAL=Accas.EVAL
+
+ self.Accas_EVAL = Accas.EVAL
self.valeur = self.interpreteValeur(valeur)
- self.val = valeur
+ self.val = valeur
self.nom = nom
self.jdc = self.parent = CONTEXT.getCurrentStep()
- self.definition=self
+ self.definition = self
self.niveau = self.parent.niveau
- self.actif=1
- self.state='undetermined'
+ self.actif = 1
+ self.state = "undetermined"
# Ceci est-il indispensable ???
- #self.appel = N_utils.calleeWhere(niveau=2)
+ # self.appel = N_utils.calleeWhere(niveau=2)
self.register()
def __repr__(self):
"""
- Donne un echo de self sous la forme nom = valeur
+ Donne un echo de self sous la forme nom = valeur
"""
- return self.nom+' = '+ repr(self.valeur)
+ return self.nom + " = " + repr(self.valeur)
def __str__(self):
"""
- Retourne le nom du parametre evalue comme representation de self
+ Retourne le nom du parametre evalue comme representation de self
"""
return self.nom
- def interpreteValeur(self,val):
+ def interpreteValeur(self, val):
"""
Essaie d'interpreter val (chaine de caracteres ou None) comme :
une instance de Accas.EVAL
Retourne la valeur interpretee
"""
- if not val : return None
- d={}
+ if not val:
+ return None
+ d = {}
val = val.strip()
- if val[-1] == ';' : val = val[0:-1]
- d['EVAL'] = self.Accas_EVAL
+ if val[-1] == ";":
+ val = val[0:-1]
+ d["EVAL"] = self.Accas_EVAL
try:
- valeur = eval(val,{},d)
+ valeur = eval(val, {}, d)
return valeur
except:
traceback.print_exc()
- print(("Le texte %s n'est pas celui d'un parametre evalue" %val))
+ print(("Le texte %s n'est pas celui d'un parametre evalue" % val))
return None
- def setValeur(self,new_valeur):
+ def setValeur(self, new_valeur):
"""
Remplace la valeur de self par new_valeur interpretee.
"""
self.val = new_valeur
self.initModif()
- def getNom(self) :
+ def getNom(self):
"""
Retourne le nom du parametre
"""
"""
Retourne la valeur de self, cad le texte de l'objet class_eval.EVAL
"""
- if self.valeur :
+ if self.valeur:
return self.valeur.valeur
else:
- return ''
+ return ""
- def verifEval(self,exp_eval=None,cr='non'):
+ def verifEval(self, exp_eval=None, cr="non"):
"""
Cette methode a pour but de verifier si l'expression EVAL
est syntaxiquement correcte.
- un message d'erreurs ('' si illicite)
"""
if not exp_eval:
- if self.valeur :
- exp_eval = self.valeur.valeur[3:-3] # on enleve les triples guillemets
+ if self.valeur:
+ exp_eval = self.valeur.valeur[3:-3] # on enleve les triples guillemets
else:
exp_eval = None
- if exp_eval :
+ if exp_eval:
# on construit un interpreteur de formule
- formule=(self.nom,'',None,exp_eval)
+ formule = (self.nom, "", None, exp_eval)
# on recupere la liste des constantes et des autres fonctions predefinies
# et qui peuvent etre utilisees dans le corps de la formule courante
- l_ctes,l_form = self.jdc.getParametresFonctionsAvantEtape(self)
+ l_ctes, l_form = self.jdc.getParametresFonctionsAvantEtape(self)
# on cree un objet verificateur
- verificateur = interpreteur_formule.Interpreteur_Formule(formule=formule,
- constantes = l_ctes,
- fonctions = l_form)
- if cr == 'oui' :
+ verificateur = interpreteur_formule.Interpreteur_Formule(
+ formule=formule, constantes=l_ctes, fonctions=l_form
+ )
+ if cr == "oui":
if not verificateur.cr.estvide():
self.cr.fatal(verificateur.cr.getMessFatal())
- return verificateur.isValid(),''.join(verificateur.cr.crfatal)
+ return verificateur.isValid(), "".join(verificateur.cr.crfatal)
else:
# pas d'expression EVAL --> self non valide
- if cr == 'oui' :
- self.cr.fatal(tr("Le parametre EVAL %s ne peut valoir None") , self.nom)
- return 0,tr("Le parametre EVAL ne peut valoir None")
+ if cr == "oui":
+ self.cr.fatal(tr("Le parametre EVAL %s ne peut valoir None"), self.nom)
+ return 0, tr("Le parametre EVAL ne peut valoir None")
- def verifNom(self,nom=None,cr='non'):
+ def verifNom(self, nom=None, cr="non"):
"""
Verifie si le nom passe en argument (si aucun prend le nom courant)
est un nom valide pour un parametre EVAL
- un booleen, qui vaut 1 si nom licite, 0 sinon
- un message d'erreurs ('' si illicite)
"""
- if not nom :
+ if not nom:
nom = self.nom
- if nom == "" :
- if cr == 'oui' : self.cr.fatal(tr("Pas de nom donne au parametre EVAL"))
- return 0,"Pas de nom donne au parametre EVAL"
- if len(nom) > 8 :
- if cr == 'oui' : self.cr.fatal(tr("Un nom de parametre ne peut depasser 8 caracteres"))
- return 0,"Un nom de parametre ne peut depasser 8 caracteres"
- sd = self.parent.getSdAutourEtape(nom,self)
- if sd :
- if cr == 'oui' : self.cr.fatal(tr("Un concept de nom %s existe deja !"), nom)
- return 0,"Un concept de nom %s existe deja !" %nom
- return 1,''
-
- def verifParametreEval(self,param=None,cr='non'):
+ if nom == "":
+ if cr == "oui":
+ self.cr.fatal(tr("Pas de nom donne au parametre EVAL"))
+ return 0, "Pas de nom donne au parametre EVAL"
+ if len(nom) > 8:
+ if cr == "oui":
+ self.cr.fatal(tr("Un nom de parametre ne peut depasser 8 caracteres"))
+ return 0, "Un nom de parametre ne peut depasser 8 caracteres"
+ sd = self.parent.getSdAutourEtape(nom, self)
+ if sd:
+ if cr == "oui":
+ self.cr.fatal(tr("Un concept de nom %s existe deja !"), nom)
+ return 0, "Un concept de nom %s existe deja !" % nom
+ return 1, ""
+
+ def verifParametreEval(self, param=None, cr="non"):
"""
Verifie la validite du parametre EVAL passe en argument.
Ce nouveau parametre est passe sous la forme d'un tuple : (nom,valeur)
- un booleen, qui vaut 1 si EVAL licite, 0 sinon
- un message d'erreurs ('' si illicite)
"""
- if not param :
- if self.valeur :
- param = (self.nom,self.valeur.valeur)
+ if not param:
+ if self.valeur:
+ param = (self.nom, self.valeur.valeur)
else:
- param = (self.nom,None)
- test_nom,erreur_nom = self.verifNom(param[0],cr=cr)
- test_eval,erreur_eval = self.verifEval(param[1],cr=cr)
+ param = (self.nom, None)
+ test_nom, erreur_nom = self.verifNom(param[0], cr=cr)
+ test_eval, erreur_eval = self.verifEval(param[1], cr=cr)
# test global = produit des tests partiels
- test = test_nom*test_eval
+ test = test_nom * test_eval
# message d'erreurs global = concatenation des messages partiels
- erreur = ''
- if not test :
- for mess in (erreur_nom,erreur_eval):
- erreur = erreur+(len(mess) > 0)*'\n'+mess
- return test,erreur
+ erreur = ""
+ if not test:
+ for mess in (erreur_nom, erreur_eval):
+ erreur = erreur + (len(mess) > 0) * "\n" + mess
+ return test, erreur
- def update(self,param):
+ def update(self, param):
"""
Methode externe.
Met a jour les champs nom, valeur de self
"""
self.initModif()
self.setNom(param[0])
- self.setValeur('EVAL("""'+param[1]+'""")')
+ self.setValeur('EVAL("""' + param[1] + '""")')
- def isValid(self,cr='non'):
+ def isValid(self, cr="non"):
"""
Retourne 1 si self est valide, 0 sinon
Un parametre evalue est considere comme valide si :
- il a un nom
- il a une valeur qui est interpretable par l'interpreteur de FORMULEs
"""
- resu,erreur= self.verifParametreEval(cr=cr)
+ resu, erreur = self.verifParametreEval(cr=cr)
return resu
def report(self):
"""
- Genere l'objet rapport (classe CR)
+ Genere l'objet rapport (classe CR)
"""
self.cr = CR()
- self.isValid(cr='oui')
+ self.isValid(cr="oui")
return self.cr
- def setNom(self,new_nom):
+ def setNom(self, new_nom):
"""
Remplace le nom de self par new_nom
"""
Ce module contient le chargeur dynamique de plugins (emprunte a HappyDoc)
"""
-from __future__ import absolute_import
-import glob,os,sys,traceback
-try:
- from UserDict import UserDict
-except ImportError:
- from collections import UserDict
+import glob, os, sys, traceback
+from collections import UserDict
class PluginLoader(UserDict):
- def __init__(self,module):
+ def __init__(self, module):
UserDict.__init__(self)
- self.plugin_dir=module.__path__[0]
- self.plugin_setName=module.__name__
- _module_list = glob.glob( os.path.join( self.plugin_dir,
- '%s*py' % self.plugin_setName,
- )
- )
+ self.plugin_dir = module.__path__[0]
+ self.plugin_setName = module.__name__
+ _module_list = glob.glob(
+ os.path.join(
+ self.plugin_dir,
+ "%s*py" % self.plugin_setName,
+ )
+ )
_module_list.sort()
for _module_name in _module_list:
-
_module_name = os.path.basename(_module_name)[:-3]
- _import_name = '%s.%s' % ( self.plugin_setName,
- _module_name )
+ _import_name = "%s.%s" % (self.plugin_setName, _module_name)
try:
- _module = __import__( _import_name )
+ _module = __import__(_import_name)
except:
- sys.stderr.write('\n--- Plugin Module Error ---\n')
+ sys.stderr.write("\n--- Plugin Module Error ---\n")
traceback.print_exc()
- sys.stderr.write('---------------------------\n\n')
+ sys.stderr.write("---------------------------\n\n")
continue
try:
_module = getattr(_module, _module_name)
except AttributeError:
- sys.stderr.write('ERROR: Could not retrieve %s\n' % _import_name)
+ sys.stderr.write("ERROR: Could not retrieve %s\n" % _import_name)
try:
info = _module.entryPoint()
else:
self.addEntryPoint(info)
-
- def addEntryPoint(self,infoDict):
- name=infoDict['name']
- factory=infoDict['factory']
- self[name]=factory
+ def addEntryPoint(self, infoDict):
+ name = infoDict["name"]
+ factory = infoDict["factory"]
+ self[name] = factory
-from __future__ import absolute_import
from .translationQT5 import tr
from .translationQT5 import tr_qt
tuples, or atoms.
"""
-from __future__ import absolute_import
-try :
- from builtins import zip
- from builtins import map
- from builtins import range
-except :
- pass
+from builtins import zip
+from builtins import map
+from builtins import range
from .eficas_exception import EficasException
import re
-regex=re.compile(r"% *[0-9]+")
+
+regex = re.compile(r"% *[0-9]+")
import six
from six.moves import map
from six.moves import zip
-
-
def _reformat_qstring_from_tuple(qstring, params):
"""
_reformat_qstring_from_tuple(string, tuple) -> string
and a tuple specifying the parameters of the string.
"""
from PyQt5.QtCore import QRegExp
+
reg = QRegExp("\%\.[1-9]{1,2}f")
for p, j in zip(params, list(range(len(params)))):
try:
- i += 1 + qstring[i + 1:].indexOf("%")
+ i += 1 + qstring[i + 1 :].indexOf("%")
except NameError:
i = qstring.indexOf("%")
if i == reg.indexIn(qstring):
- precision = reg.cap(0).split('.')[1].split('f')[0]
- qstring = qstring[:i + 2 + len(precision)].\
- replace("%." + precision, "%" + six.text_type(1 + j)) + \
- qstring[i + 3 + len(precision):]
- qstring=regex.sub("{}",qstring)
- #qstring = qstring.format(QString.number(float(params[j]), 'f', int(precision)))
+ precision = reg.cap(0).split(".")[1].split("f")[0]
+ qstring = (
+ qstring[: i + 2 + len(precision)].replace(
+ "%." + precision, "%" + six.text_type(1 + j)
+ )
+ + qstring[i + 3 + len(precision) :]
+ )
+ qstring = regex.sub("{}", qstring)
+ # qstring = qstring.format(QString.number(float(params[j]), 'f', int(precision)))
qstring = qstring.format(float(params[j]))
else:
- qstring = qstring[:i + 1].replace("%", "%" + six.text_type(1 + j)) + \
- qstring[i + 2:]
+ qstring = (
+ qstring[: i + 1].replace("%", "%" + six.text_type(1 + j))
+ + qstring[i + 2 :]
+ )
if isinstance(params[j], six.text_type):
- qstring=regex.sub("{}",qstring)
+ qstring = regex.sub("{}", qstring)
qstring = qstring.format(params[j])
elif isinstance(params[j], float):
- qstring=regex.sub("{}",qstring)
- #qstring = qstring.format(QString.number(params[j], 'f',\ len(unicode(params[j]).\
+ qstring = regex.sub("{}", qstring)
+ # qstring = qstring.format(QString.number(params[j], 'f',\ len(unicode(params[j]).\
# split('.')[1])))
qstring = qstring.format(params[j])
elif isinstance(params[j], int):
- qstring=regex.sub("{}",qstring)
- #qstring = qstring.format(QString.number(params[j], 10))
+ qstring = regex.sub("{}", qstring)
+ # qstring = qstring.format(QString.number(params[j], 10))
qstring = qstring.format(params[j])
elif isinstance(params[j], list):
- qstring=regex.sub("{}",qstring)
+ qstring = regex.sub("{}", qstring)
qstring = qstring.format(repr(params[j]))
else:
- raise EficasException("TypeError: i18n.translation: \
- Unicode, list or number expected!")
+ raise EficasException(
+ "TypeError: i18n.translation: \
+ Unicode, list or number expected!"
+ )
return qstring
+
def _reformat_qstring_from_dict(qstring, params):
"""
_reformat_qstring_from_dict(string, dict) -> string
and a dictionary specifying the parameters of the string.
"""
from PyQt5.QtCore import QRegExp
+
for p, j in zip(params, list(range(len(params)))):
- p_reg = QRegExp("\%\("+ p + "\)\.[1-9]{1,2}f")
+ p_reg = QRegExp("\%\(" + p + "\)\.[1-9]{1,2}f")
p_index = p_reg.indexIn(qstring)
if p_index != -1:
- precision = p_reg.cap(0).split('.')[1].split('f')[0]
- #qstring = qstring.replace("%(" + p + ")." + precision + "f",\
+ precision = p_reg.cap(0).split(".")[1].split("f")[0]
+ # qstring = qstring.replace("%(" + p + ")." + precision + "f",\
# "%" + unicode(1 + j)).\
# arg(QString.number(float(params[p]), \
# 'f', \
# int(precision)))
- qstring = qstring.replace("%(" + p + ")." + precision + "f","%" + six.text_type(1 + j))
- qstring=regex.sub("{}",qstring)
+ qstring = qstring.replace(
+ "%(" + p + ")." + precision + "f", "%" + six.text_type(1 + j)
+ )
+ qstring = regex.sub("{}", qstring)
qstring = qstring.format(float(params[p]))
else:
qstring.remove(QRegExp("\\)[sdf]{1}"))
qstring = qstring.replace("%(" + p, "%" + six.text_type(1 + j))
if isinstance(params[p], six.text_type):
- qstring=regex.sub("{}",qstring)
+ qstring = regex.sub("{}", qstring)
qstring = qstring.format(params[p])
elif isinstance(params[p], float):
- qstring=regex.sub("{}",qstring)
+ qstring = regex.sub("{}", qstring)
qstring = qstring.format(params[p])
- #qstring = qstring.format(QString.number(params[p], 'f', \
+ # qstring = qstring.format(QString.number(params[p], 'f', \
# len(unicode(params[p]).split('.')[1])))
elif isinstance(params[p], int):
- qstring=regex.sub("{}",qstring)
+ qstring = regex.sub("{}", qstring)
qstring = qstring.format(params[p])
elif isinstance(params[p], list):
- qstring=regex.sub("{}",qstring)
+ qstring = regex.sub("{}", qstring)
qstring = qstring.format(repr(params[p]))
else:
- raise EficasException("TypeError: i18n.translation: \
- Improper string parameter type.")
+ raise EficasException(
+ "TypeError: i18n.translation: \
+ Improper string parameter type."
+ )
return qstring
+
def _reformat_qstring_from_atom(qstring, params):
"""
_reformat_qstring_from_atom(string, int-or-float) -> string
the string.
"""
from PyQt5.QtCore import QRegExp
+
reg = QRegExp("\%\.[1-9]{1,2}f")
if qstring.count("%") == 0:
qstring.append("%1")
try:
- qstring=regex.sub("{}",qstring)
+ qstring = regex.sub("{}", qstring)
qstring = qstring.format(six.text_type(params))
except AttributeError:
- qstring=regex.sub("{}",qstring)
+ qstring = regex.sub("{}", qstring)
qstring = qstring.format(params)
elif qstring.count("%") == 1:
i = qstring.indexOf("%")
if i == reg.indexIn(qstring):
- precision = reg.cap(0).split('.')[1].split('f')[0]
- qstring = qstring[: i + 2 + len(precision)].\
- replace("%." + precision, "%1") + \
- qstring[i + 3 + len(precision):]
- qstring=regex.sub("{}",qstring)
+ precision = reg.cap(0).split(".")[1].split("f")[0]
+ qstring = (
+ qstring[: i + 2 + len(precision)].replace("%." + precision, "%1")
+ + qstring[i + 3 + len(precision) :]
+ )
+ qstring = regex.sub("{}", qstring)
qstring = qstring.format((params))
- #qstring = qstring.format(QString.number(float(params), 'f',\
+ # qstring = qstring.format(QString.number(float(params), 'f',\
# int(precision)))
else:
- qstring = qstring[:i + 1].replace("%", "%1") + \
- qstring[i + 2:]
+ qstring = qstring[: i + 1].replace("%", "%1") + qstring[i + 2 :]
if isinstance(params, (six.text_type, str)):
qstring = qstring.format(_preprocess_atom(params))
elif isinstance(params, float):
- #qstring = qstring.format(QString.number(params, 'f', \
+ # qstring = qstring.format(QString.number(params, 'f', \
# len(unicode(params).\
# split('.')[1])))
qstring = qstring.format(params)
elif isinstance(params, int):
- qstring=regex.sub("{}",qstring)
- #qstring = qstring.format(QString.number(params, 10))
+ qstring = regex.sub("{}", qstring)
+ # qstring = qstring.format(QString.number(params, 10))
qstring = qstring.format(params)
else:
- raise EficasException("TypeError: i18n.translation: Unicode, \
- string or number expected!")
+ raise EficasException(
+ "TypeError: i18n.translation: Unicode, \
+ string or number expected!"
+ )
return qstring
+
def _reformat_qstring_from_list(qstring, params):
"""
_reformat_qstring_from_list(string, tuple) -> string
"""
# XXX to add further functionality, e.g. list processing
# when ``%`` not at the end.
- if qstring.count("%") == 1 and \
- six.text_type(qstring).strip()[:-1].endswith("%"):
- qstring = qstring[:qstring.indexOf("%") + 1].append("1")
- qstring=regex.sub("{}",qstring)
- qstring = qstring.format(u' '.join(map(six.text_type, params)))
+ if qstring.count("%") == 1 and six.text_type(qstring).strip()[:-1].endswith("%"):
+ qstring = qstring[: qstring.indexOf("%") + 1].append("1")
+ qstring = regex.sub("{}", qstring)
+ qstring = qstring.format(" ".join(map(six.text_type, params)))
elif qstring.count("%") == 0:
qstring.append("%1")
- qstring=regex.sub("{}",qstring)
- qstring = qstring.format(u' '.join(map(six.text_type, params)))
+ qstring = regex.sub("{}", qstring)
+ qstring = qstring.format(" ".join(map(six.text_type, params)))
else:
- raise EficasException("ValueError: i18n.translation: \
- At most one '%' expected!")
+ raise EficasException(
+ "ValueError: i18n.translation: \
+ At most one '%' expected!"
+ )
return qstring
+
def _preprocess_atom(string):
"""
_preprocess_atom(string-or-number-or-unicode) -> unicode
elif isinstance(string, str):
return _str_toUnicode(string)
else:
- raise EficasException("TypeError: Expected number, string or\
- Unicode object!")
+ raise EficasException(
+ "TypeError: Expected number, string or\
+ Unicode object!"
+ )
+
def _str_toUnicode(string):
"""
try:
string = six.text_type(string, "iso-8859-15")
except UnicodeDecodeError:
- raise EficasException("UnicodeDecodeError: UTF-8, Latin-1 \
- or Latin-9 expected")
+ raise EficasException(
+ "UnicodeDecodeError: UTF-8, Latin-1 \
+ or Latin-9 expected"
+ )
return string
+
def tr(string, *args):
"""tr(string-or-unicode, iterable-or-float-or-int) -> unicode
- tr(string-or-unicode) -> unicode
+ tr(string-or-unicode) -> unicode
- Returns a formatted Unicode object from an unformatted
- string or Unicode object with formatting specifications, and,
- optionally, an iterable or an int or float.
- Lets Python do the string formatting."""
- try :
+ Returns a formatted Unicode object from an unformatted
+ string or Unicode object with formatting specifications, and,
+ optionally, an iterable or an int or float.
+ Lets Python do the string formatting."""
+ try:
from PyQt5.QtWidgets import QApplication
- except :
+ except:
return string
string = _preprocess_atom(string)
if string.count("%") == len(args[0]):
r = six.text_type(QApplication.translate("@default", string)) % args[0]
elif string.count("%") == 1 and string.count("%(") == 0:
- r = six.text_type(QApplication.translate("@default", string))\
- % _preprocess_atom(repr(args[0]))
+ r = six.text_type(
+ QApplication.translate("@default", string)
+ ) % _preprocess_atom(repr(args[0]))
elif string.count("%") == 0:
r = (six.text_type(QApplication.translate("@default", string)), args[0])
else:
- raise EficasException("ValueError: i18n.translate.tr: \
- Improper input string formatting")
+ raise EficasException(
+ "ValueError: i18n.translate.tr: \
+ Improper input string formatting"
+ )
elif isinstance(args[0], (six.text_type, str, int, float, complex)):
if string.count("%") == 1:
- r = six.text_type(QApplication.translate("@default", string))\
- % _preprocess_atom(args[0])
+ r = six.text_type(
+ QApplication.translate("@default", string)
+ ) % _preprocess_atom(args[0])
else:
- r = six.text_type(QApplication.translate("@default", string)) +\
- six.text_type(_preprocess_atom(args[0]))
+ r = six.text_type(
+ QApplication.translate("@default", string)
+ ) + six.text_type(_preprocess_atom(args[0]))
elif isinstance(args[0], list) or args[0] is None:
if string.count("%") == 1:
- r = six.text_type(QApplication.translate("@default", string))\
- % _preprocess_atom(repr(args[0]))
+ r = six.text_type(
+ QApplication.translate("@default", string)
+ ) % _preprocess_atom(repr(args[0]))
else:
r = (six.text_type(QApplication.translate("@default", string)), args[0])
else:
- raise EficasException("ValueError: i18n.translation.tr: \
+ raise EficasException(
+ "ValueError: i18n.translation.tr: \
Wrong type for formatted string \
- arguments: %s" % type(args[0]))
+ arguments: %s"
+ % type(args[0])
+ )
else:
- raise EficasException("ValueError: i18n.translation.tr: \
- Wrong formatted string arguments")
+ raise EficasException(
+ "ValueError: i18n.translation.tr: \
+ Wrong formatted string arguments"
+ )
return r
def tr_qt(string, *args):
"""tr_qt(string, iterable-or-float-or-int) -> unicode
- t_qtr(string) -> unicode
-
- Returns a formatted string from an unformatted
- Unicode string with formatting specifications, and,
- optionally, an iterable or an int or float.
- Lets PyQt4 do the string formatting. To this end,
- a conversion from Python to Qt string formatting
- syntax is performed."""
+ t_qtr(string) -> unicode
+
+ Returns a formatted string from an unformatted
+ Unicode string with formatting specifications, and,
+ optionally, an iterable or an int or float.
+ Lets PyQt4 do the string formatting. To this end,
+ a conversion from Python to Qt string formatting
+ syntax is performed."""
string = _preprocess_atom(string)
from PyQt5.QtWidgets import QApplication
+
if len(args) == 0:
r = QApplication.translate("@default", string)
elif len(args) == 1:
elif r.count("%") in range(2) and r.count("%(") == 0:
r = _reformat_qstring_from_atom(r, _preproces_atom(repr(args[0])))
else:
- raise EficasException("ValueError: i18n.translation.tr_qt: \
- Improper formatting string parameters")
+ raise EficasException(
+ "ValueError: i18n.translation.tr_qt: \
+ Improper formatting string parameters"
+ )
elif isinstance(args[0], (six.text_type, str, int, float, complex)):
r = _reformat_qstring_from_atom(r, args[0])
elif isinstance(args[0], list):
r = _reformat_qstring_from_list(r, args[0])
elif args[0] is None:
- r = _reformat_qstring_from_atom(r, _preprocess_string_from_atom(repr(args[0])))
+ r = _reformat_qstring_from_atom(
+ r, _preprocess_string_from_atom(repr(args[0]))
+ )
else:
- raise EficasException("ValueError: i18n.translation.tr_qt: \
- Wrong string formatting parameter types")
+ raise EficasException(
+ "ValueError: i18n.translation.tr_qt: \
+ Wrong string formatting parameter types"
+ )
else:
- raise EficasException("ValueError: i18n.translation.tr_qt: \
- Improper formatted string parameter set")
+ raise EficasException(
+ "ValueError: i18n.translation.tr_qt: \
+ Improper formatted string parameter set"
+ )
return six.text_type(r)
if __name__ == "__main__":
import sys
+
tr(sys.argv[1], *args)
tr_qt(sys.argv[1], *args)