Rules between keywords

code_aster.Cata.Language.Rules.work_on_copy(func)[source]

Decorator to automatically copy the keywords dict argument and remove None (that means undefined) values before calling a function.

class code_aster.Cata.Language.Rules.Rule(*args)[source]

Bases: object

Abstract class for rules.

Parameters:

*args – list of keywords.

__init__(*args)[source]

Initialization

__repr__()[source]

Simple representation

check(dictSyntax)[source]

Check the rule

_firstExists(dictSyntax)[source]

Filter that tells if the first keyword exists

_nbValues(dictSyntax)[source]

Returns the number of defined (not None) values

class code_aster.Cata.Language.Rules.RuleWithDefaults(*args, **kwargs)[source]

Bases: Rule

Abstract class for rules with default values.

Parameters:
  • *args – list of keywords.

  • **kwargs – default values.

__init__(*args, **kwargs)[source]

Initialization

class code_aster.Cata.Language.Rules.AtLeastOne(*args, **kwargs)[source]

Bases: RuleWithDefaults

Check that at least one keyword from a list is defined.

If no keyword from the list exist, default values may be inserted if provided in kwargs.

check(dictSyntax)[source]

Check the rule

class code_aster.Cata.Language.Rules.ExactlyOne(*args, **kwargs)[source]

Bases: RuleWithDefaults

Check that exactly one keyword from a list is defined.

If no keyword from the list exist, a default value may be inserted if provided in kwargs.

check(dictSyntax)[source]

Check the rule

class code_aster.Cata.Language.Rules.AtMostOne(*args)[source]

Bases: Rule

Check that at most one keyword from a list is defined.

check(dictSyntax)[source]

Check the rule

class code_aster.Cata.Language.Rules.IfFirstAllPresent(*args)[source]

Bases: Rule

Check that if a keyword is defined all others from the list are defined.

check(dictSyntax)[source]

Check the rule

class code_aster.Cata.Language.Rules.OnlyFirstPresent(*args)[source]

Bases: Rule

Check that if a keyword is defined no of the others from the list is defined.

check(dictSyntax)[source]

Check the rule

class code_aster.Cata.Language.Rules.AllTogether(*args)[source]

Bases: Rule

Check that if all the keywords from the list are defined or all undefined.

check(dictSyntax)[source]

Check the rule

class code_aster.Cata.Language.Rules.NotEmpty(*args)[source]

Bases: Rule

Check that at least one keyword is provided.

check(dictSyntax)[source]

Check the rule