Wirerope
No description available
Install / Use
/learn @youknowone/WireropeREADME
wirerope
.. image:: https://github.com/youknowone/wirerope/actions/workflows/python-package.yml/badge.svg .. image:: https://codecov.io/gh/youknowone/wirerope/graph/badge.svg :target: https://codecov.io/gh/youknowone/wirerope
The concepts:
wirerope.rope.WireRopeis a wrapper interface for python callable.- Custom
wirerope.wire.Wireclass 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 - though it is not yet written very well.
- See
tests/test_wire.pyfor simple example. - See methodtools for practical example.
Python2 support
wirerope 1.0 stops to support Python 2. If you need Python 2 support, use 0.4.7 the latest version for Python 2.
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
