MCPcopy Create free account
hub / github.com/PyTables/PyTables / dump_leaf

Function dump_leaf

tables/scripts/ptdump.py:23–66  ·  view source on GitHub ↗

Dump an HDF5 leaf node.

(leaf)

Source from the content-addressed store, hash-verified

21
22
23def dump_leaf(leaf):
24 """Dump an HDF5 leaf node."""
25 if options.verbose:
26 print(repr(leaf))
27 else:
28 print(str(leaf))
29 if options.showattrs:
30 print(f" {leaf.attrs!r}")
31 if options.dump and not isinstance(leaf, tb.unimplemented.UnImplemented):
32 print(" Data dump:")
33 # print((leaf.read(options.rng.start, options.rng.stop,
34 # options.rng.step))
35 # This is better for large objects
36 if options.rng.start is None:
37 start = 0
38 else:
39 start = options.rng.start
40 if options.rng.stop is None:
41 if leaf.shape != ():
42 stop = leaf.shape[0]
43 else:
44 stop = options.rng.stop
45 if options.rng.step is None:
46 step = 1
47 else:
48 step = options.rng.step
49 if leaf.shape == ():
50 print("[SCALAR] %s" % (leaf[()]))
51 else:
52 for i in range(start, stop, step):
53 print(f"[{i}] {leaf[i]}")
54
55 if isinstance(leaf, tb.table.Table) and options.colinfo:
56 # Show info of columns
57 for colname in leaf.colnames:
58 print(repr(leaf.cols._f_col(colname)))
59
60 if isinstance(leaf, tb.table.Table) and options.idxinfo:
61 # Show info of indexes
62 for colname in leaf.colnames:
63 col = leaf.cols._f_col(colname)
64 if isinstance(col, tb.table.Column) and col.index is not None:
65 idx = col.index
66 print(repr(idx))
67
68
69def dump_group(pgroup, sort=False):

Callers 2

dump_groupFunction · 0.85
mainFunction · 0.85

Calls 1

_f_colMethod · 0.80

Tested by

no test coverage detected