From 1e6c7c94e4750547297dc011d36eeedad0ad7e37 Mon Sep 17 00:00:00 2001 From: Greg Hogan Date: Thu, 3 Sep 2020 18:46:13 -0700 Subject: [PATCH] fix pylint errors --- selfdrive/updated.py | 4 ++-- tools/lib/auth_config.py | 4 ++-- tools/lib/logreader.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/selfdrive/updated.py b/selfdrive/updated.py index 2747e5753a..c107944fa7 100755 --- a/selfdrive/updated.py +++ b/selfdrive/updated.py @@ -283,8 +283,8 @@ def main(): ov_lock_fd = open(LOCK_FILE, 'w') try: fcntl.flock(ov_lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB) - except IOError: - raise RuntimeError("couldn't get overlay lock; is another updated running?") + except IOError as e: + raise RuntimeError("couldn't get overlay lock; is another updated running?") from e # Wait for IsOffroad to be set before our first update attempt wait_helper = WaitTimeHelper(proc) diff --git a/tools/lib/auth_config.py b/tools/lib/auth_config.py index b59fa2e89f..082c3f513e 100644 --- a/tools/lib/auth_config.py +++ b/tools/lib/auth_config.py @@ -21,8 +21,8 @@ def get_token(): with open(os.path.join(CONFIG_DIR, 'auth.json')) as f: auth = json.load(f) return auth['access_token'] - except Exception: - raise MissingAuthConfigError('Authenticate with tools/lib/auth.py') + except Exception as e: + raise MissingAuthConfigError('Authenticate with tools/lib/auth.py') from e def set_token(token): diff --git a/tools/lib/logreader.py b/tools/lib/logreader.py index 4d08b8aaed..404dd0a7ec 100755 --- a/tools/lib/logreader.py +++ b/tools/lib/logreader.py @@ -27,8 +27,8 @@ def index_log(fn): try: dat = subprocess.check_output([index_log, fn, "-"]) - except subprocess.CalledProcessError: - raise DataUnreadableError("%s capnp is corrupted/truncated" % fn) + except subprocess.CalledProcessError as e: + raise DataUnreadableError("%s capnp is corrupted/truncated" % fn) from e return np.frombuffer(dat, dtype=np.uint64) def event_read_multiple_bytes(dat):