Advanded 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
Hashes for Advanced-Descriptors-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d2a5cfaa7f5f11ec116a5fb54ce66693ff198c927517fdc326c107f172ff605 |
|
MD5 | 783b48ad79c58956191564b43cd58a05 |
|
BLAKE2b-256 | 203415826def7fefa47299e400113e5e4232b6a2c611ef829c3b3dbdb1431117 |
Hashes for Advanced_Descriptors-1.0.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 052a83afd3ee4aa8d6d6aa54f96eb128116c4c3c339db418884ef4383840a6ab |
|
MD5 | d6d0e00ac4d3e837c672e0708e042d3c |
|
BLAKE2b-256 | 77557dc27286ecef7a830153ada9e00007323581825951886b55b926d022257b |
Hashes for Advanced_Descriptors-1.0.0-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b329f55930d8fac48ccabe43ec00d50f5ae2931bcd524d789f8fe76d679bd7c |
|
MD5 | 121577914b2191a3cc71bfda568f0a6e |
|
BLAKE2b-256 | f1dbc05ece3a8a54134128c8a0da5e0210c5668a7b3a1875675f009bddc80cae |
Hashes for Advanced_Descriptors-1.0.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7257d8c38b02abd5f6b16fd856f7b70acf27c1d2bee37bc2d6b3ae883ec95350 |
|
MD5 | c2199e23d4631c4b9f7aece2e7e4eb13 |
|
BLAKE2b-256 | 22739cace69281a589f306cbc690cb0530b9cf93bf9798722e86d056b1addbfe |
Hashes for Advanced_Descriptors-1.0.0-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 146194818288243d4351cdf7ce7d32851b2b3c0b2aabad5b18c148e54a09cad6 |
|
MD5 | afaefee055904d862e53ea3c350232a0 |
|
BLAKE2b-256 | 61ee1c14b8f2c88c10b60f5a24749d1733ef23376c627cf720557f3351abffdb |
Hashes for Advanced_Descriptors-1.0.0-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c7a35888476f975ac0e50996cd44faefd0d767d8bb7e8da25fa07ad2f377d18 |
|
MD5 | 61d8b29519f70a15853ccf63bf840861 |
|
BLAKE2b-256 | 706dc96168ae98b49b63fcfb31f2c7b79cf2b0881be1e7248dd20eac5241b0a2 |
Hashes for Advanced_Descriptors-1.0.0-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 086f361ed03a1a024783b28dacb5863539b5a474b4b405cbfd11f494518b41ad |
|
MD5 | abb2d3e8332bd4ac7af76ee720ced454 |
|
BLAKE2b-256 | 338fd3bac561e89bcc1d3a10c66a5efc79d77ff5720b76cea73226344a41af82 |
Hashes for Advanced_Descriptors-1.0.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f4fcb09bfe432dd779e4519d587827be7e8675824bdbf546f4b939f4b625a4f |
|
MD5 | fb30a22558959870f40e1d1bdd5e2e14 |
|
BLAKE2b-256 | 386ebfd362dd13d1171a03f804ea30b1ace9e3608811eff3e92529509e831b3d |
Hashes for Advanced_Descriptors-1.0.0-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab4e12c29243a6931ebc36f4a383a0cd854856a9c5213b8a2ec1f5d9796cc6eb |
|
MD5 | c554f3a9e4b069393d0357ea3ef29a03 |
|
BLAKE2b-256 | 57ed788658600ac4efcf2a9238fbd7557854c4f4ebd210f62cec6b838c32abe2 |
Hashes for Advanced_Descriptors-1.0.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e965eaa4f6503fd1f6c0dc4f9c19ef581e94e689544ec83ea39908bdc6051459 |
|
MD5 | 572e5840b6c4ad915af440711cb99d99 |
|
BLAKE2b-256 | 8c0c0aa5a7ac87dcfdb483ca2651792d6f91ffce232aafdd00ebe496ae96f503 |
Hashes for Advanced_Descriptors-1.0.0-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8e2c48d8f34c794679a556a1aa22187013df9142a08f5021c00eaa1142faab7 |
|
MD5 | ed0e0c1b71943e91335c625b70588e76 |
|
BLAKE2b-256 | dabeca8de1c0d696499987b92074c1ed736f85900c82ef9de1a58572cb158845 |