diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-09-06 04:17:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-09-06 04:17:09 +0000 |
commit | 76d27bc43d56d7ef3ca0090fb199777888adf7c3 (patch) | |
tree | b6d3d562a0be03d404426bb43aff62174be3dc5e /pgcli/completion_refresher.py | |
parent | Adding upstream version 3.1.0. (diff) | |
download | pgcli-76d27bc43d56d7ef3ca0090fb199777888adf7c3.tar.xz pgcli-76d27bc43d56d7ef3ca0090fb199777888adf7c3.zip |
Adding upstream version 3.2.0.upstream/3.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pgcli/completion_refresher.py')
-rw-r--r-- | pgcli/completion_refresher.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pgcli/completion_refresher.py b/pgcli/completion_refresher.py index cf0879f..1039d51 100644 --- a/pgcli/completion_refresher.py +++ b/pgcli/completion_refresher.py @@ -3,10 +3,9 @@ import os from collections import OrderedDict from .pgcompleter import PGCompleter -from .pgexecute import PGExecute -class CompletionRefresher(object): +class CompletionRefresher: refreshers = OrderedDict() @@ -27,6 +26,10 @@ class CompletionRefresher(object): has completed the refresh. The newly created completion object will be passed in as an argument to each callback. """ + if executor.is_virtual_database(): + # do nothing + return [(None, None, None, "Auto-completion refresh can't be started.")] + if self.is_refreshing(): self._restart_refresh.set() return [(None, None, None, "Auto-completion refresh restarted.")] @@ -141,7 +144,7 @@ def refresh_casing(completer, executor): with open(casing_file, "w") as f: f.write(casing_prefs) if os.path.isfile(casing_file): - with open(casing_file, "r") as f: + with open(casing_file) as f: completer.extend_casing([line.strip() for line in f]) |