mirror of https://github.com/dbcli/pgcli
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:
parent
89cffd18ba
commit
477dabdbd4
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue