Revert "gh-133390: Support SQL keyword completion for sqlite3 CLI (#133393)" temporarily (GH-135232)

This reverts commit 62b3d2d443,
which broke buildbots
This commit is contained in:
Petr Viktorin 2025-06-07 10:56:43 +02:00 committed by GitHub
parent 46151648ca
commit 24069fbca8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 6 additions and 193 deletions

View file

@ -1,42 +0,0 @@
from contextlib import contextmanager
try:
from _sqlite3 import SQLITE_KEYWORDS
except ImportError:
SQLITE_KEYWORDS = ()
_completion_matches = []
def _complete(text, state):
global _completion_matches
if state == 0:
text_upper = text.upper()
_completion_matches = [c for c in SQLITE_KEYWORDS if c.startswith(text_upper)]
try:
return _completion_matches[state] + " "
except IndexError:
return None
@contextmanager
def completer():
try:
import readline
except ImportError:
yield
return
old_completer = readline.get_completer()
try:
readline.set_completer(_complete)
if readline.backend == "editline":
# libedit uses "^I" instead of "tab"
command_string = "bind ^I rl_complete"
else:
command_string = "tab: complete"
readline.parse_and_bind(command_string)
yield
finally:
readline.set_completer(old_completer)