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. Test environments available:
pep8 py27 py34 py35 py36 pypy pypy3 pylint pep257
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-0.5.3.tar.gz
.
File metadata
- Download URL: Advanced-Descriptors-0.5.3.tar.gz
- Upload date:
- Size: 111.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd82fb0b4f0abd04e38cefe2080ad0645fb73730f1521d7230e557fd3d0540cb |
|
MD5 | 8dc61ded514e3a491a55332cd79e75d9 |
|
BLAKE2b-256 | 4715f4a520131142c213ffe69d247d10fd03b2665574812876b950c1db639c4b |
File details
Details for the file Advanced_Descriptors-0.5.3-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: Advanced_Descriptors-0.5.3-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 249.6 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36c3a7276dc7add984b9ddbc226ab2f3775c7c7ee86d5dc08fc0673346fb4dc7 |
|
MD5 | 2f87ea78d0fcfa8c460dcfc4e2ceadae |
|
BLAKE2b-256 | b08b30d69be33024a857e2bbba4993dd02835786753a99d98bbe03b1d90fa825 |
File details
Details for the file Advanced_Descriptors-0.5.3-cp36-cp36m-manylinux1_i686.whl
.
File metadata
- Download URL: Advanced_Descriptors-0.5.3-cp36-cp36m-manylinux1_i686.whl
- Upload date:
- Size: 232.5 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65af430b75ac34549e567ea964a3dc1f816a0586c73449d2a4c1f85a60125e53 |
|
MD5 | f2c31dabdc7518251bb3c06e1ef8d41e |
|
BLAKE2b-256 | bdb46ed80046bcd9a896699b4b7e87738341a25493cf66eea000f67ade537d72 |
File details
Details for the file Advanced_Descriptors-0.5.3-cp35-cp35m-manylinux1_x86_64.whl
.
File metadata
- Download URL: Advanced_Descriptors-0.5.3-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 244.7 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fac26d0138aa1f7f1aa64513062201943a2e272eec4d2f368da05f5ae7cc54a |
|
MD5 | 1f6f16b4d1dcc4b0dac30ae6981da141 |
|
BLAKE2b-256 | 62c0e1aa99cb5b9d4f7ed17a07937a5beee93dce678f593cdc0b0e476120003e |
File details
Details for the file Advanced_Descriptors-0.5.3-cp35-cp35m-manylinux1_i686.whl
.
File metadata
- Download URL: Advanced_Descriptors-0.5.3-cp35-cp35m-manylinux1_i686.whl
- Upload date:
- Size: 228.3 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 812aea6f1903f178058694eaf394c629fdd5bd83f88b0387f71142b6298c3ab6 |
|
MD5 | 7b56937cd8696310aba8f501354fa01c |
|
BLAKE2b-256 | 5e05c67615ebead37430efb8331f788bedcd9908e3491589742f185fac4541a8 |
File details
Details for the file Advanced_Descriptors-0.5.3-cp34-cp34m-manylinux1_x86_64.whl
.
File metadata
- Download URL: Advanced_Descriptors-0.5.3-cp34-cp34m-manylinux1_x86_64.whl
- Upload date:
- Size: 248.9 kB
- Tags: CPython 3.4m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f3e462d06c7e0007a092ad2aba6fb482a0826c3751d6bd2b48c1be45ad2bd3f |
|
MD5 | 36c13e8f0de21f09fd33efa46e9220b7 |
|
BLAKE2b-256 | 8be3fa13435e6894da5f09b40ede26c4eaa8e4829d61264f01e752f93a991c24 |
File details
Details for the file Advanced_Descriptors-0.5.3-cp34-cp34m-manylinux1_i686.whl
.
File metadata
- Download URL: Advanced_Descriptors-0.5.3-cp34-cp34m-manylinux1_i686.whl
- Upload date:
- Size: 231.7 kB
- Tags: CPython 3.4m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fae2615aa5a8345c0778ce0fc6eb784071eed411dcc6a476560f73c1da1c1243 |
|
MD5 | 7c78ea9634d39c7df838c1322bf0c7fb |
|
BLAKE2b-256 | a25bc1e09ec251d39b109439e743c9e74b7a294d32dc1690b2afa54fe5701be7 |
File details
Details for the file Advanced_Descriptors-0.5.3-cp27-cp27mu-manylinux1_x86_64.whl
.
File metadata
- Download URL: Advanced_Descriptors-0.5.3-cp27-cp27mu-manylinux1_x86_64.whl
- Upload date:
- Size: 229.3 kB
- Tags: CPython 2.7mu
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fff0f9f92850423ec61d0ca6dfe967598d78c142205f7581374f0a2a7d0d9bfa |
|
MD5 | 6e4b28bcf7810cad10f6cf191d7de793 |
|
BLAKE2b-256 | 2371feef4f66c850425445dfad4e9cadc72b280c3acfad046b3dac0cb6444617 |
File details
Details for the file Advanced_Descriptors-0.5.3-cp27-cp27mu-manylinux1_i686.whl
.
File metadata
- Download URL: Advanced_Descriptors-0.5.3-cp27-cp27mu-manylinux1_i686.whl
- Upload date:
- Size: 211.7 kB
- Tags: CPython 2.7mu
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7279127f6d5444ddf4849a1c78c67eda3f896bca9aff80ebbd7bff92bf3f593d |
|
MD5 | d3c0cb771ed10aaf638d953aab2ee2d3 |
|
BLAKE2b-256 | f54f841f631b27a2bbeafdbb816093403d15ffe4ef78fa558a9fe32cd111235b |
File details
Details for the file Advanced_Descriptors-0.5.3-cp27-cp27m-manylinux1_x86_64.whl
.
File metadata
- Download URL: Advanced_Descriptors-0.5.3-cp27-cp27m-manylinux1_x86_64.whl
- Upload date:
- Size: 229.3 kB
- Tags: CPython 2.7m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73860cd5d169d5091855d7c0cd17efafecdb80486c23049b3121951374a3d34c |
|
MD5 | c0e706207438ca679ea8c75dd9561663 |
|
BLAKE2b-256 | a9a2a03840933dd67bbe4fb1305a269a2d87fae518f466b44a1c6a2035cec2cb |
File details
Details for the file Advanced_Descriptors-0.5.3-cp27-cp27m-manylinux1_i686.whl
.
File metadata
- Download URL: Advanced_Descriptors-0.5.3-cp27-cp27m-manylinux1_i686.whl
- Upload date:
- Size: 211.7 kB
- Tags: CPython 2.7m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c573ac88a1c7b3b8386f563c33e671bea6653d4d01b97a9bdae36ec5d87f7229 |
|
MD5 | aa16004d0e4352ccad50302a435869cc |
|
BLAKE2b-256 | c5e2a84f849864e4a498b16bc93a49f5b0c2d392c5025b080a2195dfa031ba2a |