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_ABSENT(object):
31 La regle verifie que si le premier mot-cle de self.mcs est present
32 parmi les elements de args les autres mots cles de self.mcs
35 Ces arguments sont transmis a la regle pour validation sous la forme
36 d'une liste de noms de mots-cles ou d'un dictionnaire dont
37 les cles sont des noms de mots-cles.
40 def verif(self, args):
42 La methode verif effectue la verification specifique a la regle.
43 args peut etre un dictionnaire ou une liste. Les elements de args
44 sont soit les elements de la liste soit les cles du dictionnaire.
46 # on verifie que si le premier de la liste est present,
47 # les autres sont absents
50 args = self.listeToDico(args)
53 for mc in self.mcs[1:len(self.mcs)]:
55 text = text + "- Le mot cle " + repr(mc0)+ " etant present, il faut que : " +\
56 mc + " soit absent" + '\n'