1
0
Fork 0

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
This commit is contained in:
Darik Gamble 2015-01-25 15:10:49 -05:00 committed by darikg
parent 89cffd18ba
commit 477dabdbd4
1 changed files with 7 additions and 7 deletions

View File

@ -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)