Salome HOME
debug intempestif
[tools/eficas.git] / Efi2Xsd / mapDesTypes.py
1 class Tuple:
2     def __init__(self,ntuple):
3         self.ntuple=ntuple
4
5     def __convert__(self,valeur):
6         if type(valeur) == types.StringType:
7             return None
8         if len(valeur) != self.ntuple:
9             return None
10         return valeur
11
12     def info(self):
13         return "Tuple de %s elements" % self.ntuple
14
15     __repr__=info
16     __str__=info
17
18
19
20 def inverseDico(dicoSource) :
21 #---------------------------
22     dicoInverse = {}
23     for (clef,valeur) in dicoSource.items():
24         if not(type(valeur) is tuple):
25             dicoInverse[valeur]=clef
26             continue
27         (elt,att)=valeur
28         if elt not in dicoInverse : dicoInverse[elt]={}
29         dicoInverse[elt][att]=clef
30     return dicoInverse
31
32 dictSIMPEficasXML= { 'typ'        : 'nomTypeAttendu',
33                      'statut'     : 'statut',
34                      'min'        : 'minOccurences',
35                      'max'        : 'maxOccurences',
36                      'homo'       : 'homo'       ,
37                      'position'   : 'portee',
38                      'validators' : 'validators' ,
39                      'sug'        : 'valeurSugg',
40                      'defaut'     : 'valeurDef' ,
41                      'into'       : ('plageValeur','into'),
42                      'val_min'    : ('plageValeur','borneInf'),
43                      'val_max'    : ('plageValeur','borneSup'),
44                      'ang'        : ('doc','ang'),
45                      'fr'         : ('doc','fr',),
46                      'docu'       : ('doc','docu'),
47                    }
48
49 dictSIMPXMLEficas= inverseDico(dictSIMPEficasXML)
50
51
52
53 dictFACTEficasXML = { 'statut'     : 'statut',
54                       'min'        : 'minOccurences',
55                       'max'        : 'maxOccurences',
56                       'ang'        : ('doc','ang'),
57                       'fr'         : ('doc','fr',),
58                       'docu'       : ('doc','docu'),
59                       'regles'     : 'regles',
60                       'validators' : 'validators' ,
61                     }
62
63 dictFACTXMLEficas =  inverseDico(dictFACTEficasXML)
64
65 dictBLOCEficasXML = { 'statut'     : 'statut',
66                       'ang'        : ('doc','ang'),
67                       'fr'         : ('doc','fr',),
68                       'regles'     : 'regles',
69                       'condition'  : 'condition' ,
70                     }
71
72 dictBLOCXMLEficas =  inverseDico(dictBLOCEficasXML)
73
74 dictPROCEficasXML =  { 'nom'        : 'nom',
75                        'regles'     : 'regles',
76                        'ang'        : ('doc','ang'),
77                        'fr'         : ('doc','fr',),
78                        'docu'       : ('doc','docu'),
79                       }
80
81 dictPROCXMLEficas = inverseDico(dictPROCEficasXML)
82
83 dictOPEREficasXML = dictPROCEficasXML
84 dictOPERXMLEficas = dictPROCXMLEficas
85
86 dictPourCast                = { 'I' : int, 'R' : float, 'bool' : bool ,   }
87 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'   }
88
89 listeParamDeTypeTypeAttendu = ( 'defaut', 'sug', 'val_min', 'val_max', 'into', 'intoSug')
90 listeParamDeTypeStr         = ('fr', 'docu', 'ang', 'nom' )
91
92 listeParamTjsSequence        = ('into' , 'intoSug')
93 listeParamSelonType           = ('defaut', 'sug', 'into', 'intoSug')
94
95 if __name__ == "__main__":
96     import pprint
97     pp=pprint.PrettyPrinter(indent=4)
98     print ('dictSIMPEficasXML')
99     pp.pprint(dictSIMPEficasXML)
100     print ('\n\n')
101     print ('dictSIMPXMLEficas')
102     pp.pprint(dictSIMPXMLEficas)
103     print ('\n\n')
104     print ('dictFACTEficasXML')
105     pp.pprint(dictFACTEficasXML)
106     print ('\n\n')
107     print ('dictFACTXMLEficas')
108     pp.pprint(dictFACTXMLEficas)
109     print ('\n\n')
110     print ('dictPROCEficasXML')
111     pp.pprint(dictPROCEficasXML)
112     print ('\n\n')
113     print ('dictPROCXMLEficas')
114     pp.pprint(dictPROCXMLEficas)
115     print ('\n\n')
116     print ('dictNomsDesTypes')
117     pp.pprint(dictNomsDesTypes )