diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2017-09-09 09:17:38 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2017-09-09 09:17:38 -0400 |
| commit | 2d96236409de143b6c37c98ceeac3db969c4e247 (patch) | |
| tree | 81bb0b2282617b7b0f8b124a5995da3ad9a823c5 /pkg_resources/__init__.py | |
| parent | 1b192005562d5cf0de30c02154c58fd1dca577c8 (diff) | |
| download | python-setuptools-git-2d96236409de143b6c37c98ceeac3db969c4e247.tar.gz | |
Extract variable for ignorable errors to improve indentation.
Diffstat (limited to 'pkg_resources/__init__.py')
| -rw-r--r-- | pkg_resources/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index ce6053f1..6eca01dc 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2036,9 +2036,12 @@ def find_on_path(importer, path_item, only=False): except OSError as e: # Ignore the directory if does not exist, not a directory or we # don't have permissions - if (e.errno in (errno.ENOTDIR, errno.EACCES, errno.ENOENT) + ignorable = ( + e.errno in (errno.ENOTDIR, errno.EACCES, errno.ENOENT) # Python 2 on Windows needs to be handled this way :( - or hasattr(e, "winerror") and e.winerror == 267): + or getattr(e, "winerror", None) == 267 + ) + if ignorable: return raise # scan for .egg and .egg-info in directory |
