Coverage for src/km3pipe/extras.py: 29%
24 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-28 03:15 +0000
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-28 03:15 +0000
1#!/usr/bin/env python3
4def pandas():
5 """Imports and returns ``pandas``."""
6 try:
7 import pandas
8 except ImportError:
9 raise ImportError(
10 "install the 'pandas' package with:\n\n"
11 " pip install pandas\n\n"
12 "or\n\n"
13 " conda install pandas"
14 )
15 else:
16 return pandas
19def scipy():
20 """Imports and returns ``scipy``."""
21 try:
22 import scipy
23 except ImportError:
24 raise ImportError(
25 "install the 'scipy' package with:\n\n"
26 " pip install scipy\n\n"
27 "or\n\n"
28 " conda install scipy"
29 )
30 else:
31 return scipy
34def pypandoc():
35 """Imports and returns ``pypandoc``."""
36 try:
37 import pypandoc
38 except ImportError:
39 raise ImportError(
40 "install the 'pypandoc' package with:\n\n"
41 " pip install pypandoc\n\n"
42 "or\n\n"
43 " conda install pypandoc"
44 )
45 else:
46 return pypandoc
49def urwid():
50 """Imports and returns ``urwid``."""
51 try:
52 import urwid
53 except ImportError:
54 raise ImportError(
55 "install the 'urwid' package with:\n\n"
56 " pip install urwid\n\n"
57 "or\n\n"
58 " conda install urwid"
59 )
60 else:
61 return urwid