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
|
Origin: upstream, https://bitbucket.org/nigma/pywt/changeset/4ff3f22025c9
Description: Replaced MustOverride hack for BaseNode attributes with plain old
comment.
Bug: https://bitbucket.org/nigma/pywt/issue/2/help-broken
Bug-Debian: http://bugs.debian.org/595980
Last-Update: 2012-05-22
--- a/pywt/wavelet_packets.py
+++ b/pywt/wavelet_packets.py
@@ -22,14 +22,15 @@
return graycode_order
-class MustOverride(object):
- def __init__(self, message): self.message= message
- def __get__(self, obj, cls): raise NotImplementedError(self.message % {'cls': cls.__name__})
-
-
class BaseNode(object):
- PART_LEN = MustOverride("BaseNode.PART_LEN must be redefined in subclass %(cls)s.")
- PARTS = MustOverride("BaseNode.PARTS must be redefined in subclass %(cls)s.")
+ """
+ BaseNode for wavelet packet 1D and 2D tree nodes.
+ """
+
+ # PART_LEN and PARTS attributes that define path tokens for
+ # node[] lookup must be defined in subclasses.
+ PART_LEN = None
+ PARTS = None
def __init__(self, parent, data, node_name):
self.parent = parent
@@ -341,6 +342,7 @@
class Node2D(BaseNode):
"""
WaveletPacket tree node.
+
Subnodes are called 'a' (LL), 'h' (LH), 'v' (HL) and 'd' (HH), like approximation and
detail coefficients in 2D Discrete Wavelet Transform
"""
|