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.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

chibi_hybrid-1.2.0-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.0.tar.gz.

File metadata

  • Download URL: chibi_hybrid-1.2.0.tar.gz
  • Upload date:
  • Size: 9.0 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.0.tar.gz
Algorithm Hash digest
SHA256 470803b0e54456cc4c7f8df9ad73f81f50578480afc3cc049c88758fbdcd6b57
MD5 6cf7a89c69d9edc6831f9ee4fe0082b8
BLAKE2b-256 111fbcbf43517c64a289ea2e48884e49877fee79a93029705ecbe1cadde720ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chibi_hybrid-1.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 90e2074a93209f1884bdcf8d752ee03a98ca3427d1ff6037b6f9e8373f91801c
MD5 157f848d2076e460152224011a37bde4
BLAKE2b-256 7c3cd006fe671664148931bbba605cfc21faa9ed90c635984b413d17bcf18332

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