Skip to content

Commit

Permalink
Address pylint raise-missing-from warning
Browse files Browse the repository at this point in the history
Versions 2.6.0 and later of pylint adhere to PEP 3134
and trigger a 'raise-missing-from' warning (W0707) when
chained exceptions are raised implicitly.

The 'from' keyword is a Python3.x feature, that is why
six.raise_from is used for Python2.x compatibility.

Kudos to @sechkova and @jku for showing how to do this
(theupdateframework/python-tuf#1116).

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
  • Loading branch information
lukpueh committed Aug 24, 2020
1 parent f9eb590 commit 90eb2ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions in_toto/runlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Return Metablock containing a Link object which can be can be signed
and stored to disk
"""
import six
import glob
import logging
import os
Expand Down Expand Up @@ -212,8 +213,8 @@ def record_artifacts_as_dict(artifacts, exclude_patterns=None,
os.chdir(base_path)

except Exception as e:
raise ValueError("Could not use '{}' as base path: '{}'".format(
base_path, e))
six.raise_from(ValueError("Could not use '{}' as base path: '{}'".format(
base_path, e)), e)

# Normalize passed paths
norm_artifacts = []
Expand Down

0 comments on commit 90eb2ff

Please sign in to comment.