From 51557e4d998b64baba4bb730ddde6a6cfa1acc57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ingvar=20Dahlgren?= Date: Tue, 23 Apr 2024 11:19:23 +0200 Subject: [PATCH] tidy up --- chempy/util/parsing.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chempy/util/parsing.py b/chempy/util/parsing.py index 12ac5a57..9df71e91 100644 --- a/chempy/util/parsing.py +++ b/chempy/util/parsing.py @@ -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 """ @@ -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." @@ -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: @@ -535,7 +536,6 @@ def to_reaction(line, substance_keys, token, Cls, globals_=None, **kwargs): ) - def _formula_to_format( sub, sup,