Syntax Objects¶
This module defines the base objects that allow to use the legacy syntax of code_aster commands.
Note
If a keyword (simple or factor) is not provided by the user, its value is None.
If a factor keyword is present by default (
statut='d') but not filled by the user, its value is{}ifmax=1or[]ifmax > 1.Only one level of factor keywords is supported.
The keyword reuse is (will be) deprecated. So it must be present in catalogs
to import command files that contain it. But it is always optional (see
checkMandatory) because it is removed during import.
- class code_aster.Cata.Language.SyntaxObjects.SyntaxId[source]¶
Bases:
objectContainer of the id of syntax objects.
This list of type identifiers can be extended but never change between two releases of code_aster.
- class code_aster.Cata.Language.SyntaxObjects.ConversionLevel[source]¶
Bases:
objectEnumerator for the level of conversion requirements.
- NoFail¶
Do not fail, not strict.
- Naming¶
Requires that all command results are explicitly named.
- Type¶
Requires a valid type definition.
- Keyword¶
Requires that all keywords are valid.
- Syntaxic¶
Requires a valid syntax of all the commands.
- Restore¶
Requires a conversion without error during restore.
- Any¶
All conversion must pass.
- Partial¶
Allows to make a partial conversion (to be used with another level).
- NoGraphical¶
Force to load all stages in text mode.
- class code_aster.Cata.Language.SyntaxObjects.CataDefinition[source]¶
Bases:
OrderedDictDictionary to store the definition of syntax objects. Iteration over the elements is ordered by type: SimpleKeyword, FactorKeyword and Bloc.
- property entities¶
Return the all entities.
- Returns:
dict of all entities (keywords and conditional blocks) of the object.
- Return type:
dict
- property keywords¶
Return the simple and factor keywords contained in the object.
The keywords are sorted in the order of definition in the catalog. This is a workaround waiting for Python 3.6 and integration of PEP-0468.
- Returns:
dict of all simple and factor keywords of the object.
- Return type:
dict
- property factor_keywords¶
Return the factor keywords contained in the object.
- Returns:
dict of all factor keywords of the object.
- Return type:
dict
- property simple_keywords¶
Return the simple keywords contained in the object.
- Returns:
dict of all simple keywords of the object.
- Return type:
dict
- class code_aster.Cata.Language.SyntaxObjects.UIDMixing[source]¶
Bases:
objectSub class for UID based classes.
- Parameters:
uid (int) – Object’s id.
- property uid¶
Attribute that holds unique id
- class code_aster.Cata.Language.SyntaxObjects.PartOfSyntax(curDict)[source]¶
Bases:
UIDMixingGeneric object that describe a piece of syntax.
- getCataTypeId()[source]¶
Get the Cata type of object. Should be sub-classed.
- Returns:
type id of Cata object: -1 if not defined.
- Return type:
int
- property name¶
Name of the object.
- Type:
str
- property udocstring¶
Documentation of the object.
- Type:
unicode
- property docstring¶
Documentation of the object.
- Type:
str
- property definition¶
Attribute containing the syntax definition
- Type:
dict
- property rules¶
Attribute containing the list of rules
- Type:
dict
- property regles¶
Attribute containing the list of rules
- Type:
dict
- property entities¶
Return the all entities contained in the object.
- Returns:
dict of all entities (keywords and conditional blocks) of the object.
- Return type:
dict
- property entites¶
Return the all entities contained in the object.
- Returns:
dict of all entities (keywords and conditional blocks) of the object.
- Return type:
dict
- property keywords¶
Return the simple and factor keywords contained in the object.
- Returns:
dict of all simple and factor keywords of the object.
- Return type:
dict
- addDefaultKeywords(userSyntax, _parent_ctxt=None)[source]¶
Add default keywords into the user dict of keywords.
Optional keywords that are not defined are set to None/undefined value.
The values given in argument (userSyntax) preempt on the definition ones.
- Parameters:
userSyntax (dict) – dict of the keywords as filled by the user, changed in place.
_parent_ctxt (dict) – contains the keywords as known in the parent. This context is used to evaluate block conditions.
- checkMandatory(userSyntax, stack, _parent_ctxt=None)[source]¶
Check that the mandatory keywords are provided by the user.
Warning: Default keywords must be added before visiting the objects. Warning: this does not check recursively, only the current level.
- Parameters:
userSyntax (dict) – dict of the user and default keywords.
stack (list) – used to give contextual informations in error messages.
_parent_ctxt (dict) – contains the keywords as known in the parent. This context is used to evaluate block conditions.
- getKeyword(userKeyword, userSyntax, _parent_ctxt=None)[source]¶
Return the keyword in the current composite object.
Warning: Default keywords must be added before visiting the objects.
- Parameters:
userKeyword (str) – name of the searched keyword.
userSyntax (dict) – dict of the user and default keywords.
_parent_ctxt (dict) – contains the keywords as known in the parent. This context is used to evaluate block conditions.
- getRules(userSyntax, _parent_ctxt=None)[source]¶
Return the rules to be applied to the given keywords.
Warning: Default keywords must be added before visiting the objects.
- Parameters:
userSyntax (dict) – dict of the user and default keywords.
_parent_ctxt (dict) – contains the keywords as known in the parent. This context is used to evaluate block conditions.
- class code_aster.Cata.Language.SyntaxObjects.SimpleKeyword(curDict)[source]¶
Bases:
PartOfSyntaxObjet mot-clé simple équivalent à SIMP dans les capy
- class code_aster.Cata.Language.SyntaxObjects.FactorKeyword(curDict)[source]¶
Bases:
PartOfSyntaxObjet mot-clé facteur equivalent de FACT dans les capy
- class code_aster.Cata.Language.SyntaxObjects.Bloc(curDict)[source]¶
Bases:
PartOfSyntaxObjet Bloc équivalent à BLOC dans les capy
- class code_aster.Cata.Language.SyntaxObjects.Command(curDict)[source]¶
Bases:
PartOfSyntaxObject Command qui représente toute la syntaxe d’une commande
- classmethod register_call_callback(callback)[source]¶
Register callback to be called in place of the default method.
Register None to revert to default.
- Parameters:
callback (callable) – Function to call with signature: (Command instance,
**kwargs).