'Turn functions and methods into fully controllable objects'
Project description
The concepts:
wirerope.rope.WireRope is a wrapper interface for python callable.
Custom wirerope.wire.Wire class provides user-defined behavior. A subclass of this class is working similar to a decorator function body.
A wire object is associated with a bound method.
Rope is dispatching types.
wirerope.rope.WireRope is the wrapper for callables. By wrapping a function with WireRope with a custom subclass of the wirerope.wire.Wire class, the wire object will be created by each function or bound method.
Wire is the most important part. The given class will be instantiated and bound to each function or bound method - which fits the concept of instance cmethod of human. For example, when f is a free function or staticmethod, the wire also will be a single object. When f is a method or property, wires will be created for each method owner object self. When f is a classmethod, wires will be created for each method owner class cls. Yes, it will detect the owner and bound to it regardless of the calling type.
Rope is internal dispatcher. It will be helpful when creating a complex object for decorated callable instead of simple callable feature.
See also
See [documentation](https://wirerope.readthedocs.io/en/latest/) - though it is not yet written very well.
See tests/test_wire.py for simple example.
See [methodtools](https://github.com/youknowone/methodtools) for practical example.
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
File details
Details for the file wirerope-0.4.2.tar.gz
.
File metadata
- Download URL: wirerope-0.4.2.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 903369ddf3a6a6317308792a55c6aedee39e0f3c0a10d18b434dcc58501cb79d |
|
MD5 | 2d0627e2208ce892ff4ce03777af0c20 |
|
BLAKE2b-256 | 9ddd05bf03320c45e8831c3b88388a9457205939d5e9a802fc6f1252ea0c9a7f |