chemql-python 1.2.3__tar.gz → 1.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {chemql_python-1.2.3/src/chemql_python.egg-info → chemql_python-1.2.4}/PKG-INFO +1 -1
- {chemql_python-1.2.3 → chemql_python-1.2.4}/pyproject.toml +1 -1
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql/__init__.py +38 -11
- {chemql_python-1.2.3 → chemql_python-1.2.4/src/chemql_python.egg-info}/PKG-INFO +1 -1
- {chemql_python-1.2.3 → chemql_python-1.2.4}/LICENSE +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/README.md +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/setup.cfg +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql/__main__.py +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql/data/BondEnergies.json +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql/data/MoleculeBonds.json +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql/data/Molecules.json +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql/data/PeriodicTableJSON.json +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql/data/Reactions.json +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql/data/THIRD_PARTY_LICENSES/PeriodicTableJSON.txt +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql/data/THIRD_PARTY_LICENSES/RHEA.txt +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql/html/periodic_table.html +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql_python.egg-info/SOURCES.txt +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql_python.egg-info/dependency_links.txt +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql_python.egg-info/entry_points.txt +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql_python.egg-info/requires.txt +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/src/chemql_python.egg-info/top_level.txt +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/tests/test_external_molecule_lookup.py +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/tests/test_public_api.py +0 -0
- {chemql_python-1.2.3 → chemql_python-1.2.4}/tests/test_reactions.py +0 -0
|
@@ -47,7 +47,7 @@ __all__ = [
|
|
|
47
47
|
"__version__"
|
|
48
48
|
]
|
|
49
49
|
|
|
50
|
-
__version__ = "1.2.
|
|
50
|
+
__version__ = "1.2.4"
|
|
51
51
|
|
|
52
52
|
# Persistent preprocessor/function state for the current ChemQL session.
|
|
53
53
|
DEFINITIONS = {}
|
|
@@ -108,6 +108,18 @@ def _split_function_arguments(source):
|
|
|
108
108
|
if tail or source.strip():
|
|
109
109
|
args.append(tail)
|
|
110
110
|
return args
|
|
111
|
+
def is_block_header(line):
|
|
112
|
+
"""Return True only for actual ChemQL block headers."""
|
|
113
|
+
if not (line.startswith("[") and line.endswith("]")):
|
|
114
|
+
return False
|
|
115
|
+
|
|
116
|
+
code = line[1:-1].strip()
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
code.startswith("if ")
|
|
120
|
+
or code.startswith("for ")
|
|
121
|
+
or code.startswith("while ")
|
|
122
|
+
)
|
|
111
123
|
|
|
112
124
|
def _call_function(name, arguments):
|
|
113
125
|
"""Call a ChemQL function, including let assignments and block syntax."""
|
|
@@ -194,13 +206,13 @@ def _call_function(name, arguments):
|
|
|
194
206
|
|
|
195
207
|
# Recognize block headers generically, while excluding
|
|
196
208
|
# closing and branch markers from being treated as headers.
|
|
197
|
-
generic_header = re.match(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
)
|
|
209
|
+
# generic_header = re.match(
|
|
210
|
+
# r"^\[\s*(?!endblock\b|else\b|elif\b)"
|
|
211
|
+
# r"[A-Za-z_]\w*\b.*\]\s*$",
|
|
212
|
+
# line,
|
|
213
|
+
# )
|
|
202
214
|
|
|
203
|
-
if
|
|
215
|
+
if is_block_header(line):
|
|
204
216
|
end = find_endblock(lines, i + 1)
|
|
205
217
|
|
|
206
218
|
block_body = [
|
|
@@ -2509,15 +2521,30 @@ def find_endblock(lines, start):
|
|
|
2509
2521
|
for i in range(start, len(lines)):
|
|
2510
2522
|
stripped = lines[i].strip()
|
|
2511
2523
|
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
elif stripped == "[endblock]":
|
|
2524
|
+
# Closing block.
|
|
2525
|
+
if stripped == "[endblock]":
|
|
2516
2526
|
depth -= 1
|
|
2517
2527
|
|
|
2518
2528
|
if depth == 0:
|
|
2519
2529
|
return i
|
|
2520
2530
|
|
|
2531
|
+
continue
|
|
2532
|
+
|
|
2533
|
+
# Branch markers do not start new blocks.
|
|
2534
|
+
if stripped in ("[else]", "[endif]", "[endfor]", "[endwhile]"):
|
|
2535
|
+
continue
|
|
2536
|
+
|
|
2537
|
+
# Recognize both validated Python headers and generic
|
|
2538
|
+
# ChemQL block headers, consistently with _call_function().
|
|
2539
|
+
generic_header = re.match(
|
|
2540
|
+
r"^\[\s*(?!endblock\b|else\b|elif\b)"
|
|
2541
|
+
r"[A-Za-z_]\w*\b.*\]\s*$",
|
|
2542
|
+
stripped,
|
|
2543
|
+
)
|
|
2544
|
+
|
|
2545
|
+
if is_block_header(stripped):
|
|
2546
|
+
depth += 1
|
|
2547
|
+
|
|
2521
2548
|
raise SyntaxError("Missing `[endblock]`")
|
|
2522
2549
|
|
|
2523
2550
|
def remove_comments(line):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|