Advanced descriptors for special cases.
Project description
Advanced descriptors
This package includes helpers for special cases:
SeparateClassMethod - allow to have classmethod and normal method both with the same name.
AdvancedProperty - property with possibility to set class wide getter.
SeparateClassMethod
This descriptor can be set using standard decorator syntax. Create instance with arguments:
def imeth(instance):
return instance.value
def cmeth(owner):
return owner.value
class Target(object):
value = 1
def __init__(self):
self.value = 2
getval = advanced_descriptors.SeparateClassMethod(
imeth, cmeth
)
Create instance wrapping as decorator:
class Target(object):
value = 1
def __init__(self):
self.value = 2
@advanced_descriptors.SeparateClassMethod
def getval(self):
return self.value
@getval.class_method
def getval(cls):
return cls.value
Cases with method only and classmethod only is useless: method as-is and @classmethod should be used in corresponding cases.
AdvancedProperty
This descriptor should be used in cases, when in addition to normal property API, class getter is required. If class-wide setter and deleter also required - you should use standard propery in metaclass.
Usage examples:
In addition to normal property API:
class Target(object): _value = 777 def __init__(self): self._value = 42 @advanced_descriptors.AdvancedProperty def val(self): return self._value @val.setter def val(self, value): self._value = value @val.deleter def val(self): self._value = 0 @val.cgetter def val(cls): return cls._value
Use class-wide getter for instance too:
class Target(object): _value = 1 val = advanced_descriptors.AdvancedProperty() @val.cgetter def val(cls): return cls._value
Testing
The main test mechanism for the package advanced-descriptors is using tox. Available environments can be collected via tox -l
CI systems
For code checking several CI systems is used in parallel:
Travis CI: is used for checking: PEP8, pylint, bandit, installation possibility and unit tests. Also it’s publishes coverage on coveralls.
coveralls: is used for coverage display.
CD system
Travis CI: is used for package delivery on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file Advanced-Descriptors-2.0.0.tar.gz
.
File metadata
- Download URL: Advanced-Descriptors-2.0.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 PyPy/5.10.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc6ae7a08996582529f4e02399f8c4b80bafca872b8cc1f6d989e6e1a4bf5fa8 |
|
MD5 | 9aba64cd8413d847f353456404b03b2d |
|
BLAKE2b-256 | baf76d4072abcb539478418e634b788dcdd82efe1b777d6205a27e5d0151394c |
File details
Details for the file Advanced_Descriptors-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: Advanced_Descriptors-2.0.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 PyPy/5.10.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93626310269ab0968a9774432638294fe48c73c47d072a14b4e16e5ec2504135 |
|
MD5 | 3ad16204ecd18965cfeac35f65645414 |
|
BLAKE2b-256 | de8a5e78f075c6d6a28d64a62e07af13e8460a48b0c2cd1affad99db65888c84 |
File details
Details for the file Advanced_Descriptors-2.0.0-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: Advanced_Descriptors-2.0.0-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 218.6 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 381d139c41aee118628154cce442ec525dc6df409181dc7975788a80f4254252 |
|
MD5 | 9ec66bd47b3619fe61f0ea34a1906d01 |
|
BLAKE2b-256 | a887cfdc4a7b069760b8d980141b592a2bf461b7f58cb1d428a96c7581b6f5c0 |
File details
Details for the file Advanced_Descriptors-2.0.0-cp37-cp37m-manylinux1_i686.whl
.
File metadata
- Download URL: Advanced_Descriptors-2.0.0-cp37-cp37m-manylinux1_i686.whl
- Upload date:
- Size: 220.8 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd87b123920e7b52422c515742d7e4a3a6e505324b1a3bee88517c91e68aeb00 |
|
MD5 | 3dd55d5de0721d6e584028f2aec50066 |
|
BLAKE2b-256 | f48c9a998d0c55aaf94c2fecae40d49cd7f048b4e660a2346d9c2c5eeb2b588a |
File details
Details for the file Advanced_Descriptors-2.0.0-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: Advanced_Descriptors-2.0.0-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 217.0 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2022454819df5d9cbccd9ba3ca2a1185326c554c69999ba739ae775a0da8836 |
|
MD5 | 6287883c0fd55caf56e0b272ae578652 |
|
BLAKE2b-256 | 4fc2bda77d3c71131fcccfd7012e8cdeeb98d84c004c48920d9ad7fef624ecca |
File details
Details for the file Advanced_Descriptors-2.0.0-cp36-cp36m-manylinux1_i686.whl
.
File metadata
- Download URL: Advanced_Descriptors-2.0.0-cp36-cp36m-manylinux1_i686.whl
- Upload date:
- Size: 218.2 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 509e7622d2d9ce494eaac0b7502f7bbdac3782bd6c9a233aae88445107de5d3a |
|
MD5 | d11d307c0fee2705047ab489987a7107 |
|
BLAKE2b-256 | e71aafb7e3f0f8f407d19b2dde075516c780e43f9e27eab89d7e688836b63727 |
File details
Details for the file Advanced_Descriptors-2.0.0-cp35-cp35m-manylinux1_x86_64.whl
.
File metadata
- Download URL: Advanced_Descriptors-2.0.0-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 212.0 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e409136325fad77cdfd700c55db5d0d1e5c862e312d25773ad13447e0707d95 |
|
MD5 | e7f8c8a9d40595296a4e3f4d4c365c03 |
|
BLAKE2b-256 | 0ad8ddf128c49b6fbc1eccaed7a994e107348becc6ccc76fc36c9cba00f0fad9 |
File details
Details for the file Advanced_Descriptors-2.0.0-cp35-cp35m-manylinux1_i686.whl
.
File metadata
- Download URL: Advanced_Descriptors-2.0.0-cp35-cp35m-manylinux1_i686.whl
- Upload date:
- Size: 213.7 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e40bafa17d0072a9a68f55721bc4609fed1c986355d16587efe3f8ce212611f |
|
MD5 | a66599e37a266be5eaaf34c4f5e15d69 |
|
BLAKE2b-256 | 525ee09ca721e868fc6d93ba3dff84264987be2d8f7fba2b96322ffb1c0b8d72 |
File details
Details for the file Advanced_Descriptors-2.0.0-cp34-cp34m-manylinux1_x86_64.whl
.
File metadata
- Download URL: Advanced_Descriptors-2.0.0-cp34-cp34m-manylinux1_x86_64.whl
- Upload date:
- Size: 214.5 kB
- Tags: CPython 3.4m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3b1de7183fb40efe72225b863a96ab6459d5896ec30f99d7ea5f96d0d9dd44f |
|
MD5 | 77e8ed4220af984412fe7d700d661d58 |
|
BLAKE2b-256 | 0f3a15deef0f638057c1df24831c5ad010ea73ff75ccc4d1299d19d184801132 |
File details
Details for the file Advanced_Descriptors-2.0.0-cp34-cp34m-manylinux1_i686.whl
.
File metadata
- Download URL: Advanced_Descriptors-2.0.0-cp34-cp34m-manylinux1_i686.whl
- Upload date:
- Size: 216.1 kB
- Tags: CPython 3.4m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7db2f9dca439bec15a021acf8ac02df30a19ac45c5157cf91c950ef74216a4eb |
|
MD5 | 204a74c8c9d3ab6ce3fdc23e2e1b325b |
|
BLAKE2b-256 | eab8456bd527488b205ce1bba4db81f0f4bd1f15b5eea6631dde9ca2fb7ad554 |