Skip to main content

Advanded descriptors for special cases.

Project description

Advanced descriptors

https://travis-ci.org/penguinolog/advanced-descriptors.svg?branch=master https://img.shields.io/appveyor/ci/penguinolog/advanced-descriptors.svg https://coveralls.io/repos/github/penguinolog/advanced-descriptors/badge.svg?branch=master https://img.shields.io/pypi/v/advanced-descriptors.svg https://img.shields.io/pypi/pyversions/advanced-descriptors.svg https://img.shields.io/pypi/status/advanced-descriptors.svg https://img.shields.io/github/license/penguinolog/advanced-descriptors.svg

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:

  1. 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
  1. 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:

  1. Travis CI: is used for checking: PEP8, pylint, bandit, installation possibility and unit tests. Also it’s publishes coverage on coveralls.

  2. AppVeyor: is used for checking windows compatibility.

  3. coveralls: is used for coverage display.

CD system

Travis CI: is used for package delivery on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Advanced-Descriptors-0.5.5.tar.gz (110.3 kB view details)

Uploaded Source

Built Distributions

Advanced_Descriptors-0.5.5-cp36-none-win_amd64.whl (62.4 kB view details)

Uploaded CPython 3.6 Windows x86-64

Advanced_Descriptors-0.5.5-cp36-none-win32.whl (55.9 kB view details)

Uploaded CPython 3.6 Windows x86

Advanced_Descriptors-0.5.5-cp35-none-win_amd64.whl (61.9 kB view details)

Uploaded CPython 3.5 Windows x86-64

Advanced_Descriptors-0.5.5-cp35-none-win32.whl (55.4 kB view details)

Uploaded CPython 3.5 Windows x86

Advanced_Descriptors-0.5.5-cp34-none-win_amd64.whl (58.5 kB view details)

Uploaded CPython 3.4 Windows x86-64

Advanced_Descriptors-0.5.5-cp34-none-win32.whl (54.9 kB view details)

Uploaded CPython 3.4 Windows x86

Advanced_Descriptors-0.5.5-cp27-none-win_amd64.whl (58.8 kB view details)

Uploaded CPython 2.7 Windows x86-64

Advanced_Descriptors-0.5.5-cp27-cp27mu-manylinux1_i686.whl (186.7 kB view details)

Uploaded CPython 2.7mu

File details

Details for the file Advanced-Descriptors-0.5.5.tar.gz.

File metadata

File hashes

