[h5py] 19/38: Fix lint issues in __init__.py

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:21:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository h5py.

commit 4db4be09a9df571d5398878fb77c7df1dbcce70f
Author: Andrew Collette <andrew.collette at gmail.com>
Date:   Sat May 30 17:09:51 2015 -0600

    Fix lint issues in __init__.py
---
 h5py/__init__.py | 68 ++++++++++++++++++++++++++++++++++----------------------
 h5py/h5s.pyx     |  2 +-
 2 files changed, 43 insertions(+), 27 deletions(-)

diff --git a/h5py/__init__.py b/h5py/__init__.py
index d7c8250..62987eb 100644
--- a/h5py/__init__.py
+++ b/h5py/__init__.py
@@ -7,8 +7,19 @@
 # License:  Standard 3-clause BSD; see "license.txt" for full license terms
 #           and contributor agreement.
 
+"""
+    This is the h5py package, a Python interface to the HDF5
+    scientific data format.
+"""
+
 from __future__ import absolute_import
 
+
+# --- Library setup -----------------------------------------------------------
+
+# When importing from the root of the unpacked tarball or git checkout,
+# Python sees the "h5py" source directory and tries to load it, which fails.
+# We tried working around this by using "package_dir" but that breaks Cython.
 try:
     from . import _errors
 except ImportError:
@@ -20,44 +31,38 @@ except ImportError:
     
 _errors.silence_errors()
 
-from . import _conv
-_conv.register_converters()
+from ._conv import register_converters as _register_converters
+_register_converters()
 
-from . import h5a, h5d, h5ds, h5f, h5fd, h5g, h5r, h5s, h5t, h5p, h5z
+from .h5z import _register_lzf
+_register_lzf()
 
-h5s.NULL = h5s._NULL  # NULL is a reserved name at the Cython layer
-h5z._register_lzf()
 
-from .highlevel import *
+# --- Public API --------------------------------------------------------------
+
+from . import h5a, h5d, h5ds, h5f, h5fd, h5g, h5r, h5s, h5t, h5p, h5z
+
+from ._hl import filters
+from ._hl.base import is_hdf5, HLObject
+from ._hl.files import File
+from ._hl.group import Group, SoftLink, ExternalLink, HardLink
+from ._hl.dataset import Dataset
+from ._hl.datatype import Datatype
+from ._hl.attrs import AttributeManager
 
 from .h5 import get_config
 from .h5r import Reference, RegionReference
 from .h5t import special_dtype, check_dtype
 
-# Deprecated functions
-from .h5t import py_new_vlen as new_vlen
-from .h5t import py_get_vlen as get_vlen
-from .h5t import py_new_enum as new_enum
-from .h5t import py_get_enum as get_enum
-
 from . import version
+from .version import version as __version__
 
 from .tests import run_tests
 
-__version__ = version.version
-
-__doc__ = \
-"""
-    This is the h5py package, a Python interface to the HDF5
-    scientific data format.
-
-    Version %s
-
-    HDF5 %s
-""" % (version.version, version.hdf5_version)
-
-
 def enable_ipython_completer():
+    """ Call this from an interactive IPython session to enable tab-completion
+    of group and attribute names.
+    """
     import sys
     if 'IPython' in sys.modules:
         ip_running = False
@@ -74,5 +79,16 @@ def enable_ipython_completer():
             from . import ipy_completer
             return ipy_completer.load_ipython_extension()
 
-    raise RuntimeError('completer must be enabled in active ipython session')
+    raise RuntimeError('Completer must be enabled in active ipython session')
+
+
+# --- Legacy API --------------------------------------------------------------
+
+from .h5t import py_new_vlen as new_vlen
+from .h5t import py_get_vlen as get_vlen
+from .h5t import py_new_enum as new_enum
+from .h5t import py_get_enum as get_enum
+
+
+
 
diff --git a/h5py/h5s.pyx b/h5py/h5s.pyx
index fbf13cb..f9328f3 100644
--- a/h5py/h5s.pyx
+++ b/h5py/h5s.pyx
@@ -47,7 +47,7 @@ UNLIMITED = H5S_UNLIMITED
 NO_CLASS = H5S_NO_CLASS
 SCALAR   = H5S_SCALAR
 SIMPLE   = H5S_SIMPLE
-_NULL = H5S_NULL
+globals()["NULL"] = H5S_NULL  # "NULL" is reserved in Cython
 
 #enum H5S_sel_type
 SEL_ERROR       = H5S_SEL_ERROR

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git



More information about the debian-science-commits mailing list