Skip to main content

Slinker provide a single one to one event, we call it a link.

A link can only have a single sender and a single reciver.

The source code is locate at github .

Build Status

Introduction

Link receiver can subscribe to specific link. A reciver function required a sender argument, and a keyworld argument which is optional.

>>> from slinker import Namespace
>>> links = Namespace()
>>> started = links.link('round-started')
>>> def each(round):
...     print "Round %s!" % round
...
>>> started.connect(each)
>>> for round in range(1, 4):
...     started.send(round)
...
Round 1!
Round 2!
Round 3!

Here provide a decorator receiver which can be used for connect. Because a link can only have one reciever. If you want to connect to another receiver, you must disconnect the formly receiver.

>>> started.disconnect(each)
>>> from slinker import receiver
>>> @receiver(started)
    def test(sender, **kwargs):
...     return sender
>>> func, result = started.send('hello')
>>> func == test
... True
>>> result == 'hello'
...  True

More examples

see the tests directory.

Release files for slinker 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slinker 0.1
File Size Uploaded
slinker-0.1.tar.gz 6.7 kB Details

Release files / slinker-0.1.tar.gz

Download URL slinker-0.1.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3500ee34aa1a41ef6de19fe626e784ef0d9fc587cac2b6acf96989b3c3e52d9d
BLAKE2b-256 checksum
How to use checksums
44592291d0a130b960d8b98e5405b8bb7e118f55ff5d7a340824d01523e9f98a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page