• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

peleiden / pelutils / 29330055750

14 Jul 2026 11:46AM UTC coverage: 97.381% (+0.1%) from 97.25%
29330055750

Pull #229

github

asgerius
Improve handling of potentially unavailable libraries
Pull Request #229: Hardware

89 of 97 new or added lines in 8 files covered. (91.75%)

1450 of 1489 relevant lines covered (97.38%)

0.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/pelutils/_misc/conditional_import.py
1
"""Functions for attempting imports which may or may not be available at runtime."""
2

3

4
def import_torch():
1✔
5
    """Attempt a import of torch. If found, torch is returned, otherwise None is returned."""
6
    try:
1✔
7
        import torch  # noqa: PLC0415
1✔
8

9
        return torch
1✔
NEW
10
    except ModuleNotFoundError:
×
NEW
11
        return None
×
12

13

14
def import_git():
1✔
15
    """Attempt a import of git. If successful, git is returned, otherwise None is returned."""
16
    try:
1✔
17
        import git  # noqa: PLC0415
1✔
18

19
        return git
1✔
NEW
20
    except ImportError:  # The Python git library should always be available, but git may not be available on the system
×
NEW
21
        return None
×
22

23

24
def import_pandas():
1✔
25
    """Attempt a import of pandas. If found, pandas is returned, otherwise None is returned."""
26
    try:
1✔
27
        import pandas  # noqa: PLC0415
1✔
28

29
        return pandas
1✔
NEW
30
    except ModuleNotFoundError:
×
NEW
31
        return None
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc