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

PrincetonUniversity / slurmise / 17078564745

19 Aug 2025 06:33PM UTC coverage: 92.755% (-0.6%) from 93.337%
17078564745

push

github

web-flow
Refactoring and low hanging fruits (#49)

* feat: add from_dict contructors for job data objects

* chore: pass linter

* fix: several issues

* fix: linting

* fix: fully linted and sorted

* fix: tests after linting

* Apply suggestion from @troycomi

Co-authored-by: Troy Comi <troycomi@gmail.com>

* fix: removing unused functions

* addressing Tryoy's comments

* fix: final linting

---------

Co-authored-by: Troy Comi <troycomi@gmail.com>

136 of 150 branches covered (90.67%)

Branch coverage included in aggregate %.

314 of 355 new or added lines in 20 files covered. (88.45%)

4 existing lines in 3 files now uncovered.

1490 of 1603 relevant lines covered (92.95%)

1.86 hits per line

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

0.0
/tests/utils.py
1
import os
×
2

3
import h5py
×
4

5

NEW
6
def print_hdf5(h5py_obj, level=-1, print_full_name: bool = False, print_attrs: bool = True) -> None:
×
7
    """Prints the name and shape of datasets in a H5py HDF5 file.
8

9
    Parameters
10
    ----------
11
    h5py_obj: [h5py.File, h5py.Group]
12
        the h5py.File or h5py.Group object
13
    level: int
14
        What level of the file tree you are in
15
    print_full_name
16
        If True, the full tree will be printed as the name, e.g. /group0/group1/group2/dataset: ...
17
        If False, only the current node will be printed, e.g. dataset:
18
    print_attrs
19
        If True: print all attributes in the file
20
    Returns
21
    -------
22
    None
23

24
    """
25

26
    def is_group(f):
×
NEW
27
        return isinstance(f, h5py._hl.group.Group)
×
28

29
    def is_dataset(f):
×
NEW
30
        return isinstance(f, h5py._hl.dataset.Dataset)
×
31

32
    def print_level(level, n_spaces=5) -> str:
×
33
        if level == -1:
×
34
            return ""
×
35
        prepend = "|" + " " * (n_spaces - 1)
×
36
        prepend *= level
×
37
        tree = "|" + "-" * (n_spaces - 2) + " "
×
38
        return prepend + tree
×
39

40
    for key in h5py_obj.keys():
×
41
        entry = h5py_obj[key]
×
42
        name = entry.name if print_full_name else os.path.basename(entry.name)
×
43
        if is_group(entry):
×
44
            print(f"{print_level(level)}{name}")
×
45
            print_hdf5(entry, level + 1, print_full_name=print_full_name)
×
46
        elif is_dataset(entry):
×
47
            shape = entry.shape
×
48
            dtype = entry.dtype
×
49
            print(f"{print_level(level)}{name}: {shape} {dtype} {entry[()]}")
×
NEW
50
    if level == -1 and print_attrs:
×
NEW
51
        print("attrs: ")
×
NEW
52
        for key, value in h5py_obj.attrs.items():
×
NEW
53
            print(f" {key}: {value}")
×
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