-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prettify #1744
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1744 +/- ##
======================================
Coverage 32.6% 32.6%
======================================
Files 87 87
Lines 26115 26115
Branches 6875 6875
======================================
Hits 8516 8516
+ Misses 16641 16629 -12
- Partials 958 970 +12
Continue to review full report at Codecov.
|
Prettify was broken because of changes to method names in For now, I think we should revert the method renaming in this class to restore the original behavior. However, I do agree that we should reconsider our output formats in the near future. |
OK, I reverted the PEP8 prettify changes, and added a test. |
I added two more fixes and a unit test. Turns out that Python 3 handles negative numbers differently than Python 2... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! I added one comment/question
@mliu49, thanks for your excellent additions to this PR! |
In Python 2, negative numbers were treated as a single node In Python 3, negative numbers are treated as a UnaryOp + a Num
Sorry, I merged another PR so I went ahead and rebased this again. I will merge after tests pass, unless you think we need a third reviewer. |
@mliu49, I think this is ready to be merged. Thanks again |
Motivation or Problem
As noted in #1726 by @yunsiechung (Thanks!), Arkane's prettify functionality got broken in the Py3 transition.
Description of Changes
Instead of adapting Abstract Syntax Trees to the Py3 changes (which I don't know how to do right now), this PR suggests to use a simple combination of
pprint.pformat
andRMGObject.as_dict()
. This might be advantageous since theoretically the object can be rebuilt usingfrom_dict()
.Testing
A test was added, showing how this feature performs for a complex object such as
Conformer
.Point for discussion
Arkane's thermo and kinetics blocks we output are not objects, and have no real pythonic form. Here I added a tentative fix for them, we might want to reconsider how to output them better.
I'd like to try removing (not fixing) thermo and kinetic output for output.py, and instead (and finally) save respective RMG library files. We will still output the data in the table form for both in output.py.
Here's an example output: