[h5py] 02/26: Remove excessive cleverness introduced in last release

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


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

ghisvail-guest pushed a commit to annotated tag 1.3.1
in repository h5py.

commit 1a5bdd83848e0c60cad2e74b5327eb93c0f9c9ac
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Sat Apr 17 23:09:05 2010 +0000

    Remove excessive cleverness introduced in last release
---
 h5py/_extras.py   | 12 ------------
 h5py/highlevel.py | 11 +++++------
 2 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/h5py/_extras.py b/h5py/_extras.py
index 2652c95..b8cf68a 100644
--- a/h5py/_extras.py
+++ b/h5py/_extras.py
@@ -1,18 +1,6 @@
 import posixpath as pp
 import math
 
-def cproperty(attrname):
-    """ Cached property using instance dict. """
-    import functools
-    def outer(meth):
-        def inner(self):
-            if attrname in self.__dict__:
-                return self.__dict__[attrname]
-            return self.__dict__.setdefault(attrname, meth(self))
-        functools.update_wrapper(inner, meth)
-        return property(inner)
-    return outer
-
 def basename(name):
     """ Basename function with more readable handling of trailing slashes"""
     name = pp.basename(pp.normpath(name))
diff --git a/h5py/highlevel.py b/h5py/highlevel.py
index 90e161a..08a0a04 100644
--- a/h5py/highlevel.py
+++ b/h5py/highlevel.py
@@ -123,7 +123,7 @@ class HLObject(object):
         register_thread()
         return h5i.get_name(self.id)
 
-    @_extras.cproperty('_attrs')
+    @property
     def attrs(self):
         """Provides access to HDF5 attributes. See AttributeManager."""
         return AttributeManager(self)
@@ -138,7 +138,7 @@ class HLObject(object):
             raise ValueError("Parent of an anonymous object is undefined")
         return self.file[pp.dirname(self.name)]
 
-    @_extras.cproperty('_ref')
+    @property
     def ref(self):
         """ An (opaque) HDF5 reference to this object """
         register_thread()
@@ -919,7 +919,7 @@ class Dataset(HLObject):
 
     shape = property(_g_shape, _s_shape)
 
-    @_extras.cproperty('_dtype')
+    @property
     def dtype(self):
         """Numpy dtype representing the datatype"""
         register_thread()
@@ -934,11 +934,11 @@ class Dataset(HLObject):
             #    return numpy.asscalar(arr)
             return arr
 
-    @_extras.cproperty('__dcpl')
+    @property
     def _dcpl(self):
         return self.id.get_create_plist()
 
-    @_extras.cproperty('__filters')
+    @property
     def _filters(self):
         return filters.get_filters(self._dcpl)
 
@@ -1374,7 +1374,6 @@ class AttributeManager(_DictCompat):
         """ Private constructor.
         """
         self._id = parent.id
-        self._file = parent.file
 
     def __getitem__(self, name):
         """ Read the value of an attribute.

-- 
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