Skip to main content

simple class for have hybrid class and instance methods

Project description

chibi_hybrid

https://img.shields.io/pypi/v/chibi_hybrid.svg https://img.shields.io/travis/dem4ply/chibi_hybrid.svg Documentation Status

simple class for have hybrid class and instance methods and add class properties

Features

from chibi_hybrid.chibi_hybrid import Chibi_hybrid, Class_property


class Dump:
        __bar = ''

        def __init__( self, value ):
                self.value = value

        @Chibi_hybrid
        def foo( cls ):
                return cls( 'cls' )

        @foo.instancemethod
        def foo( self ):
                return self.value

        @Class_property
        def bar( cls ):
                return cls.__bar

        @bar.setter
        def bar( cls, value ):
                cls.__bar = value

result = Dump.foo()
assert result == Dump
assert 'cls' == result.value
assert 'cls' == result.foo()

result = Dump( 'cosa' ).foo()
assert 'cosa' == result

assert Dump.bar == ''
Dump.bar = "cosa 2"
assert Dump.bar == 'cosa 2'

History

0.0.1 (2019-10-31)

  • First release 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

chibi_hybrid-1.2.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

chibi_hybrid-1.2.1-py2.py3-none-any.whl (3.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file chibi_hybrid-1.2.1.tar.gz.

File metadata

  • Download URL: chibi_hybrid-1.2.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for chibi_hybrid-1.2.1.tar.gz
Algorithm Hash digest
SHA256 9ec3a1c0b3ee0c3b8ab9940b251bd7ae57e8311d463abd4f71dbc6d85e0c2a71
MD5 74c5b6ebd386b7cbe969a2b60632c2be
BLAKE2b-256 01c48e0f531acc73c33fffc6cb8b831332c3ffaabd99450211992347624c63de

See more details on using hashes here.

File details

Details for the file chibi_hybrid-1.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for chibi_hybrid-1.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ebc360b25cc752d4626c6c00c6eec856f107b3c8899a0b7f5c02487818b6d00f
MD5 c1830476c4b16182465bfdfbc9cb8f18
BLAKE2b-256 7f8914cf0f8295e339bb5e5b1909396895d001b2fc5e038d37e893d10c21e342

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