9710: dbapi pylint issues

This commit is contained in:
Doug Blank 2016-09-23 06:30:51 -04:00
parent 60406bc239
commit a9f1377529

View File

@ -163,8 +163,8 @@ class DBAPI(DbGeneric):
"config": config_mgr "config": config_mgr
} }
settings_file = os.path.join(directory, "settings.py") settings_file = os.path.join(directory, "settings.py")
with open(settings_file) as file: with open(settings_file) as fp:
code = compile(file.read(), settings_file, 'exec') code = compile(fp.read(), settings_file, 'exec')
exec(code, globals(), settings) exec(code, globals(), settings)
self.dbapi = settings["dbapi"] self.dbapi = settings["dbapi"]
@ -443,7 +443,7 @@ class DBAPI(DbGeneric):
txn.last = None txn.last = None
self._after_commit(txn) self._after_commit(txn)
def get_metadata(self, key, default=[]): def get_metadata(self, key, default=None):
""" """
Get an item from the database. Get an item from the database.
""" """
@ -452,7 +452,7 @@ class DBAPI(DbGeneric):
row = self.dbapi.fetchone() row = self.dbapi.fetchone()
if row: if row:
return pickle.loads(row[0]) return pickle.loads(row[0])
elif default == []: elif default == None:
return [] return []
else: else:
return default return default
@ -2059,7 +2059,7 @@ class DBAPI(DbGeneric):
Given a list of field names and values, return the values Given a list of field names and values, return the values
in the appropriate type. in the appropriate type.
""" """
return [v if type(v) is not bool else int(v) for v in values] return [v if not isinstance(v, bool) else int(v) for v in values]
def _sql_repr(self, value): def _sql_repr(self, value):
""" """