Skip to content

Commit

Permalink
Prefer contextlib.suppress to except/pass
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Nov 6, 2021
1 parent 1d7c748 commit 5c128af
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions distutils/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import sys
import os
import contextlib

from distutils import log
from distutils.core import Command
Expand Down Expand Up @@ -91,15 +92,13 @@ def _load_schemes():

schemes = dict(INSTALL_SCHEMES)

try:
with contextlib.supress(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

Expand Down

0 comments on commit 5c128af

Please sign in to comment.