Make pylint more strict (#1626)

* make pylint more strict

* cleanup in progress

* done cleaning up

* no opendbc
old-commit-hash: 843a64c72fb94397a1edf814fa66044c8d92acbf
This commit is contained in:
Willem Melching
2020-06-02 16:29:32 -07:00
committed by GitHub
parent a03da046c3
commit a56e2b01f8
65 changed files with 313 additions and 359 deletions
+12 -5
View File
@@ -30,6 +30,7 @@ import threading
from enum import Enum
from common.basedir import PARAMS
def mkdirs_exists_ok(path):
try:
os.makedirs(path)
@@ -143,6 +144,10 @@ class DBAccessor():
def get(self, key):
self._check_entered()
if self._vals is None:
return None
try:
return self._vals[key]
except KeyError:
@@ -195,7 +200,7 @@ class DBReader(DBAccessor):
finally:
lock.release()
def __exit__(self, type, value, traceback):
def __exit__(self, exc_type, exc_value, traceback):
pass
@@ -221,14 +226,14 @@ class DBWriter(DBAccessor):
os.chmod(self._path, 0o777)
self._lock = self._get_lock(True)
self._vals = self._read_values_locked()
except:
except Exception:
os.umask(self._prev_umask)
self._prev_umask = None
raise
return self
def __exit__(self, type, value, traceback):
def __exit__(self, exc_type, exc_value, traceback):
self._check_entered()
try:
@@ -302,12 +307,13 @@ def read_db(params_path, key):
except IOError:
return None
def write_db(params_path, key, value):
if isinstance(value, str):
value = value.encode('utf8')
prev_umask = os.umask(0)
lock = FileLock(params_path+"/.lock", True)
lock = FileLock(params_path + "/.lock", True)
lock.acquire()
try:
@@ -324,12 +330,13 @@ def write_db(params_path, key, value):
os.umask(prev_umask)
lock.release()
class Params():
def __init__(self, db=PARAMS):
self.db = db
# create the database if it doesn't exist...
if not os.path.exists(self.db+"/d"):
if not os.path.exists(self.db + "/d"):
with self.transaction(write=True):
pass