Skip to main content

A "sticky" wrapper for any object, that allow other objects to be add as propeties, which can be access through the .key notation or [key] notation. To unrap the object just add () notation to the end of the function.

Project description

Candy Wrapper

Candy Wrapper is a "sticky" wrapper for any object, which adds syntax surgar.

This wrapper wraps any object, and give the ability to add attributes to the object like a dictionary, much in the same way that pandas dataframs work.

Installation

You can install candy_wrapper with pip:

pip install candy_wrapper

Or with poetry:

poetry add candy_wrapper

Usage

from candy.candy_wrapper import Wrapper
foo = SomeClass()

# Wrap an object
candy = Wrapper(foo)

# Add an attribute to the object
foo['bar'] = 42

# Access the attribute
print(foo.bar)  # prints 42

# You can also use setattr
setattr(foo,'hey',420)

# And getattr
print(foo['hey'])  # prints 420

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

candy_wrapper-1.0.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

candy_wrapper-1.0.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file candy_wrapper-1.0.3.tar.gz.

File metadata

  • Download URL: candy_wrapper-1.0.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/21.6.0

File hashes

Hashes for candy_wrapper-1.0.3.tar.gz
Algorithm Hash digest
SHA256 62b31929da9564b1bf53d2a13cdc0a325802181f4c3177d943c7e85bf7160b96
MD5 9dc707acfca5ba6c087dfb3c2d16f195
BLAKE2b-256 52d13e884af63079013165f130c71f06d5dd96bda1dd7e0e9f3705c0ece7b1eb

See more details on using hashes here.

File details

Details for the file candy_wrapper-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: candy_wrapper-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/21.6.0

File hashes

Hashes for candy_wrapper-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 86fa45d8c682fbf811b0238bd9e861538874e9017aa3e83cd4c772132112ca65
MD5 d2ff5ce28e3dcd0aa7aad0ad4a3dbe30
BLAKE2b-256 10bf23e6db31da995455515646b353af0248b71a5e709e2ad353f50415b5b75a

See more details on using hashes here.

Supported by

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