diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2022-09-25 22:31:56 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2022-09-25 22:31:56 +0300 |
commit | 643acbedfa7ef17b4fa56c7ca4591425a0ef5e52 (patch) | |
tree | c26c5d15aa266c07a8a0163f196bc48ef25ca6d9 | |
parent | fileutils: remove unused `UnbufferedWriteHandle` (diff) | |
download | snakeoil-643acbedfa7ef17b4fa56c7ca4591425a0ef5e52.tar.gz snakeoil-643acbedfa7ef17b4fa56c7ca4591425a0ef5e52.tar.bz2 snakeoil-643acbedfa7ef17b4fa56c7ca4591425a0ef5e52.zip |
descriptors: remove unused `classproperty`
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r-- | src/snakeoil/descriptors.py | 34 | ||||
-rw-r--r-- | tests/test_descriptors.py | 16 |
2 files changed, 0 insertions, 50 deletions
diff --git a/src/snakeoil/descriptors.py b/src/snakeoil/descriptors.py deleted file mode 100644 index 12f51cb5..00000000 --- a/src/snakeoil/descriptors.py +++ /dev/null @@ -1,34 +0,0 @@ -"""Classes implementing the descriptor protocol.""" - -__all__ = ("classproperty",) - - -class classproperty: - - """Like the builtin :py:func:`property` but takes a single classmethod. - - Essentially, it allows you to use a property on a class itself- not - just on its instances. - - Used like this: - - >>> from snakeoil.descriptors import classproperty - >>> class foo: - ... - ... @classproperty - ... def test(cls): - ... print("invoked") - ... return True - >>> foo.test - invoked - True - >>> foo().test - invoked - True - """ - - def __init__(self, getter): - self.getter = getter - - def __get__(self, instance, owner): - return self.getter(owner) diff --git a/tests/test_descriptors.py b/tests/test_descriptors.py deleted file mode 100644 index 1720e318..00000000 --- a/tests/test_descriptors.py +++ /dev/null @@ -1,16 +0,0 @@ -from snakeoil import descriptors - - -class ClassProp: - - @descriptors.classproperty - def test(cls): - """Just an example.""" - return 'good', cls - - -class TestDescriptor: - - def test_classproperty(self): - assert ('good', ClassProp) == ClassProp.test - assert ('good', ClassProp) == ClassProp().test |