summaryrefslogtreecommitdiffstats
path: root/pgcli
diff options
context:
space:
mode:
authorblag <blag@users.noreply.github.com>2023-09-12 12:46:34 -0700
committerGitHub <noreply@github.com>2023-09-12 12:46:34 -0700
commited89c154ee2af7edcdacc092fe357e8ceeb30312 (patch)
tree27ac3fe8e2cd461e76fb6033c4d90408757c8940 /pgcli
parent69dcceb5f6d3ecbcc9e7a0a48c9bdabeed470dcd (diff)
For Python >= 3.11 directly use packaging to compare package versions (#1416)
* For Python >= 3.11 directly use packaging to compare package versions * Improve prompt-toolkit check to test for feature explicitly
Diffstat (limited to 'pgcli')
-rw-r--r--pgcli/pgtoolbar.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/pgcli/pgtoolbar.py b/pgcli/pgtoolbar.py
index 7b5883e6..4a12ff4e 100644
--- a/pgcli/pgtoolbar.py
+++ b/pgcli/pgtoolbar.py
@@ -1,18 +1,14 @@
-from pkg_resources import packaging
-
-import prompt_toolkit
from prompt_toolkit.key_binding.vi_state import InputMode
from prompt_toolkit.application import get_app
-parse_version = packaging.version.parse
-
vi_modes = {
InputMode.INSERT: "I",
InputMode.NAVIGATION: "N",
InputMode.REPLACE: "R",
InputMode.INSERT_MULTIPLE: "M",
}
-if parse_version(prompt_toolkit.__version__) >= parse_version("3.0.6"):
+# REPLACE_SINGLE is available in prompt_toolkit >= 3.0.6
+if "REPLACE_SINGLE" in {e.name for e in InputMode}:
vi_modes[InputMode.REPLACE_SINGLE] = "R"