TypeError: Can't instantiate abstract class StaticPrefix
Closed this issue · 1 comments
plagtag commented
Hey Stephan,
i tried out pyrocksdb and i appreciate very much your work!
I have an issue with the prefix scan:
In [1]: import rocksdb
In [2]: class StaticPrefix(rocksdb.interfaces.SliceTransform):
...: def name(self):
...: return b'static'
...:
In [3]: def transform(self, src):
...: return (0, 5)
...:
In [4]: def in_domain(self, src):
...: return len(src) >= 5
...:
In [5]: def in_range(self, dst):
...: return len(dst) == 5
...:
In [6]:
In [6]: opts = rocksdb.Options()
In [7]: opts.create_if_missing=True
In [8]: opts.prefix_extractor = StaticPrefix()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-8-9fbe2376d9cd> in <module>()
----> 1 opts.prefix_extractor = StaticPrefix()
TypeError: Can't instantiate abstract class StaticPrefix with abstract methods in_domain, in_range, transform```
am i doing something wrong?
plagtag commented
Ah, found the issue. Sorry for opening an issue:
"""The abstractmethod() only affects subclasses derived using regular inheritance; “virtual subclasses” registered with the ABC’s register() method are not affected."""
Its not working with ipython ...