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.
LogOnAccess - property with logging on successful get/set/delete or failure.
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
LogOnAccess
This special case of property is useful in cases, where a lot of properties should be logged by similar way without writing a lot of code.
Basic API is conform with property, but in addition it is possible to customize logger, log levels and log conditions.
Usage examples:
Simple usage. All by default. logger is re-used from instance if available with names logger or log else used internal advanced_descriptors.log_on_access logger:
import logging class Target(object): def init(self, val='ok') self.val = val self.logger = logging.get_logger(self.__class__.__name__) # Single for class, follow subclassing def __repr__(self): return "{cls}(val={self.val})".format(cls=self.__class__.__name__, self=self) @advanced_descriptors.LogOnAccess def ok(self): return self.val @ok.setter def ok(self, val): self.val = val @ok.deleter def ok(self): self.val = ""
Use with global logger for class:
class Target(object): def init(self, val='ok') self.val = val def __repr__(self): return "{cls}(val={self.val})".format(cls=self.__class__.__name__, self=self) @advanced_descriptors.LogOnAccess def ok(self): return self.val @ok.setter def ok(self, val): self.val = val @ok.deleter def ok(self): self.val = "" ok.logger = 'test_logger' ok.log_level = logging.INFO ok.exc_level = logging.ERROR ok.log_object_repr = True # As by default ok.log_success = True # As by default ok.log_failure = True # As by default ok.log_traceback = True # As by default ok.override_name = None # As by default: use original name
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.
Azure CI: is used for functional tests on Windows.
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-3.0.9.post0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d6b2a8a63d15f026abd526169ee62eb7c3b7210f38d116db3768043bee140cd |
|
MD5 | 93b64ed098bb7b5fbcd4fbc18a3cd6ab |
|
BLAKE2b-256 | 58c0a1a428998ff0984c57c6a6b6e67663bece7977831a6368d91a0f351e0329 |
Hashes for advanced_descriptors-3.0.9.post0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27d3fe8e2b5a032bccb10932be80a6172356d24532fc2bfb5e52e08b87e80c56 |
|
MD5 | 7e188d192f38f5dea511c809d74b6f9c |
|
BLAKE2b-256 | 6299efeb6e1bbdd5b3291b4300682d26777d2b58f3e3ca5d87c81bd0fb051c63 |
Hashes for advanced_descriptors-3.0.9.post0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62c36793867d82d54cb4ce9c102d43225cdc1ba7b9ee4fc3ba58a2cb0b4fc456 |
|
MD5 | 7cd6a610a5a48bb3d8611ffb34ea9263 |
|
BLAKE2b-256 | acea3d5c0eba00a2fca89c1e3c6d38a710551d2af22786489910f88da92ace35 |
Hashes for advanced_descriptors-3.0.9.post0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29780fb5ac3867b964d1f44b45fb0bd37e1829aac47039f7d9cb3041c3b94553 |
|
MD5 | 831a46dda3460303d7da71ae2616f599 |
|
BLAKE2b-256 | 07a66bd48bcd449e3ca4c8d74a673ca1badbd9487f6c9ab41b0c110ee455d58f |
Hashes for advanced_descriptors-3.0.9.post0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 049008bd6b3c64d8dbd3c680834e6b8586cdad456e4bcbdb52656d21c7db064f |
|
MD5 | 108eb0c77b45e23ba50344b2363d8fba |
|
BLAKE2b-256 | d49ffb4d7650694704d9b70b4b6a750849587175c1825707205061ba76ff3034 |
Hashes for advanced_descriptors-3.0.9.post0-cp39-cp39-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b65329c8b9f7374f3e0872a06bf03e9a5453a7decf178a39ea809c474fdbaed |
|
MD5 | 40a5b04667947996654ba8f1db108a54 |
|
BLAKE2b-256 | fb231cbd44e88f9d27d9bc05f0e35bcd4aaed494cd8a7f1c5ad2457bbd5e1a61 |
Hashes for advanced_descriptors-3.0.9.post0-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95d785ba42f64466fd2074252f4f2ba43f1cfc4333c33308d4c54e18242e3cc4 |
|
MD5 | ccd720b693fb59d5cae0ac42992ea27d |
|
BLAKE2b-256 | e4ef8efab03f00e8676ccd2a6df5dd6ba1d0f06ccdd0cf2994e02c3199ce2ae8 |
Hashes for advanced_descriptors-3.0.9.post0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60b79dca21144ae5f3c7f712ecb085f0bec00ba449e86b5e25e17e0c224b6039 |
|
MD5 | ce0560646050e219429c586ea78840a0 |
|
BLAKE2b-256 | 9d26ef040d6d3691c3010e237740d179cf14f1f1f32aec2749e805162087a9ba |
Hashes for advanced_descriptors-3.0.9.post0-cp39-cp39-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58371ea2a298ed1f17098923619c9c5094b980d402ca6fca2339cfef1504cc13 |
|
MD5 | 6b4531cf737ed65cfebfc582c80d3aa0 |
|
BLAKE2b-256 | 0a38a6d130970b9923f20d3686c72212920d4d2421d3e714f21d17eb40a35bc1 |
Hashes for advanced_descriptors-3.0.9.post0-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae61230e2e3178dfbc20e03c741fd4e3c011c8dfa78a8780c217afeaf72c2ba2 |
|
MD5 | bf903bcdd21a187e9727beb1834a81dc |
|
BLAKE2b-256 | ebe723fd8cdec2a0c1c55733a025ddf8f860bf740b0b08f02f382b60f014573d |
Hashes for advanced_descriptors-3.0.9.post0-cp39-cp39-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d09d08c50745fde049c3379aa3914d3daae1548cadfe5a9741284ecb00a378c9 |
|
MD5 | 493929146395e29ef176e6d497f89ba5 |
|
BLAKE2b-256 | f0ac9319765338563f593c722725623a4fd63fd13c0f4373c45c36faf58ae577 |
Hashes for advanced_descriptors-3.0.9.post0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad3923c8f6ca0bcb0b2e8f5c7f9868270e1b1bb86824f11c79972edde0d184db |
|
MD5 | 316e572d6ab4d098589cfa52011cd751 |
|
BLAKE2b-256 | 327ec44367f6f5c486d2da55f059f81a41f88acceafe42d81efa8b3816964446 |
Hashes for advanced_descriptors-3.0.9.post0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bb766b74005fe0eab4674f25e54d50c679b1c61bb613ceb8d8348ab5fc5e77a |
|
MD5 | 1a19c4c14ffd59b81ce35cd75f9d94d8 |
|
BLAKE2b-256 | e1e6f3f0ae9447fa6851b3dd25529fd2bc6b3dfb84e466556f8e86228708d837 |
Hashes for advanced_descriptors-3.0.9.post0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1969c77eafc0ecb88926be27d4333c648054ec97c38db2fca5945a281d7b7222 |
|
MD5 | e5fb76de235c03084006a3d95dd496d3 |
|
BLAKE2b-256 | bd86fbad311f34afe25c2c8e5c1700f32cfd0a28326cfe756dff3773cffb2640 |
Hashes for advanced_descriptors-3.0.9.post0-cp38-cp38-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 281b9020fc8ca93ad1ff8f7f06fab03711b9729d36deb562d0844d31e406f8c8 |
|
MD5 | 5d7598f8e53e274fa83ffe8cf361b5db |
|
BLAKE2b-256 | e20d82aa704ef9a9ca60c953f7c1441f3c661c75076808dc84a3d260dcec4ab1 |
Hashes for advanced_descriptors-3.0.9.post0-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b94ec3110db418f0b527467f262991f5fa1556cff4aa4866194abed69af6c0d |
|
MD5 | 4064e492044e83265782e363b8c1ca6f |
|
BLAKE2b-256 | 410d82421b8191e7094c71282b5e98b6beb5cd98594be8d2f862d1d973d97679 |
Hashes for advanced_descriptors-3.0.9.post0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f6ac9c8f600bd47a2e51b7b8c8b5c898244666c819182e09784edeea95f6c46 |
|
MD5 | a06c127fffa1ab4f6ef3816f8e2b4e28 |
|
BLAKE2b-256 | 70a88a5516032484ded81c21e67ffd33915e5225309e617e3c39976f6024adaf |
Hashes for advanced_descriptors-3.0.9.post0-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6984c44231563b2f64f79bfa1b9ea96a5b191a6ddfd47982433667d0c5d7c6d |
|
MD5 | 42a184029628b4cfd77128df336a1ee4 |
|
BLAKE2b-256 | e8f201320ccfcd9272cc83d706b3be29745fcc5b3d3f76dcc0d81ba33e06d91c |
Hashes for advanced_descriptors-3.0.9.post0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 650b6aaeb800ef1b0244488c504dae21236b158c315e0ba0d33346000a8e7f51 |
|
MD5 | 8f04a3cb8e9a796845366e0b0bead48a |
|
BLAKE2b-256 | 51f7cf106be7b340094bc46562b9ca707d18359f86fcd183a26f2c0fa4703b7a |
Hashes for advanced_descriptors-3.0.9.post0-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eae5e853bba70733f20d7004979894c40877e3c11c5bbba86d2374a704fcd50a |
|
MD5 | b6a418462486922af9260d555f4902ca |
|
BLAKE2b-256 | 01fc09903e1431afc72001d9b387d005e3d4bb6ce6b6c5a0c586d4ca7bb50301 |
Hashes for advanced_descriptors-3.0.9.post0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79f50f39f56677069d85cec57fb6745589ba7f76b4f315966b9566637a6bd2ab |
|
MD5 | 3649e28dba8ff9c4c3cd420617486f20 |
|
BLAKE2b-256 | ce6e71fd997a450bb650bedb81981a64d1649319f001f98b739be7450698c0ea |
Hashes for advanced_descriptors-3.0.9.post0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a3c8dc7720d967fafd1a48f7f2c32a9117b1d65f9c61036b42b96df059cf1f4 |
|
MD5 | 2ec58b3cc73661eae8cf98b665f09d8b |
|
BLAKE2b-256 | 7cc20b113cfaf373fd370cd720966056c133c5ec3a71de85e2f1f47b0e753fc7 |
Hashes for advanced_descriptors-3.0.9.post0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5fbc81eef3661a208c93952eafcbc729887ce2d1e552abc1b5f65c1c688f771 |
|
MD5 | 12c960a364d93dd2b678ff4443ef973c |
|
BLAKE2b-256 | bb6c51027e9a98cf99e8172b9215b22be9515994b3591856c817b6e10395a60b |
Hashes for advanced_descriptors-3.0.9.post0-cp37-cp37m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 037927da70ce7fcec44a1c77be86199e8a3f3f496ecee1a711887991a5d0b631 |
|
MD5 | 1e75a7af077919277951ec555f0717f3 |
|
BLAKE2b-256 | 15c42a1c2950ba9945c753379c4758759133d271cb57a1e41fd0cf2ac0b102cf |
Hashes for advanced_descriptors-3.0.9.post0-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2332416e103a75d3e8e459be677a849d8801a963109b767a8564b76fdf12bc9d |
|
MD5 | 8a42038e32fcc149a15c0e0717a62148 |
|
BLAKE2b-256 | 46e510d425397d197cfba3ba0b898187369c71aac8790080c4ce66bbcf78b4b8 |
Hashes for advanced_descriptors-3.0.9.post0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f38f2d4c798d00c5fc7d7c6395d1eb73042c890d28ad6d308348cfdd6e76f5c |
|
MD5 | d31b1fa2ab8ccad11ada3980c5e98fb4 |
|
BLAKE2b-256 | a55c21ee6fde2fd792a13344da00ebfdc0e235d7a30af03240b413a7a6fa5055 |
Hashes for advanced_descriptors-3.0.9.post0-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 943a011b4f571576df4af5a162daf861bbdc91e6fa020b9672ec31d5782d6f27 |
|
MD5 | f229c667d5b85ebddad2bdc61d83e16d |
|
BLAKE2b-256 | a23aaf9f8fcc59589e9b81f727f3a100acd03b5b04d3909c1d34f46c093c6866 |
Hashes for advanced_descriptors-3.0.9.post0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f632e3dc441e24f4b7a9c4f4f1e2469eee19e1c106fff75398d5411d5095ab8 |
|
MD5 | 08fb1a081e3dcf40bf836f468e7099e2 |
|
BLAKE2b-256 | e43e18a5f01879e629e6b3d1b74543471d080ae0418b1e607151b13f09302b4d |
Hashes for advanced_descriptors-3.0.9.post0-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99ef7502ac29b8fa239014e924f74987d7f796606433859d7aa5da23b0259a7e |
|
MD5 | e4184a3f14a0077a035704e58cea764a |
|
BLAKE2b-256 | f899b83cb349f382872144e28c26d9289e485f6a591eba7d60ceb055babe6287 |
Hashes for advanced_descriptors-3.0.9.post0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f95f301d148c5407fe59adb14370812046f19e490a2eeb948a6f63eff4715903 |
|
MD5 | 57a6f816493b9fea7f79036ed855584f |
|
BLAKE2b-256 | 128d172280a2032814b4379f80cca35d2c48467feb32310b6d6b8f01c3882107 |
Hashes for advanced_descriptors-3.0.9.post0-cp36-cp36m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aaf0edb86161a38d56c9447379ad879d4f4aadfe11a4bea2838cc7886f0d193 |
|
MD5 | cca3d650bc90216c1396198df82e1199 |
|
BLAKE2b-256 | 6b8025ff4a1684c0d8c1c8e3b00cde57f2066d1c2176c4eebc9380cd54114272 |
Hashes for advanced_descriptors-3.0.9.post0-cp36-cp36m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f689f351b777010b993f4446a565aa625ed6e69e95662a26f2547fa62f37a69 |
|
MD5 | 78559fdb8eb31a309edd3b6dd6a924b2 |
|
BLAKE2b-256 | b2e36e7eeef26ba62d1ff54725432580461ddba6cd39fe6cd7d6123cb610246a |
Hashes for advanced_descriptors-3.0.9.post0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac4a8cae80c8e1e911d6eb82ec8d2d0fb56fa91eea458c4fcf75852f9519262c |
|
MD5 | e7b697b3db943a2b78a7f9f07089c8a7 |
|
BLAKE2b-256 | 3ee0152e3a034da06e16b6d671a89eec4c88026913b6f8cd3541d81ea28dcaa7 |
Hashes for advanced_descriptors-3.0.9.post0-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7da1959bbf747b136d2a94f041a1934e24b0ee728ca2a987130d0eac9209e71a |
|
MD5 | 00af70d10202e9128297e40658b4f6a3 |
|
BLAKE2b-256 | af8a9092421244a2975d481711132d22498ac6b01e19562c5e8a46f9e7a3139f |
Hashes for advanced_descriptors-3.0.9.post0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efca7d742b85b87d49d3067fee4f1ce9e4825b4126fc077e0727c12ccc1aed0b |
|
MD5 | 8f217bed1f0511e77e8f6600f5ac4378 |
|
BLAKE2b-256 | a8646d2726341d07460e0497e2c0e7bd78481c1d3d1e55b497b4e15762da3acd |
Hashes for advanced_descriptors-3.0.9.post0-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef2f0b3e49c40d4eb43db9a53a0be368ea309b17ea98973208f059f9505efef6 |
|
MD5 | 2b034583272208c725cc69997e31d479 |
|
BLAKE2b-256 | 26e6220946107dd1c48106ede69e00bf04424c7515f4a12c8765ce3fb1fc2b09 |