[h5py] 329/455: Deprecate old dict methods and remove CoordsList
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.
commit e6697be14b3c982f385d905a78692f8d6ad80f4a
Author: andrewcollette <andrew.collette at gmail.com>
Date: Sat Nov 28 03:33:17 2009 +0000
Deprecate old dict methods and remove CoordsList
---
h5py/__init__.py | 2 +-
h5py/highlevel.py | 8 +++++++-
h5py/selections.py | 4 ----
h5py/tests/test_group.py | 18 ++++++++++--------
4 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/h5py/__init__.py b/h5py/__init__.py
index 7e370f8..ea245c4 100644
--- a/h5py/__init__.py
+++ b/h5py/__init__.py
@@ -34,7 +34,7 @@ import highlevel, filters, selections, version
# Re-export high-level interface to package level
from highlevel import File, Group, Dataset, Datatype, AttributeManager, \
- is_hdf5, CoordsList, \
+ is_hdf5, \
new_vlen, new_enum, get_vlen, get_enum
from h5 import get_config
diff --git a/h5py/highlevel.py b/h5py/highlevel.py
index da0e80a..642d0f5 100644
--- a/h5py/highlevel.py
+++ b/h5py/highlevel.py
@@ -37,11 +37,12 @@ from h5py import h5, h5f, h5g, h5s, h5t, h5d, h5a, \
h5p, h5r, h5z, h5i, h5fd, h5o, h5l
from h5py.h5 import H5Error
import h5py.selections as sel
-from h5py.selections import CoordsList
import version
import filters
+import warnings
+
config = h5.get_config()
__all__ = ["File", "Group", "Dataset", "Datatype",
@@ -204,18 +205,23 @@ class _DictCompat(object):
# Compatibility methods
def listnames(self):
""" Deprecated alias for keys() """
+ warnings.warn("listnames() is deprecated; use keys() instead", DeprecationWarning)
return self.keys()
def iternames(self):
""" Deprecated alias for iterkeys() """
+ warnings.warn("iternames() is deprecated; use iterkeys() instead", DeprecationWarning)
return self.iterkeys()
def listobjects(self):
""" Deprecated alias for values() """
+ warnings.warn("listobjects() is deprecated; use values() instead", DeprecationWarning)
return self.values()
def iterobjects(self):
""" Deprecated alias for itervalues() """
+ warnings.warn("iterobjects() is deprecated; use itervalues() instead", DeprecationWarning)
return self.itervalues()
def listitems(self):
""" Deprecated alias for items() """
+ warnings.warn("listitems() is deprecated; use items() instead", DeprecationWarning)
return self.items()
class Group(HLObject, _DictCompat):
diff --git a/h5py/selections.py b/h5py/selections.py
index cd70b3c..1080eca 100644
--- a/h5py/selections.py
+++ b/h5py/selections.py
@@ -498,10 +498,6 @@ def _translate_slice(exp, length):
return start, count, step
-def CoordsList(*args, **kwds):
-
- raise NotImplementedError("CoordsList indexing is unavailable as of 1.1.\n"
- "Please use the selections module instead")
diff --git a/h5py/tests/test_group.py b/h5py/tests/test_group.py
index 75143ca..85fe933 100644
--- a/h5py/tests/test_group.py
+++ b/h5py/tests/test_group.py
@@ -1,3 +1,4 @@
+from __future__ import with_statement
"""
Test highlevel Group object behavior
@@ -5,6 +6,7 @@
import numpy as np
import h5py
+import warnings
from common import TestCasePlus, api_16, api_18, res
SHAPES = [(), (1,), (10,5), (1,10), (10,1), (100,1,100), (51,2,1025)]
@@ -78,19 +80,19 @@ class TestSpecial(GroupBase):
def test_dictcompat(self):
- # Old style
- self.assert_equal_contents(self.f.listnames(), self.subgroups)
- self.assert_equal_contents(self.f.listobjects(), [self.f[x] for x in self.subgroups])
- self.assert_equal_contents(self.f.listitems(), [(x, self.f[x]) for x in self.subgroups])
+ # Old style -- now deprecated
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+ self.assert_equal_contents(self.f.listnames(), self.subgroups)
+ self.assert_equal_contents(self.f.listobjects(), [self.f[x] for x in self.subgroups])
+ self.assert_equal_contents(self.f.listitems(), [(x, self.f[x]) for x in self.subgroups])
+ self.assert_equal_contents(list(self.f.iternames()), self.subgroups)
+ self.assert_equal_contents(list(self.f.iterobjects()), [self.f[x] for x in self.subgroups])
# New style
self.assert_equal_contents(self.f.keys(), self.subgroups)
self.assert_equal_contents(self.f.values(), [self.f[x] for x in self.subgroups])
self.assert_equal_contents(self.f.items(), [(x, self.f[x]) for x in self.subgroups])
-
- # Shared
- self.assert_equal_contents(list(self.f.iternames()), self.subgroups)
- self.assert_equal_contents(list(self.f.iterobjects()), [self.f[x] for x in self.subgroups])
self.assert_equal_contents(list(self.f.iteritems()), [(x, self.f[x]) for x in self.subgroups])
--
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