question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dealing with python reserved keywords as attributes in the metamodel

See original GitHub issue

Hi 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:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ewoudwerkmancommented, Nov 16, 2018

@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!

0reactions
aranegacommented, Mar 11, 2019

@ewoudwerkman Cool 😃 ! I close it!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found