Skip to content

Commit

Permalink
Check for py version instead of try/except when importing entry_points (
Browse files Browse the repository at this point in the history
pydata#5988)

* Check for py version instead of try/except

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Illviljan and pre-commit-ci[bot] authored Nov 14, 2021
1 parent 5e2f1dc commit a883ed0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions xarray/backends/plugins.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import functools
import inspect
import itertools
import sys
import warnings

from .common import BACKEND_ENTRYPOINTS, BackendEntrypoint

try:
if sys.version_info >= (3, 8):
from importlib.metadata import entry_points
except ImportError:
else:
# if the fallback library is missing, we are doomed.
from importlib_metadata import entry_points # type: ignore
from importlib_metadata import entry_points


STANDARD_BACKENDS_ORDER = ["netcdf4", "h5netcdf", "scipy"]
Expand Down

0 comments on commit a883ed0

Please sign in to comment.