Skip to content

Commit 5f3414a

Browse files
committed
update imports to make matplotlib & seaborn optional
1 parent eb1aee3 commit 5f3414a

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

coderdata/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,12 @@
1515
from .utils.utils import version
1616
from .utils.utils import list_datasets
1717

18-
from .utils.stats import summarize_response_metric
18+
try:
19+
import matplotlib
20+
import seaborn as sns
21+
except ModuleNotFoundError:
22+
pass
23+
else:
24+
from .utils.stats import summarize_response_metric
25+
from .utils.stats import plot_response_metric
26+
from .utils.stats import plot_2d_respones_metric

coderdata/utils/__init__.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
from .stats import summarize_response_metric
2-
from .stats import prepare_2d_hist_data
31
from .utils import version
42
from .utils import list_datasets
3+
4+
try:
5+
import matplotlib
6+
import seaborn as sns
7+
except ModuleNotFoundError:
8+
import warnings
9+
warnings.warn(
10+
"package was not availble. To use coderdata.utils.stats functions "
11+
"please make sure 'matplotlib' & 'seaborn' are available in the "
12+
"environment."
13+
)
14+
else:
15+
from .stats import summarize_response_metric
16+
from .stats import plot_response_metric
17+
from .stats import plot_2d_respones_metric

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy