chemql-python 1.5.6__tar.gz → 1.5.8__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.5.6 → chemql_python-1.5.8}/PKG-INFO +2 -2
- {chemql_python-1.5.6 → chemql_python-1.5.8}/README.md +1 -1
- {chemql_python-1.5.6 → chemql_python-1.5.8}/pyproject.toml +1 -1
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/__init__.py +1 -1
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/codecql.py +49 -21
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql_python.egg-info/PKG-INFO +2 -2
- {chemql_python-1.5.6 → chemql_python-1.5.8}/LICENSE +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/setup.cfg +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/__main__.py +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/colors.json +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/data/BondEnergies.json +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/data/MoleculeBonds.json +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/data/Molecules.json +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/data/PeriodicTableJSON.json +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/data/Reactions.json +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/data/THIRD_PARTY_LICENSES/PeriodicTableJSON.txt +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/data/THIRD_PARTY_LICENSES/RHEA.txt +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/html/periodic_table.html +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/stdlib/README.md +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/stdlib/collections.cql +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/stdlib/datetime.cql +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/stdlib/decimal.cql +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/stdlib/fractions.cql +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/stdlib/json.cql +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/stdlib/math/statistics.cql +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/stdlib/math.cql +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/stdlib/pathlib.cql +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/stdlib/random.cql +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql/stdlib/text.cql +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql_python.egg-info/SOURCES.txt +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql_python.egg-info/dependency_links.txt +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql_python.egg-info/entry_points.txt +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql_python.egg-info/requires.txt +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/src/chemql_python.egg-info/top_level.txt +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/tests/test_codecql.py +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/tests/test_external_molecule_lookup.py +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/tests/test_public_api.py +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/tests/test_reactions.py +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/tests/test_stdlib.py +0 -0
- {chemql_python-1.5.6 → chemql_python-1.5.8}/tests/test_structured_types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chemql-python
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.8
|
|
4
4
|
Summary: A chemistry-focused query language and REPL
|
|
5
5
|
Author-email: Mohammad Rakibul Islam <rakibulofficial1017@gmail.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -19,7 +19,7 @@ SQL-inspired syntax, inspect elements and molecules, look up reactions,
|
|
|
19
19
|
balance equations, and combine chemistry queries with Python and shell
|
|
20
20
|
commands.
|
|
21
21
|
|
|
22
|
-
- **Version:** `1.5.
|
|
22
|
+
- **Version:** `1.5.8`
|
|
23
23
|
- **PyPI distribution:** `chemql-python`
|
|
24
24
|
- **Python import / CLI name:** `chemql`
|
|
25
25
|
- **Author:** Mohammad Rakibul Islam
|
|
@@ -6,7 +6,7 @@ SQL-inspired syntax, inspect elements and molecules, look up reactions,
|
|
|
6
6
|
balance equations, and combine chemistry queries with Python and shell
|
|
7
7
|
commands.
|
|
8
8
|
|
|
9
|
-
- **Version:** `1.5.
|
|
9
|
+
- **Version:** `1.5.8`
|
|
10
10
|
- **PyPI distribution:** `chemql-python`
|
|
11
11
|
- **Python import / CLI name:** `chemql`
|
|
12
12
|
- **Author:** Mohammad Rakibul Islam
|
|
@@ -10,7 +10,7 @@ import shutil
|
|
|
10
10
|
import subprocess
|
|
11
11
|
import time
|
|
12
12
|
|
|
13
|
-
VERSION = "0.0.
|
|
13
|
+
VERSION = "0.0.8"
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def _write_system_clipboard(text):
|
|
@@ -79,7 +79,8 @@ def _decode_escape_sequence(sequence):
|
|
|
79
79
|
else:
|
|
80
80
|
return "\x1b"
|
|
81
81
|
return "+".join((*modifiers, key)) if modifiers else key
|
|
82
|
-
if final == b"u" and params and params[0]
|
|
82
|
+
if final == b"u" and params and params[0] in {"8", "127"}:
|
|
83
|
+
# CSI-u / Kitty keyboard protocol can encode Backspace as 8 or 127.
|
|
83
84
|
key = "backspace"
|
|
84
85
|
return "+".join((*modifiers, key)) if modifiers else key
|
|
85
86
|
elif sequence.startswith(b"O") and sequence[-1:] in b"ABCDHF":
|
|
@@ -129,7 +130,7 @@ if os.name == 'nt':
|
|
|
129
130
|
0x48: "arrow_up", 0x50: "arrow_down",
|
|
130
131
|
0x4B: "arrow_left", 0x4D: "arrow_right",
|
|
131
132
|
0x47: "arrow_home", 0x4F: "arrow_end",
|
|
132
|
-
0x53: "delete", 0x73: "ctrl+arrow_left",
|
|
133
|
+
0x53: "delete", 0x93: "ctrl+delete", 0x73: "ctrl+arrow_left",
|
|
133
134
|
0x74: "ctrl+arrow_right", 0x8D: "ctrl+arrow_up",
|
|
134
135
|
0x91: "ctrl+arrow_down", 0x9B: "alt+arrow_left",
|
|
135
136
|
0x9D: "alt+arrow_right",
|
|
@@ -181,8 +182,16 @@ else:
|
|
|
181
182
|
return _decode_escape_sequence(sequence)
|
|
182
183
|
if sequence.startswith(b"O"):
|
|
183
184
|
return _decode_escape_sequence(sequence)
|
|
185
|
+
if sequence in (b"\x7f", b"\x08"):
|
|
186
|
+
return "alt+backspace"
|
|
184
187
|
if sequence:
|
|
185
|
-
|
|
188
|
+
# ESC + one printable character is commonly Alt+<key>.
|
|
189
|
+
# Never insert an unknown multi-character escape sequence.
|
|
190
|
+
if len(sequence) == 1:
|
|
191
|
+
char = sequence.decode("utf-8", errors="replace")
|
|
192
|
+
if char.isprintable():
|
|
193
|
+
return "alt+" + char
|
|
194
|
+
return "\x1b"
|
|
186
195
|
return "\x1b"
|
|
187
196
|
if not first:
|
|
188
197
|
return ""
|
|
@@ -455,7 +464,7 @@ class Editor:
|
|
|
455
464
|
if self.search_active
|
|
456
465
|
else self.message or (
|
|
457
466
|
"Ctrl+S Save Ctrl+Z Undo Ctrl+Y Redo Ctrl+Q Quit "
|
|
458
|
-
"Ctrl+F Search Ctrl+T Terminal Ctrl+Backspace/Delete Word"
|
|
467
|
+
"Ctrl+F Search Ctrl+T Terminal Ctrl+R Run ChemQL Ctrl+Backspace/Delete Word"
|
|
459
468
|
)
|
|
460
469
|
)
|
|
461
470
|
output.extend((DIM, footer[:cols].ljust(cols), RESET))
|
|
@@ -529,7 +538,9 @@ class Editor:
|
|
|
529
538
|
return self._handle_search_key(key)
|
|
530
539
|
if key in ("\x14", "ctrl+t"):
|
|
531
540
|
self._run_split_terminal()
|
|
532
|
-
|
|
541
|
+
return False
|
|
542
|
+
if key in ("\x12", "ctrl+r"):
|
|
543
|
+
self._run_split_terminal(run_chemql=True)
|
|
533
544
|
return False
|
|
534
545
|
if key in ("\x06", "ctrl+f"):
|
|
535
546
|
self._open_search()
|
|
@@ -596,7 +607,7 @@ class Editor:
|
|
|
596
607
|
self._scroll_view(-1 if base_key == "arrow_up" else 1)
|
|
597
608
|
else:
|
|
598
609
|
self._move_cursor(base_key, shift=shift, wordwise=wordwise)
|
|
599
|
-
elif key in ("\x08", "ctrl+backspace"):
|
|
610
|
+
elif key in ("\x08", "ctrl+backspace", "alt+backspace"):
|
|
600
611
|
if os.name == "nt":
|
|
601
612
|
if not self._delete_selection(): # For some reason on windows it is the opposit
|
|
602
613
|
self._backspace() # I have no idea why just stick to it
|
|
@@ -608,7 +619,7 @@ class Editor:
|
|
|
608
619
|
else:
|
|
609
620
|
if not self._delete_selection():
|
|
610
621
|
self._backspace()
|
|
611
|
-
elif key in ("ctrl+delete",):
|
|
622
|
+
elif key in ("ctrl+delete", "alt+delete"):
|
|
612
623
|
self._delete_word("right")
|
|
613
624
|
elif key in ("delete", "\x1b[3~"):
|
|
614
625
|
if not self._delete_selection():
|
|
@@ -617,7 +628,8 @@ class Editor:
|
|
|
617
628
|
self._insert_newline()
|
|
618
629
|
elif key == "\t":
|
|
619
630
|
self._insert_text("\t")
|
|
620
|
-
elif key and key.isprintable():
|
|
631
|
+
elif key and key.isprintable() and "+" not in key:
|
|
632
|
+
# Symbolic key names (e.g. "alt+delete") are control events, not text.
|
|
621
633
|
self._insert_text(key)
|
|
622
634
|
if key not in ("\x11",):
|
|
623
635
|
self.quit_requested = False
|
|
@@ -627,44 +639,58 @@ class Editor:
|
|
|
627
639
|
self.cursor_x = min(self.cursor_x, len(self.lines[self.cursor_y]))
|
|
628
640
|
return False
|
|
629
641
|
|
|
630
|
-
def _run_split_terminal(self):
|
|
631
|
-
"""Open a shell
|
|
642
|
+
def _run_split_terminal(self, run_chemql=False):
|
|
643
|
+
"""Open a shell; Ctrl+R also runs ChemQL on this file's absolute path."""
|
|
644
|
+
command = None
|
|
645
|
+
if run_chemql:
|
|
646
|
+
# Run the current buffer rather than stale on-disk contents.
|
|
647
|
+
if self.dirty:
|
|
648
|
+
self.save_file()
|
|
649
|
+
if self.dirty:
|
|
650
|
+
return
|
|
651
|
+
absolute_path = os.path.abspath(self.filename)
|
|
652
|
+
if os.name == "nt":
|
|
653
|
+
command = "chemql -f " + subprocess.list2cmdline([absolute_path])
|
|
654
|
+
else:
|
|
655
|
+
import shlex
|
|
656
|
+
command = "chemql -f " + shlex.quote(absolute_path)
|
|
632
657
|
|
|
633
|
-
POSIX uses a PTY in the lower part of the current terminal. Ctrl+T or
|
|
634
|
-
Esc returns to the editor; Ctrl+Up/Down resizes the shell pane. Window
|
|
635
|
-
resize events are forwarded to the shell PTY. Windows Terminal owns
|
|
636
|
-
its split panes, so on Windows its pane is independently resizable and
|
|
637
|
-
closing the shell returns focus to the editor pane.
|
|
638
|
-
"""
|
|
639
658
|
if os.name == "nt":
|
|
640
659
|
shell = os.environ.get("COMSPEC", "cmd.exe")
|
|
641
660
|
wt = shutil.which("wt.exe") or shutil.which("wt")
|
|
642
661
|
|
|
643
662
|
if wt and os.environ.get("WT_SESSION"):
|
|
644
663
|
try:
|
|
645
|
-
|
|
664
|
+
args = [
|
|
646
665
|
wt, "-w", "0", "split-pane", "-V",
|
|
647
666
|
"--size", "0.35", "--title", "ChemQL Terminal",
|
|
648
667
|
shell, "/K",
|
|
649
|
-
]
|
|
668
|
+
]
|
|
669
|
+
if command:
|
|
670
|
+
args.append(command)
|
|
671
|
+
subprocess.Popen(args)
|
|
650
672
|
except OSError as error:
|
|
651
673
|
self.message = f"Could not open Windows Terminal pane: {error}"
|
|
652
674
|
else:
|
|
653
675
|
self.message = (
|
|
676
|
+
"ChemQL running in Windows Terminal pane" if command else
|
|
654
677
|
"Terminal opened in a Windows Terminal pane; resize it with "
|
|
655
678
|
"Alt+Shift+Plus/Minus or drag the divider. Exit the shell to close it."
|
|
656
679
|
)
|
|
657
680
|
return
|
|
658
681
|
|
|
659
682
|
try:
|
|
683
|
+
args = [shell]
|
|
684
|
+
if command:
|
|
685
|
+
args.extend(["/K", command])
|
|
660
686
|
subprocess.Popen(
|
|
661
|
-
|
|
687
|
+
args,
|
|
662
688
|
creationflags=getattr(subprocess, "CREATE_NEW_CONSOLE", 0),
|
|
663
689
|
)
|
|
664
690
|
except OSError as error:
|
|
665
691
|
self.message = f"Could not open terminal: {error}"
|
|
666
692
|
else:
|
|
667
|
-
self.message = "Terminal opened in a separate console window"
|
|
693
|
+
self.message = "ChemQL running in a separate console" if command else "Terminal opened in a separate console window"
|
|
668
694
|
return
|
|
669
695
|
|
|
670
696
|
stdin_fd = sys.stdin.fileno()
|
|
@@ -728,6 +754,8 @@ class Editor:
|
|
|
728
754
|
struct.pack("HHHH", pane_height, cols, 0, 0),
|
|
729
755
|
)
|
|
730
756
|
tty.setraw(stdin_fd)
|
|
757
|
+
if command:
|
|
758
|
+
os.write(master_fd, command.encode("utf-8") + b"\n")
|
|
731
759
|
sys.stdout.write(f"\x1b[{pane_top};{rows}r\x1b[?6h\x1b[1;1H")
|
|
732
760
|
sys.stdout.flush()
|
|
733
761
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chemql-python
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.8
|
|
4
4
|
Summary: A chemistry-focused query language and REPL
|
|
5
5
|
Author-email: Mohammad Rakibul Islam <rakibulofficial1017@gmail.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -19,7 +19,7 @@ SQL-inspired syntax, inspect elements and molecules, look up reactions,
|
|
|
19
19
|
balance equations, and combine chemistry queries with Python and shell
|
|
20
20
|
commands.
|
|
21
21
|
|
|
22
|
-
- **Version:** `1.5.
|
|
22
|
+
- **Version:** `1.5.8`
|
|
23
23
|
- **PyPI distribution:** `chemql-python`
|
|
24
24
|
- **Python import / CLI name:** `chemql`
|
|
25
25
|
- **Author:** Mohammad Rakibul Islam
|
|
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
|
|
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
|