summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarik Gamble <darik.gamble@gmail.com>2015-01-25 15:10:49 -0500
committerdarikg <darik.gamble@gmail.com>2015-01-25 16:09:20 -0500
commit477dabdbd4b8fb60952b329e23c8af73b4c5dcb8 (patch)
treecedc8ee296c93e7873cad48a51d9be7abe1abb62
parent89cffd18ba3a80681b0439fc739315ba98c0eb7b (diff)
Metadata should be instance variables, not class variables
Class variables make pgcompleter act poorly as a test fixture, since the class can carry state between tests
-rw-r--r--pgcli/pgcompleter.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/pgcli/pgcompleter.py b/pgcli/pgcompleter.py
index a49d9c60..3585abeb 100644
--- a/pgcli/pgcompleter.py
+++ b/pgcli/pgcompleter.py
@@ -33,13 +33,6 @@ class PGCompleter(Completer):
'LCASE', 'LEN', 'MAX', 'MIN', 'MID', 'NOW', 'ROUND', 'SUM', 'TOP',
'UCASE']
- special_commands = []
- databases = []
- dbmetadata = {}
- search_path = []
-
- all_completions = set(keywords + functions)
-
def __init__(self, smart_completion=True):
super(self.__class__, self).__init__()
self.smart_completion = smart_completion
@@ -48,6 +41,13 @@ class PGCompleter(Completer):
self.reserved_words.update(x.split())
self.name_pattern = compile("^[_a-z][_a-z0-9\$]*$")
+ self.special_commands = []
+ self.databases = []
+ self.dbmetadata = {}
+ self.search_path = []
+
+ self.all_completions = set(self.keywords + self.functions)
+
def escape_name(self, name):
if name and ((not self.name_pattern.match(name))
or (name.upper() in self.reserved_words)