Skip to content

Commit

Permalink
Resolve import error (#822)
Browse files Browse the repository at this point in the history
* early return None and add logic for bayeux methods

* return only pymc key-value pair

* return empty bayeux list if not installed
  • Loading branch information
GStechschulte authored Jul 4, 2024
1 parent 4cc3103 commit 6d19a33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bambi/backend/inference_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ def __init__(self):
self.pymc_methods = self._pymc_methods()

def _get_bayeux_methods(self, model):
# If bayeux is not installed, return an empty MCMC list.
if model is None:
return {"mcmc": []}
# Bambi only supports bayeux MCMC methods
mcmc_methods = model.methods.get("mcmc")
return {"mcmc": mcmc_methods}
Expand Down Expand Up @@ -85,7 +88,7 @@ def bayeux_model():
A dummy model with a simple quadratic likelihood function.
"""
if importlib.util.find_spec("bayeux") is None:
return {"mcmc": []}
return None

import bayeux as bx # pylint: disable=import-outside-toplevel

Expand Down

0 comments on commit 6d19a33

Please sign in to comment.