Dealing with python reserved keywords as attributes in the metamodel
See original GitHub issueHi all,
In our metamodel there is an EAttribute named from
. To deal with this reserved keyword in Python, PyEcore converts this to from_
. Unfortunately it will also serialize to from_
in the instance. How can we serialize this to from
again?
The model is available here https://github.com/EnergyTransition/ESDL/raw/master/esdl/model/esdl.ecore. Feature ProfileElement
has the from
attribute and is causing the issue.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Why can't class attributes be named as reserved words in ...
a.global does not use any reserved word: this is an attribute which happens to be called the same as a reserved word. The...
Read more >Python reserved word as an attribute · Issue #381 - GitHub
Hello people, I have class that must have a from attribute. Using attrs, I would first try the code below: @attr.s() class Message:...
Read more >Model Meta options - Django documentation
If your database table name is an SQL reserved word, or contains characters that aren't allowed in Python variable names – notably, the...
Read more >Reserved Keywords - Real Python
Reserved words are case-sensitive and must be used exactly as shown. They are all entirely lowercase, except for False , None , and...
Read more >Django ModelForm - Create form from Models - GeeksforGeeks
Field types. The generated Form class will have a form field for every model field specified, in the order specified in the fields...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@aranega Thanks for the example. I forgot to query the ProfileElement for the StructuralFeature (I tried to assign it directly). It doesn’t matter that it’s a little cumbersome, I see it as a part of the setup for Python. Thanks for making EMF work on python!
@ewoudwerkman Cool 😃 ! I close it!