Skip to content

Commit

Permalink
wrap numba imports in try except (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
frazane authored Sep 13, 2024
1 parent abb1526 commit 6019452
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 13 deletions.
7 changes: 6 additions & 1 deletion scoringrules/core/crps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
t,
uniform,
)
from ._gufuncs import estimator_gufuncs, quantile_pinball_gufunc

try:
from ._gufuncs import estimator_gufuncs, quantile_pinball_gufunc
except ImportError:
estimator_gufuncs = None
quantile_pinball_gufunc = None

__all__ = [
"ensemble",
Expand Down
16 changes: 11 additions & 5 deletions scoringrules/core/energy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from ._gufuncs import (
_energy_score_gufunc,
_owenergy_score_gufunc,
_vrenergy_score_gufunc,
)
try:
from ._gufuncs import (
_energy_score_gufunc,
_owenergy_score_gufunc,
_vrenergy_score_gufunc,
)
except ImportError:
_energy_score_gufunc = None
_owenergy_score_gufunc = None
_vrenergy_score_gufunc = None

from ._score import energy_score as nrg
from ._score import owenergy_score as ownrg
from ._score import vrenergy_score as vrnrg
Expand Down
6 changes: 5 additions & 1 deletion scoringrules/core/error_spread/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from ._gufunc import _error_spread_score_gufunc as _ess_gufunc
try:
from ._gufunc import _error_spread_score_gufunc as _ess_gufunc
except ImportError:
_ess_gufunc = None

from ._score import error_spread_score as ess

__all__ = ["ess", "_ess_gufunc"]
7 changes: 6 additions & 1 deletion scoringrules/core/interval/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from ._gufunc import _interval_score_gufunc, _weighted_interval_score_gufunc
try:
from ._gufunc import _interval_score_gufunc, _weighted_interval_score_gufunc
except ImportError:
_interval_score_gufunc = None
_weighted_interval_score_gufunc = None

from ._score import _interval_score, _weighted_interval_score

__all__ = [
Expand Down
16 changes: 11 additions & 5 deletions scoringrules/core/variogram/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from ._gufuncs import (
_owvariogram_score_gufunc,
_variogram_score_gufunc,
_vrvariogram_score_gufunc,
)
try:
from ._gufuncs import (
_owvariogram_score_gufunc,
_variogram_score_gufunc,
_vrvariogram_score_gufunc,
)
except ImportError:
_owvariogram_score_gufunc = None
_variogram_score_gufunc = None
_vrvariogram_score_gufunc = None

from ._score import owvariogram_score as owvs
from ._score import variogram_score as vs
from ._score import vrvariogram_score as vrvs
Expand Down

0 comments on commit 6019452

Please sign in to comment.