Hashes for Advanced-Descriptors-0.5.5.tar.gz
Algorithm Hash digest
SHA256 36cf41525ec417cb01c70bf101bd49493ecef6befaceaaaa6ef35f7a4facbfa9
MD5 691a883f81268256acc0b3c7d8d17142
BLAKE2b-256 dcfb9894901b5b660edb8df7aabdb04cedfce813822b2980cc36fa2e1473697b

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp36-none-win_amd64.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp36-none-win_amd64.whl
Algorithm Hash digest
SHA256 f82bdea4dbbb461a1972af5cb213586c73db4e49ea6fc525eafeefecb701303c
MD5 09d1872ded89589f6ee5757b6146a562
BLAKE2b-256 4c065bab0faa93b63cad60ee0eaffaae5c411158de284a607f80821c689bb7a8

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp36-none-win32.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp36-none-win32.whl
Algorithm Hash digest
SHA256 c7d37d968e0c8a27e4fb2689586d03fb7a184963c9e32de553b7a60220f8fbd8
MD5 cd366de09bd682db7c4106ec844efb65
BLAKE2b-256 1505395e96e47e465426472daa89ef79172a3b3e0372a0dc81ae8556e9106505

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fdd4a9bef6e847c82fd9015f219458212fda707d238fdf2836eedb7be85315a9
MD5 1e961367db9bff35a2da8774d560743c
BLAKE2b-256 437164c10c0a146069d0b6322dc80f5fe4ea0a4cb8749310b72c8ec9639c9d7f

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp36-cp36m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 891ead696b259f3306b71a9a9ee5a3ad3d97c308b5febd9719ae882c4c007873
MD5 097996b80f5c3b506072fe512a7413ca
BLAKE2b-256 5188b2232443c02bcf68285ebfa002bc7b5355a3189c9ccb5b14a2dfbdaffd40

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp35-none-win_amd64.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp35-none-win_amd64.whl
Algorithm Hash digest
SHA256 7db20185cacf46f2272159baa72ae73cd8167ef74ddc5553473527876d46985b
MD5 bc0edde06e21ac0ef36815384f9f6069
BLAKE2b-256 ef95302bc34fc25f93311b797fe0dc0aed35904912f410a71fb9509bb48cb3e3

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp35-none-win32.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp35-none-win32.whl
Algorithm Hash digest
SHA256 a4f7c3330058b81cea9869df95d97b25636972be387cfb168004b542c69ff893
MD5 1b5202fda49ed426660d2abfadda32cb
BLAKE2b-256 8618f6388b95e88909fca9fdf8919a9aff063999a2db5d829e1f28f8a6bc1695

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a8dd48a455f3efb6d94d99d90fb792976eea4c5d0149eee1b44a9f20f7030cf8
MD5 dba70a8ba8d6f22d4b9dd6fa1fba1651
BLAKE2b-256 60c77e493322ef7465c46108e645c194024242e8ec5063c5821be12eb77b2412

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp35-cp35m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 fd62478b859ef54405bafb725338d672d614177411a65aba5a86572110eda8c2
MD5 4470adefcf272946221df7e711e29932
BLAKE2b-256 1ad7816f9880237db1549c92e6b554c32e7fe6f2c0183fd86031f764e18f22a4

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp34-none-win_amd64.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp34-none-win_amd64.whl
Algorithm Hash digest
SHA256 f1cf660fa0f36c7e89e7669f97e78f745fa04f8f906459079ca7a692d98709ec
MD5 1a7e0326d07efc8ccc2898d817c5177e
BLAKE2b-256 7a5218b16a779c94de26921afcc7bd3334ab09621593a8d6c8c3379a4fde9fdf

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp34-none-win32.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp34-none-win32.whl
Algorithm Hash digest
SHA256 b4d78e23f2fd02550751dd9f4c540d4ca4cf18bd8837e63212efefaf87ca8c51
MD5 209c7d5120077ba5840b162314c61824
BLAKE2b-256 daa02cdea785ac149b57467c0534bc6e45cc65218455f9c0f94b7de6da385b68

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dfac92bf3da0b2d8df8b821c89285d539280d9ba441e5e636a1a88f68df21034
MD5 eea60dda1a620554eb8fb553c33a4a53
BLAKE2b-256 b93d4a29fc81855de6155cd83363555304adf130628401953821734a06d19517

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp34-cp34m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp34-cp34m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 022de3fedfc382160bee7ed173b0700e59d1fc7406e1a466ed1640be230bda6f
MD5 1f009d1fe893ef08248074134b1fb6cb
BLAKE2b-256 1be1e6a3548d3a18625e79875e16eb33588e060269962d1bd9790f29e1324018

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp27-none-win_amd64.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp27-none-win_amd64.whl
Algorithm Hash digest
SHA256 ba557dc7b2a22d868a40374f2a6a336de7eb1ebd5676cd714a13798b84c7b043
MD5 980ac0d7e1ddc5a2b2d5a11ef87e172b
BLAKE2b-256 dbfb94fd48b66a2ad58f23b5100dcfe9aa1886d1f9a363deb06524dd4b1f1a73

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ec283a54a1944bcb977a3d962f40f336613ed468abd8c92177ab6e0f68e065b7
MD5 63cb28ef0e508d5b973a1fb1674a0def
BLAKE2b-256 bb31c5af2e2410d1cd5588d9be73094c2e9953d89ae90d61d92a9d224284c07d

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp27-cp27mu-manylinux1_i686.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp27-cp27mu-manylinux1_i686.whl
Algorithm Hash digest
SHA256 d655aea941475d987eb547e2d408a54905a90ef3c58e63a77d9a8a3f9806b89b
MD5 b8fb4d4e59ae56911c10c625bd0499e8
BLAKE2b-256 d277e47be4d4c6ad049eba420c36748aea91acc191a39ed024b801b10ebd3303

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a51a9ed7a1eeff5185b2847a8c3dd4ad13115a3e57f9cb663489d0506fd5e455
MD5 647492eb8d35992473e4f268ec3aca94
BLAKE2b-256 217d21aeb4e4744596d502277232b1eebb2b9c2310d0556e42fc3950d2900987

See more details on using hashes here.

File details

Details for the file Advanced_Descriptors-0.5.5-cp27-cp27m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for Advanced_Descriptors-0.5.5-cp27-cp27m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 76a3fc6ddede16f96c970cabd5b53384aae55e633ddc17a8786ddb97069c027b
MD5 6c5fdc3857d1f61310f62953aa991dd3
BLAKE2b-256 2a10f56793b15a25dca8824fec4df0ff8c87d42bbffa9cf1bcd08dc7fd9b537d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page