diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2021-11-06 11:01:18 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2021-11-06 11:13:55 -0400 |
| commit | 28e643959a4208f86fb3b37ae9b78eb07ad5b6d5 (patch) | |
| tree | adca7b67e19e5c3c0239e6234d1d9d2816d8b416 | |
| parent | 1d7c74836b725af874f975503568053f0b95e26c (diff) | |
| download | python-setuptools-git-28e643959a4208f86fb3b37ae9b78eb07ad5b6d5.tar.gz | |
Prefer contextlib.suppress to except/pass
| -rw-r--r-- | distutils/command/install.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/distutils/command/install.py b/distutils/command/install.py index 0db71e94..b1876748 100644 --- a/distutils/command/install.py +++ b/distutils/command/install.py @@ -4,6 +4,7 @@ Implements the Distutils 'install' command.""" import sys import os +import contextlib from distutils import log from distutils.core import Command @@ -91,15 +92,13 @@ def _load_schemes(): schemes = dict(INSTALL_SCHEMES) - try: + with contextlib.suppress(ImportError, AttributeError): import sysconfig sysconfig_schemes = { scheme: sysconfig.get_paths(scheme, expand=False) for scheme in sysconfig.get_scheme_names() } schemes.update(sysconfig_schemes) - except (ImportError, AttributeError): - pass return schemes |
