-
Notifications
You must be signed in to change notification settings - Fork 80
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
Update README for improved chemical formula parser #207
Comments
I'm assuming there is no doctest for README.rst? So I'm manually testing docstrings by running them in a temporary doc_testing.py file, having forked from bjodah/chempy after @jeremyagray merged the parsing improvements. When I try to run an example in chempy/util/tests/test_parsing.py
I get a KeyError:
|
That test got left out of the unicode and HTML sections but not the composition and latex sections. The good news is that it works for HTML and it should be similarly fixable for unicode. The bad news is that it appears impossible to represent in unicode as they have apparently neglected to include subscript and superscript punctuation like I suppose a solution could be to fail early with a "unicode is broken" exception or use a regular decimal point until a better course of action presents itself. Suggestions welcome; I'll push something to patch it. EDIT: I have a working "use a regular decimal point" fix; any better solution can be quickly dropped in its place. |
@bertiewooster sure, just add .vscode to the .gitignore file, no worries there! I'm fine with hijacking unicode characters which looks "approximately like a subscript point". |
Thanks for the guidance, @bjodah. Will do; I'll add .vs to the .gitignore file too, just in case any contributor is using Visual Studio Professional. Hopefully @jeremyagray also has the guidance needed to help push this across the finish line for a release! |
Hi, just following up to check if @jeremyagray can address the last remaining coding issue (that I'm aware of) before a release by him or @bjodah, hijacking unicode characters which looks "approximately like a subscript point". I can then incorporate that code change into my forked branch and finish updating the README. Thanks! |
Checking in on this - my code is currently broken because apparently v0.8.3 still cannot accept non-integer stoichiometry? You state: "The good news is that it works for HTML and it should be similarly fixable for unicode" How can I force HTML or Latex so that I don't get the key error with unicode? |
Translate a Unicode decimal point in a subscript as a text decimal point. Use `.` as the decimal point operator and `..` as the hydrate operator. Add zinc nitrate example from bjodah#207. Signed-off-by: Jeremy A Gray <jeremy.a.gray@gmail.com>
Thanks @jeremyagray. I ended reverting to a much older version of chempy to solve my immediate problems. Looking at the notes in #223, I kind of like the "" identifier for crystal water, but ".." is also fine IMO. It's easy enough to replace the ".." or "" symbols for plotting and reporting. |
Translate a Unicode decimal point in a subscript as a text decimal point. Use `.` as the decimal point operator and `..` as the hydrate operator. Add zinc nitrate example from #207. Signed-off-by: Jeremy A Gray <jeremy.a.gray@gmail.com>
I am working on updating README.rst for the improved formula parsing #205. A few questions regarding the updated parsing which no longer accepts malformed chemical formulas such as "Ch4"--ChemPy will now raise a
ParseError
, rather than simply stopping at the last valid element (that formula was previously parsed toC
aka carbon):Also, is it all right if I append to
.gitignore
so that Visual Studio Code configuration files will be ignored?
The text was updated successfully, but these errors were encountered: