From 087c03a07a9236dbda0fba49835c4beaad9ee4b3 Mon Sep 17 00:00:00 2001 From: Shi Fan Date: Thu, 20 Jan 2022 18:41:25 -0500 Subject: [PATCH] Use try statement in datashader import --- pymc3_hmm/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pymc3_hmm/utils.py b/pymc3_hmm/utils.py index 99f1b8b..8f2047d 100644 --- a/pymc3_hmm/utils.py +++ b/pymc3_hmm/utils.py @@ -1,7 +1,5 @@ from typing import Any, Callable, Dict, List, Optional, Sequence, Text, Tuple, Union -import datashader as ds -import datashader.transfer_functions as tf import matplotlib.pyplot as plt import numpy as np import pandas as pd @@ -21,6 +19,12 @@ from theano.tensor.extra_ops import broadcast_to as at_broadcast_to from theano.tensor.var import TensorVariable +try: # pragma: no cover + import datashader as ds + import datashader.transfer_functions as tf +except ImportError: # pragma: no cover + pass + vsearchsorted = np.vectorize(np.searchsorted, otypes=[int], signature="(n),()->()")