Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
bjodah committed Apr 23, 2024
1 parent da3f3ef commit 51557e4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions chempy/util/parsing.py
Expand Up @@ -378,7 +378,7 @@ def formula_to_composition(
True
>>> formula_to_composition('.NHO-(aq)') == {0: -1, 1: 1, 7: 1, 8: 1}
True
>>> formula_to_composition('Na2CO3*7H2O') == {11: 2, 6: 1, 8: 10, 1: 14}
>>> formula_to_composition('Na2CO3..7H2O') == {11: 2, 6: 1, 8: 10, 1: 14}
True
"""
Expand All @@ -389,6 +389,8 @@ def formula_to_composition(
tot_comp = {}
if "\u00b7" in stoich_tok:
parts = stoich_tok.split('\u00b7')
elif '..' in stoich_tok:
parts = stoich_tok.split("..")
elif '.' in stoich_tok:
warnings.warn(
("dot is ambiguous in chempy-0.8.x, prefer '*' or '\u00b7' for complexes."
Expand All @@ -397,8 +399,7 @@ def formula_to_composition(
)
parts = stoich_tok.split('.')
else:
parts = stoich_tok.split("..")

parts = [stoich_tok]

for idx, stoich in enumerate(parts):
if idx == 0:
Expand Down Expand Up @@ -535,7 +536,6 @@ def to_reaction(line, substance_keys, token, Cls, globals_=None, **kwargs):
)



def _formula_to_format(
sub,
sup,
Expand Down

0 comments on commit 51557e4

Please sign in to comment.