chemql-python 1.5.2__tar.gz → 1.5.3__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.2 → chemql_python-1.5.3}/PKG-INFO +6 -1
- {chemql_python-1.5.2 → chemql_python-1.5.3}/README.md +5 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/pyproject.toml +1 -1
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/__init__.py +1 -1
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/codecql.py +28 -5
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql_python.egg-info/PKG-INFO +6 -1
- {chemql_python-1.5.2 → chemql_python-1.5.3}/tests/test_codecql.py +36 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/LICENSE +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/setup.cfg +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/__main__.py +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/colors.json +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/data/BondEnergies.json +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/data/MoleculeBonds.json +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/data/Molecules.json +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/data/PeriodicTableJSON.json +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/data/Reactions.json +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/data/THIRD_PARTY_LICENSES/PeriodicTableJSON.txt +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/data/THIRD_PARTY_LICENSES/RHEA.txt +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/html/periodic_table.html +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/stdlib/README.md +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/stdlib/collections.cql +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/stdlib/datetime.cql +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/stdlib/decimal.cql +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/stdlib/fractions.cql +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/stdlib/json.cql +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/stdlib/math/statistics.cql +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/stdlib/math.cql +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/stdlib/pathlib.cql +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/stdlib/random.cql +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql/stdlib/text.cql +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql_python.egg-info/SOURCES.txt +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql_python.egg-info/dependency_links.txt +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql_python.egg-info/entry_points.txt +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql_python.egg-info/requires.txt +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/src/chemql_python.egg-info/top_level.txt +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/tests/test_external_molecule_lookup.py +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/tests/test_public_api.py +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/tests/test_reactions.py +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/tests/test_stdlib.py +0 -0
- {chemql_python-1.5.2 → chemql_python-1.5.3}/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.3
|
|
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
|
|
@@ -159,6 +159,8 @@ when a supported clipboard command is available), word deletion with
|
|
|
159
159
|
undo (`Ctrl+Z`), redo (`Ctrl+Y`), save (`Ctrl+S`), and quit (`Ctrl+Q`).
|
|
160
160
|
Namespace declarations are highlighted and auto-indented. Its syntax and UI
|
|
161
161
|
colors are configurable in the packaged `chemql/colors.json` file.
|
|
162
|
+
Use `Ctrl+Up` and `Ctrl+Down` to scroll the viewport while keeping the cursor
|
|
163
|
+
at the same screen position.
|
|
162
164
|
|
|
163
165
|
Press `Ctrl+F` to search; matches highlight as you type. Press Enter or the
|
|
164
166
|
Down Arrow for the next match, Up Arrow for the previous match, and Escape
|
|
@@ -168,6 +170,9 @@ default. Prefix a query with `r:` for a case-sensitive regular expression,
|
|
|
168
170
|
literal text, or `li:` for case-insensitive literal text. Add `w` to match
|
|
169
171
|
whole words, for example `lwi:cat`.
|
|
170
172
|
|
|
173
|
+
Use `Ctrl+Up` and `Ctrl+Down` to scroll the viewport while keeping the cursor
|
|
174
|
+
at the same screen position.
|
|
175
|
+
|
|
171
176
|
## Query language
|
|
172
177
|
|
|
173
178
|
A typical query starts with `search`, a source, optional conditions, and
|
|
@@ -146,6 +146,8 @@ when a supported clipboard command is available), word deletion with
|
|
|
146
146
|
undo (`Ctrl+Z`), redo (`Ctrl+Y`), save (`Ctrl+S`), and quit (`Ctrl+Q`).
|
|
147
147
|
Namespace declarations are highlighted and auto-indented. Its syntax and UI
|
|
148
148
|
colors are configurable in the packaged `chemql/colors.json` file.
|
|
149
|
+
Use `Ctrl+Up` and `Ctrl+Down` to scroll the viewport while keeping the cursor
|
|
150
|
+
at the same screen position.
|
|
149
151
|
|
|
150
152
|
Press `Ctrl+F` to search; matches highlight as you type. Press Enter or the
|
|
151
153
|
Down Arrow for the next match, Up Arrow for the previous match, and Escape
|
|
@@ -155,6 +157,9 @@ default. Prefix a query with `r:` for a case-sensitive regular expression,
|
|
|
155
157
|
literal text, or `li:` for case-insensitive literal text. Add `w` to match
|
|
156
158
|
whole words, for example `lwi:cat`.
|
|
157
159
|
|
|
160
|
+
Use `Ctrl+Up` and `Ctrl+Down` to scroll the viewport while keeping the cursor
|
|
161
|
+
at the same screen position.
|
|
162
|
+
|
|
158
163
|
## Query language
|
|
159
164
|
|
|
160
165
|
A typical query starts with `search`, a source, optional conditions, and
|
|
@@ -126,7 +126,8 @@ if os.name == 'nt':
|
|
|
126
126
|
0x4B: "arrow_left", 0x4D: "arrow_right",
|
|
127
127
|
0x47: "arrow_home", 0x4F: "arrow_end",
|
|
128
128
|
0x53: "delete", 0x73: "ctrl+arrow_left",
|
|
129
|
-
0x74: "ctrl+arrow_right",
|
|
129
|
+
0x74: "ctrl+arrow_right", 0x8D: "ctrl+arrow_up",
|
|
130
|
+
0x91: "ctrl+arrow_down", 0x9B: "alt+arrow_left",
|
|
130
131
|
0x9D: "alt+arrow_right",
|
|
131
132
|
}
|
|
132
133
|
|
|
@@ -556,12 +557,22 @@ class Editor:
|
|
|
556
557
|
"arrow_up", "arrow_down", "arrow_left", "arrow_right",
|
|
557
558
|
"arrow_home", "arrow_end",
|
|
558
559
|
}:
|
|
559
|
-
|
|
560
|
+
if "ctrl" in modifiers and base_key in {"arrow_up", "arrow_down"}:
|
|
561
|
+
self._scroll_view(-1 if base_key == "arrow_up" else 1)
|
|
562
|
+
else:
|
|
563
|
+
self._move_cursor(base_key, shift=shift, wordwise=wordwise)
|
|
560
564
|
elif key in ("\x08", "ctrl+backspace"):
|
|
561
|
-
|
|
565
|
+
if os.name == "nt":
|
|
566
|
+
if not self._delete_selection(): # For some reason on windows it is the opposit
|
|
567
|
+
self._backspace() # I have no idea why just stick to it
|
|
568
|
+
else:
|
|
569
|
+
self._delete_word("left")
|
|
562
570
|
elif key in ("\x7f", "backspace"):
|
|
563
|
-
if
|
|
564
|
-
self.
|
|
571
|
+
if os.name == "nt":
|
|
572
|
+
self._delete_word("left") # same here
|
|
573
|
+
else:
|
|
574
|
+
if not self._delete_selection():
|
|
575
|
+
self._backspace()
|
|
565
576
|
elif key in ("ctrl+delete",):
|
|
566
577
|
self._delete_word("right")
|
|
567
578
|
elif key in ("delete", "\x1b[3~"):
|
|
@@ -581,6 +592,18 @@ class Editor:
|
|
|
581
592
|
self.cursor_x = min(self.cursor_x, len(self.lines[self.cursor_y]))
|
|
582
593
|
return False
|
|
583
594
|
|
|
595
|
+
def _scroll_view(self, direction):
|
|
596
|
+
try:
|
|
597
|
+
_, rows = os.get_terminal_size()
|
|
598
|
+
except OSError:
|
|
599
|
+
rows = 24
|
|
600
|
+
viewport_height = max(rows, 4) - 2
|
|
601
|
+
max_scroll = max(0, len(self.lines) - viewport_height)
|
|
602
|
+
new_scroll_y = max(0, min(max_scroll, self.scroll_y + direction))
|
|
603
|
+
scroll_delta = new_scroll_y - self.scroll_y
|
|
604
|
+
self.scroll_y = new_scroll_y
|
|
605
|
+
self.cursor_y = max(0, min(len(self.lines) - 1, self.cursor_y + scroll_delta))
|
|
606
|
+
|
|
584
607
|
def _open_search(self):
|
|
585
608
|
self.search_active = True
|
|
586
609
|
self.search_query = ""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chemql-python
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.3
|
|
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
|
|
@@ -159,6 +159,8 @@ when a supported clipboard command is available), word deletion with
|
|
|
159
159
|
undo (`Ctrl+Z`), redo (`Ctrl+Y`), save (`Ctrl+S`), and quit (`Ctrl+Q`).
|
|
160
160
|
Namespace declarations are highlighted and auto-indented. Its syntax and UI
|
|
161
161
|
colors are configurable in the packaged `chemql/colors.json` file.
|
|
162
|
+
Use `Ctrl+Up` and `Ctrl+Down` to scroll the viewport while keeping the cursor
|
|
163
|
+
at the same screen position.
|
|
162
164
|
|
|
163
165
|
Press `Ctrl+F` to search; matches highlight as you type. Press Enter or the
|
|
164
166
|
Down Arrow for the next match, Up Arrow for the previous match, and Escape
|
|
@@ -168,6 +170,9 @@ default. Prefix a query with `r:` for a case-sensitive regular expression,
|
|
|
168
170
|
literal text, or `li:` for case-insensitive literal text. Add `w` to match
|
|
169
171
|
whole words, for example `lwi:cat`.
|
|
170
172
|
|
|
173
|
+
Use `Ctrl+Up` and `Ctrl+Down` to scroll the viewport while keeping the cursor
|
|
174
|
+
at the same screen position.
|
|
175
|
+
|
|
171
176
|
## Query language
|
|
172
177
|
|
|
173
178
|
A typical query starts with `search`, a source, optional conditions, and
|
|
@@ -64,6 +64,42 @@ def test_terminal_arrow_modifiers_are_decoded():
|
|
|
64
64
|
assert codecql._decode_escape_sequence(b"[1;6B") == "ctrl+shift+arrow_down"
|
|
65
65
|
|
|
66
66
|
|
|
67
|
+
def test_ctrl_up_down_scroll_viewport_without_edge_trigger(monkeypatch):
|
|
68
|
+
editor = codecql.Editor(None)
|
|
69
|
+
editor.lines = [f"line {index}" for index in range(30)]
|
|
70
|
+
editor.scroll_y = 10
|
|
71
|
+
editor.cursor_y = 13
|
|
72
|
+
editor.cursor_x = 2
|
|
73
|
+
monkeypatch.setattr(codecql.os, "get_terminal_size", lambda: (80, 10))
|
|
74
|
+
|
|
75
|
+
editor.handle_key("ctrl+arrow_up")
|
|
76
|
+
assert editor.scroll_y == 9
|
|
77
|
+
assert editor.cursor_y == 12
|
|
78
|
+
assert editor.cursor_y - editor.scroll_y == 3
|
|
79
|
+
|
|
80
|
+
editor.handle_key("ctrl+arrow_down")
|
|
81
|
+
assert editor.scroll_y == 10
|
|
82
|
+
assert editor.cursor_y == 13
|
|
83
|
+
assert editor.cursor_y - editor.scroll_y == 3
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def test_ctrl_scroll_clamps_at_document_ends(monkeypatch):
|
|
87
|
+
editor = codecql.Editor(None)
|
|
88
|
+
editor.lines = [f"line {index}" for index in range(30)]
|
|
89
|
+
monkeypatch.setattr(codecql.os, "get_terminal_size", lambda: (80, 10))
|
|
90
|
+
editor.scroll_y = 0
|
|
91
|
+
editor.cursor_y = 0
|
|
92
|
+
|
|
93
|
+
editor.handle_key("ctrl+arrow_up")
|
|
94
|
+
assert editor.scroll_y == editor.cursor_y == 0
|
|
95
|
+
|
|
96
|
+
editor.scroll_y = 22
|
|
97
|
+
editor.cursor_y = 25
|
|
98
|
+
editor.handle_key("ctrl+arrow_down")
|
|
99
|
+
assert editor.scroll_y == 22
|
|
100
|
+
assert editor.cursor_y == 25
|
|
101
|
+
|
|
102
|
+
|
|
67
103
|
def test_ctrl_backspace_and_delete_remove_words():
|
|
68
104
|
editor = codecql.Editor(None)
|
|
69
105
|
editor.lines = ["one two"]
|
|
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
|