/usr/share/pyshared/h5py/h5.pyx is in python-h5py 2.0.1-2+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | include "config.pxi"
from defs cimport *
ITER_INC = H5_ITER_INC # Increasing order
ITER_DEC = H5_ITER_DEC # Decreasing order
ITER_NATIVE = H5_ITER_NATIVE # No particular order, whatever is fastest
INDEX_NAME = H5_INDEX_NAME # Index on names
INDEX_CRT_ORDER = H5_INDEX_CRT_ORDER # Index on creation order
cdef class H5PYConfig:
"""
Provides runtime access to global library settings. You retrieve the
master copy of this object by calling h5py.get_config().
complex_names (tuple, r/w)
Settable 2-tuple controlling how complex numbers are saved.
Defaults to ('r','i').
bool_names (tuple, r/w)
Settable 2-tuple controlling the HDF5 enum names used for boolean
values. Defaults to ('FALSE', 'TRUE') for values 0 and 1.
"""
def __init__(self):
self._r_name = b'r'
self._i_name = b'i'
self._f_name = b'FALSE'
self._t_name = b'TRUE'
property complex_names:
""" Settable 2-tuple controlling how complex numbers are saved.
Format is (real_name, imag_name), defaulting to ('r','i').
"""
def __get__(self):
import sys
def handle_val(val):
if sys.version[0] == '3':
return val.decode('utf8')
return val
return (handle_val(self._r_name), handle_val(self._i_name))
def __set__(self, val):
def handle_val(val):
if isinstance(val, unicode):
return val.encode('utf8')
elif isinstance(val, bytes):
return val
else:
return bytes(val)
try:
if len(val) != 2: raise TypeError()
r = handle_val(val[0])
i = handle_val(val[1])
except Exception:
raise TypeError("complex_names must be a length-2 sequence of strings (real, img)")
self._r_name = r
self._i_name = i
property bool_names:
""" Settable 2-tuple controlling HDF5 ENUM names for boolean types.
Format is (false_name, real_name), defaulting to ('FALSE', 'TRUE').
"""
def __get__(self):
return (self._f_name, self._t_name)
def __set__(self, val):
try:
if len(val) != 2: raise TypeError()
f = str(val[0])
t = str(val[1])
except Exception:
raise TypeError("bool_names must be a length-2 sequence of of names (false, true)")
self._f_name = f
self._t_name = t
cdef H5PYConfig cfg = H5PYConfig()
cpdef H5PYConfig get_config():
"""() => H5PYConfig
Get a reference to the global library configuration object.
"""
return cfg
def get_libversion():
""" () => TUPLE (major, minor, release)
Retrieve the HDF5 library version as a 3-tuple.
"""
cdef unsigned int major
cdef unsigned int minor
cdef unsigned int release
cdef herr_t retval
H5get_libversion(&major, &minor, &release)
return (major, minor, release)
|