zeroless package¶
Submodules¶
zeroless.zeroless module¶
The Zeroless module API.
A global Logger object. To use it, just add an Handler object and set an appropriate logging level.
-
class
zeroless.zeroless.
BindSock
(interface, port)[source]¶ Bases:
zeroless.zeroless.Sock
A socket that will bind for others to connect.
-
class
zeroless.zeroless.
ConnectSock
(ip, port)[source]¶ Bases:
zeroless.zeroless.Sock
A socket that will connect to a binding socket.
-
class
zeroless.zeroless.
Sock
[source]¶ Bases:
object
-
pair
(*data)[source]¶ Returns a callable and an iterable respectively. Those can be used to both transmit a message and/or iterate over incoming messages, that were sent by a pair socket. Note that the iterable returns as many parts as sent by a pair. Also, the sender function has a
print
like signature, with an infinite number of arguments. Each one being a part of the complete message.- Return type
(function, generator)
-
pub
(topic=b'')[source]¶ Returns a callable that can be used to transmit a message, with a given
topic
, in a publisher-subscriber fashion. Note that the sender function has aprint
like signature, with an infinite number of arguments. Each one being a part of the complete message.- Parameters
topic (bytes) – the topic that will be published to (default=b’‘)
- Return type
function
-
pull
()[source]¶ Returns an iterable that can be used to iterate over incoming messages, that were pushed by a push socket. Note that the iterable returns as many parts as sent by pushers.
- Return type
generator
-
push
()[source]¶ Returns a callable that can be used to transmit a message in a push-pull fashion. Note that the sender function has a
print
like signature, with an infinite number of arguments. Each one being a part of the complete message.- Return type
a function
-
reply
()[source]¶ Returns a callable and an iterable respectively. Those can be used to both transmit a message and/or iterate over incoming messages, that were requested by a request socket. Note that the iterable returns as many parts as sent by requesters. Also, the sender function has a
print
like signature, with an infinite number of arguments. Each one being a part of the complete message.- Return type
(function, generator)
-
request
(*data)[source]¶ Returns a callable and an iterable respectively. Those can be used to both transmit a message and/or iterate over incoming messages, that were replied by a reply socket. Note that the iterable returns as many parts as sent by repliers. Also, the sender function has a
print
like signature, with an infinite number of arguments. Each one being a part of the complete message.- Return type
(function, generator)
-
sub
(topics=(b'', ))[source]¶ Returns an iterable that can be used to iterate over incoming messages, that were published with one of the topics specified in
topics
. Note that the iterable returns as many parts as sent by subscribed publishers.- Parameters
topics (list of bytes) – a list of topics to subscribe to (default=b’‘)
- Return type
generator
-
-
zeroless.zeroless.
bind
(port, interface='*')[source]¶ Returns a binding socket object.
- Parameters
port (int) – port number from 1024 up to 65535
interface (str or unicode) – interface to bind (default=*)
- Return type