2 # person_in_charge: mathieu.courtois at edf.fr
3 # ======================================================================
4 # COPYRIGHT (C) 1991 - 2017 EDF R&D WWW.CODE-ASTER.ORG
5 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
6 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
7 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
8 # (AT YOUR OPTION) ANY LATER VERSION.
10 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
11 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
12 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
13 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
15 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
16 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
17 # 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
20 # ======================================================================
23 from __future__ import absolute_import
25 from builtins import object
28 class PRESENT_PRESENT(object):
31 La regle verifie que si le premier mot-cle de self.mcs est present
32 parmi les elements de args les autres doivent l'etre aussi
34 Ces arguments sont transmis a la regle pour validation sous la forme
35 d'une liste de noms de mots-cles ou d'un dictionnaire dont
36 les cles sont des noms de mots-cles.
39 def verif(self, args):
41 La methode verif effectue la verification specifique a la regle.
42 args peut etre un dictionnaire ou une liste. Les elements de args
43 sont soit les elements de la liste soit les cles du dictionnaire.
45 # on verifie que si le premier de la liste est present,
46 # les autres le sont aussi
50 args = self.listeToDico(args)
52 for mc in self.mcs[1:len(self.mcs)]:
54 text = text + "- Le mot cle " + repr(mc0)+ \
55 " etant present, il faut que : " + \
56 mc + " soit present" + '\n'