-
Notifications
You must be signed in to change notification settings - Fork 0
/
python.htm
618 lines (615 loc) · 57.3 KB
/
python.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>python</title>
<link href=".src/preferred.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<p class='header'>
<a href="-home.htm">Home</a> | <a href="-diary.htm">Diary</a> | <a href="-todo.htm">Todo</a> | <a href="-index.htm">Index</a> | <a href="-about.htm">About</a> |</p>
<p class='main'>#!/usr/bin/python3<br/>
<br/>
# tuple<br/>
keys = <small>('color', 'fruit', 'pet')</small><br/>
# list<br/>
values = <small>['orang', 'orang', 'dog']</small><br/>
<br/>
# dict from tuple and list<br/>
dictionary = <small>{key: value for key, value in zip<small>(keys, values)</small>}</small><br/>
d_items = <a class="ext" href="https://dictionary.items(">dictionary.items(</a>)</small><br/>
print<small>(d_items)</small><br/>
# dict_items<small>(<small>[<small>('color', 'blue')</small>, <small>('fruit', 'apple')</small>, <small>('pet', 'dog')</small>]</small>)</small><br/>
<br/>
# dict comprehension<br/>
pets = <small>{key: value for key, value in <a class="ext" href="https://dictionary.items(">dictionary.items(</a>)</small> if value != 'orang'}</small><br/>
<br/>
for key, value in <a class="ext" href="https://pets.items(">pets.items(</a>)</small>:<br/>
print<small>(key, '->', value)</small><br/>
<br/>
<br/>
# # *args is a tuple <small>[const list]</small>, use like:<br/>
# for arg in args:<br/>
# print<small>(arg)</small><br/>
<br/>
# # **kwargs is a dictionary, use like:<br/>
# for kitem in <a class="ext" href="https://kwargs.items(">kwargs.items(</a>)</small>:<br/>
# print<small>(kitem<br/>
# for kval in <a class="ext" href="https://kwargs.values(">kwargs.values(</a>)</small>:<br/>
# print<small>(kval)</small><br/>
<br/>
# # or maybe<br/>
# for kwarg in kwargs:<br/>
# print<small>(<a class="ext" href="https://kwarg.value(">kwarg.value(</a>)</small>)</small><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
## This is a Python port of <small>[Zyre]</small><small>(<a class="ext" href="http://zyre.org)">http://zyre.org)</a> 1.0, implementing the same <small>[ZRE protocol]</small><small>(<a class="ext" href="http://rfc.zeromq.org/spec:36).">http://rfc.zeromq.org/spec:36).</a><br/>
# import zmq<br/>
# import time<br/>
# import struct<br/>
# import socket<br/>
# import uuid<br/>
# import logging<br/>
# import sys<br/>
<br/>
# # local modules<br/>
# from . import __version_info__<br/>
# from . import zbeacon<br/>
# from . import zhelper<br/>
# from .zactor import ZActor<br/>
# from .zsocket import ZSocket<br/>
# from .pyre_node import PyreNode<br/>
# from .pyre_event import PyreEvent<br/>
<br/>
# logger = <a class="ext" href="https://logging.getLogger(__name__">logging.getLogger(__name__</a>)</small><br/>
<br/>
# try:<br/>
# raw_input # Python 2<br/>
# except NameError:<br/>
# raw_input = input # Python 3<br/>
<br/>
<br/>
# class Pyre<small>(obj<a href="ec.htm">ec</a>t)</small>:<br/>
<br/>
# def __init__<small>(self, name=None, ctx=None, *args, **kwargs)</small>:<br/>
# """Constructor, creates a new Zyre node. Note that until you start the<br/>
# node it is silent and invisible to other nodes on the net<a href="work.htm">work</a>.<br/>
# The node name is provided to other nodes during discovery. If you<br/>
# sp<a href="ec.htm">ec</a>ify NULL, Zyre <a href="gen.htm">gen</a>erates a randomized node name from the UUID.<br/>
<br/>
# Args:<br/>
# name <small>(str)</small>: The name of the node<br/>
<br/>
# Kwargs:<br/>
# ctx: PyZMQ Context, if not sp<a href="ec.htm">ec</a>ified a new context will be created<br/>
# """<br/>
# super<small>(Pyre, self)</small>.__init__<small>(*args, **kwargs)</small><br/>
# ctx = <a class="ext" href="https://kwargs.get('ctx'">kwargs.get('ctx'</a>)</small><br/>
# if ctx == None:<br/>
# ctx = <a class="ext" href="https://zmq.Context(">zmq.Context(</a>)</small><br/>
# self._ctx = ctx<br/>
# self._uuid = None<br/>
# self._name = name<br/>
# <a class="ext" href="https://self.verbose">self.verbose</a> = False<br/>
# <a class="ext" href="https://self.inbox">self.inbox</a>, self._outbox = <a class="ext" href="https://zhelper.zcreate_pipe(self._ctx">zhelper.zcreate_pipe(self._ctx</a>)</small><br/>
<br/>
# # Start node engine and wait for it to be ready<br/>
# <a class="ext" href="https://self.actor">self.actor</a> = ZActor<small>(self._ctx, PyreNode, self._outbox)</small><br/>
# # Send name, if any, to node backend<br/>
# if <small>(self._name)</small>:<br/>
# <a class="ext" href="https://self.actor.send_unicode("SET">self.actor.send_unicode("SET</a> NAME", <a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(self._name">self.actor.send_unicode(self._name</a>)</small><br/>
<br/>
# #def __del__<small>(self)</small>:<br/>
# # We <a href="need.htm">need</a> to explicitly destroy the actor<br/>
# # to make sure our node thread is stopped<br/>
# #<a class="ext" href="https://self.actor.destroy(">self.actor.destroy(</a>)</small><br/>
<br/>
# def __bool__<small>(self)</small>:<br/>
# "Deter<a href="min.htm">min</a>e whether the obj<a href="ec.htm">ec</a>t is valid by converting to boolean" # Python 3<br/>
# <a href="return.htm">return</a> True #TODO<br/>
<br/>
# def __nonzero__<small>(self)</small>:<br/>
# "Deter<a href="min.htm">min</a>e whether the obj<a href="ec.htm">ec</a>t is valid by converting to boolean" # Python 2<br/>
# <a href="return.htm">return</a> True #TODO<br/>
<br/>
# def uuid<small>(self)</small>:<br/>
# """<a href="return.htm">Return</a> our node UUID string, after successful initialization"""<br/>
# if not self._uuid:<br/>
# <a class="ext" href="https://self.actor.send_unicode("UUID"">self.actor.send_unicode("UUID"</a>)</small><br/>
# self._uuid = <a class="ext" href="https://uuid.UUID(bytes=self.actor.recv(">uuid.UUID(bytes=self.actor.recv(</a>)</small>)</small><br/>
# <a href="return.htm">return</a> self._uuid<br/>
<br/>
# # <a href="return.htm">Return</a> our node name, after successful initialization<br/>
# def name<small>(self)</small>:<br/>
# """<a href="return.htm">Return</a> our node name, after successful initialization"""<br/>
# if not self._name:<br/>
# <a class="ext" href="https://self.actor.send_unicode("NAME"">self.actor.send_unicode("NAME"</a>)</small><br/>
# self._name = <a class="ext" href="https://self.actor.recv(">self.actor.recv(</a>)</small>.d<a href="ec.htm">ec</a>ode<small>('utf-8')</small><br/>
# <a href="return.htm">return</a> self._name<br/>
<br/>
# # Not in Zyre api<br/>
# def set_name<small>(self, name)</small>:<br/>
# <a class="ext" href="https://logger.warning("DEPRECATED">logger.warning("DEPRECATED</a>: set name in constructor, this method will be removed!")</small><br/>
# <a class="ext" href="https://self.actor.send_unicode("SET">self.actor.send_unicode("SET</a> NAME", <a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(name">self.actor.send_unicode(name</a>)</small><br/>
<br/>
# def set_header<small>(self, key, value)</small>:<br/>
# """Set node header; these are provided to other nodes during discovery<br/>
# and come in each ENTER message."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("SET">self.actor.send_unicode("SET</a> HEADER", flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(key">self.actor.send_unicode(key</a>, flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(value">self.actor.send_unicode(value</a>)</small><br/>
<br/>
# def set_verbose<small>(self)</small>:<br/>
# """Set verbose mode; this tells the node to log all traffic as well as<br/>
# all major events."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("SET">self.actor.send_unicode("SET</a> VERBOSE")</small><br/>
<br/>
# def set_port<small>(self, port_nbr)</small>:<br/>
# """Set UDP beacon discovery port; defaults to 5670, this call overrides<br/>
# that so you can create independent clusters on the same net<a href="work.htm">work</a>, for<br/>
# e.g. development vs. <a href="produc.htm">produc</a>tion. Has no eff<a href="ec.htm">ec</a>t after zyre_start<small>()</small>."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("SET">self.actor.send_unicode("SET</a> PORT", <a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send(port_nbr">self.actor.send(port_nbr</a>)</small><br/>
<br/>
# def set_interval<small>(self, interval)</small>:<br/>
# """Set UDP beacon discovery interval, in <a href="mill.htm">mill</a>is<a href="ec.htm">ec</a>onds. Default is instant<br/>
# beacon exploration followed by pinging every 1,000 ms<a href="ec.htm">ec</a>s."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("SET">self.actor.send_unicode("SET</a> INTERVAL", <a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(interval">self.actor.send_unicode(interval</a>)</small><br/>
<br/>
# def set_interface<small>(self, value)</small>:<br/>
# """Set net<a href="work.htm">work</a> interface for UDP beacons. If you do not set this, CZMQ will<br/>
# choose an interface for you. On boxes with several interfaces you should<br/>
# sp<a href="ec.htm">ec</a>ify which one you want to use, or strange things can happen."""<br/>
# <a class="ext" href="https://logging.debug("set_interface">logging.debug("set_interface</a> not implemented")</small> #TODO<br/>
<br/>
# # TODO: ch<a href="ec.htm">ec</a>k args from zyre<br/>
# def set_endpoint<small>(self, format, *args)</small>:<br/>
# """By default, Zyre binds to an ephemeral TCP port and broadcasts the local<br/>
# host name using UDP beaconing. When you call this method, Zyre will use<br/>
# gossip discovery instead of UDP beaconing. You MUST set-up the gossip<br/>
# service separately using zyre_gossip_bind<small>()</small> and _conn<a href="ec.htm">ec</a>t<small>()</small>. Note that the<br/>
# endpoint MUST be valid for both bind and conn<a href="ec.htm">ec</a>t operations. You can use<br/>
# <a class="ext" href="inproc://,">inproc://,</a> <a class="ext" href="ipc://,">ipc://,</a> or <a class="ext" href="tcp://">tcp://</a> <a href="trans.htm">trans</a>ports <small>(for <a class="ext" href="tcp://,">tcp://,</a> use an IP address<br/>
# that is meaningful to remote as well as local nodes)</small>. <a href="return.htm">Return</a>s 0 if<br/>
# the bind was successful, else -1."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("SET">self.actor.send_unicode("SET</a> ENDPOINT", <a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(format">self.actor.send_unicode(format</a>)</small><br/>
<br/>
# # TODO: We haven't implemented gossiping yet<br/>
# #def gossip_bind<small>(self, format, *args)</small>:<br/>
# #def gossip_conn<a href="ec.htm">ec</a>t<small>(self, format, *args)</small>:<br/>
<br/>
# def start<small>(self)</small>:<br/>
# """Start node, after setting header values. When you start a node it<br/>
# begins discovery and conn<a href="ec.htm">ec</a>tion. <a href="return.htm">Return</a>s 0 if OK, -1 if it wasn't<br/>
# possible to start the node."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("START"">self.actor.send_unicode("START"</a>)</small><br/>
# # the backend will signal back<br/>
# <a class="ext" href="https://self.actor.resolve(">self.actor.resolve(</a>)</small>.wait<small>()</small><br/>
<br/>
# def stop<small>(self)</small>:<br/>
# """Stop node; this signals to other peers that this node will go away.<br/>
# This is polite; however you can also just destroy the node without<br/>
# stopping it."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("STOP"">self.actor.send_unicode("STOP"</a>, flags=<a class="ext" href="https://zmq.DONTWAIT">zmq.DONTWAIT</a>)</small><br/>
# # the backend will signal back<br/>
# <a class="ext" href="https://self.actor.resolve(">self.actor.resolve(</a>)</small>.wait<small>()</small><br/>
# <a class="ext" href="https://self.actor.destroy(">self.actor.destroy(</a>)</small><br/>
<br/>
# # R<a href="ec.htm">ec</a>eive next message from node<br/>
# def r<a href="ec.htm">ec</a>v<small>(self)</small>:<br/>
# """R<a href="ec.htm">ec</a>eive next message from net<a href="work.htm">work</a>; the message may be a control<br/>
# message <small>(ENTER, EXIT, JOIN, LEAVE)</small> or data <small>(WHISPER, SHOUT)</small>.<br/>
# """<br/>
# <a href="return.htm">return</a> <a class="ext" href="https://self.inbox.recv_multipart(">self.inbox.recv_multipart(</a>)</small><br/>
<br/>
# def join<small>(self, <a href="group.htm">group</a>)</small>:<br/>
# """Join a named <a href="group.htm">group</a>; after joining a <a href="group.htm">group</a> you can send messages to<br/>
# the <a href="group.htm">group</a> and all Zyre nodes in that <a href="group.htm">group</a> will r<a href="ec.htm">ec</a>eive them."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("JOIN"">self.actor.send_unicode("JOIN"</a>, flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(group">self.actor.send_unicode(group</a>)</small><br/>
<br/>
# def leave<small>(self, <a href="group.htm">group</a>)</small>:<br/>
# """Leave a <a href="group.htm">group</a>"""<br/>
# <a class="ext" href="https://self.actor.send_unicode("LEAVE"">self.actor.send_unicode("LEAVE"</a>, flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(group">self.actor.send_unicode(group</a>)</small><br/>
<br/>
# # Send message to single peer; peer ID is first frame in message<br/>
# def whisper<small>(self, peer, msg_p)</small>:<br/>
# """Send message to single peer, sp<a href="ec.htm">ec</a>ified as a UUID string<br/>
# Destroys message after sending"""<br/>
# <a class="ext" href="https://self.actor.send_unicode("WHISPER"">self.actor.send_unicode("WHISPER"</a>, flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send(peer.bytes">self.actor.send(peer.bytes</a>, flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# if isinstance<small>(msg_p, list)</small>:<br/>
# <a class="ext" href="https://self.actor.send_multipart(msg_p">self.actor.send_multipart(msg_p</a>)</small><br/>
# else:<br/>
# <a class="ext" href="https://self.actor.send(msg_p">self.actor.send(msg_p</a>)</small><br/>
<br/>
# def shout<small>(self, <a href="group.htm">group</a>, msg_p)</small>:<br/>
# """Send message to a named <a href="group.htm">group</a><br/>
# Destroys message after sending"""<br/>
# <a class="ext" href="https://self.actor.send_unicode("SHOUT"">self.actor.send_unicode("SHOUT"</a>, flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(group">self.actor.send_unicode(group</a>, flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# if isinstance<small>(msg_p, list)</small>:<br/>
# <a class="ext" href="https://self.actor.send_multipart(msg_p">self.actor.send_multipart(msg_p</a>)</small><br/>
# else:<br/>
# <a class="ext" href="https://self.actor.send(msg_p">self.actor.send(msg_p</a>)</small><br/>
<br/>
# # TODO: ch<a href="ec.htm">ec</a>ks args from zyre<br/>
# def whispers<small>(self, peer, format, *args)</small>:<br/>
# """Send formatted string to a single peer sp<a href="ec.htm">ec</a>ified as UUID string"""<br/>
# <a class="ext" href="https://self.actor.send_unicode("WHISPER"">self.actor.send_unicode("WHISPER"</a>, flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send(peer.bytes">self.actor.send(peer.bytes</a>, flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(format">self.actor.send_unicode(format</a>)</small><br/>
<br/>
# def shouts<small>(self, <a href="group.htm">group</a>, format, *args)</small>:<br/>
# """Send formatted string to a named <a href="group.htm">group</a>"""<br/>
# <a class="ext" href="https://self.actor.send_unicode("SHOUT"">self.actor.send_unicode("SHOUT"</a>, flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(group">self.actor.send_unicode(group</a>, flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(format">self.actor.send_unicode(format</a>)</small><br/>
<br/>
# def peers<small>(self)</small>:<br/>
# """<a href="return.htm">Return</a> list of current peer ids."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("PEERS"">self.actor.send_unicode("PEERS"</a>)</small><br/>
# peers = <a class="ext" href="https://self.actor.recv_pyobj(">self.actor.recv_pyobj(</a>)</small><br/>
# <a href="return.htm">return</a> peers<br/>
<br/>
# def peers_by_<a href="group.htm">group</a><small>(self, <a href="group.htm">group</a>)</small>:<br/>
# """<a href="return.htm">Return</a> list of current peer ids."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("PEERS">self.actor.send_unicode("PEERS</a> BY <a href="group.htm">GROUP</a>", flags=<a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(group">self.actor.send_unicode(group</a>)</small><br/>
# peers_by_<a href="group.htm">group</a> = <a class="ext" href="https://self.actor.recv_pyobj(">self.actor.recv_pyobj(</a>)</small><br/>
# <a href="return.htm">return</a> peers_by_<a href="group.htm">group</a><br/>
<br/>
# def endpoint<small>(self)</small>:<br/>
# """<a href="return.htm">Return</a> <a href="own.htm">own</a> endpoint"""<br/>
# <a class="ext" href="https://self.actor.send_unicode("ENDPOINT"">self.actor.send_unicode("ENDPOINT"</a>)</small><br/>
# endpoint = <a class="ext" href="https://self.actor.recv_unicode(">self.actor.recv_unicode(</a>)</small><br/>
# <a href="return.htm">return</a> endpoint<br/>
<br/>
# def r<a href="ec.htm">ec</a>ent_events<small>(self)</small>:<br/>
# """Iterator that yields r<a href="ec.htm">ec</a>ent `PyreEvent`s"""<br/>
# while <a class="ext" href="https://self.socket(">self.socket(</a>)</small>.get<small>(<a class="ext" href="https://zmq.EVENTS">zmq.EVENTS</a>)</small> & <a class="ext" href="https://zmq.POLLIN">zmq.POLLIN</a>:<br/>
# yield PyreEvent<small>(self)</small><br/>
<br/>
# def events<small>(self)</small>:<br/>
# """Iterator that yields `PyreEvent`s indefinitely"""<br/>
# while True:<br/>
# yield PyreEvent<small>(self)</small><br/>
<br/>
# # --------------------------------------------------------------------------<br/>
# # <a href="return.htm">Return</a> the name of a conn<a href="ec.htm">ec</a>ted peer. Caller <a href="own.htm">own</a>s the<br/>
# # string.<br/>
# # DEPR<a href="ec.htm">EC</a>ATED: This is dropped in Zyre api. You r<a href="ec.htm">ec</a>eive names through events<br/>
# def get_peer_name<small>(self, peer)</small>:<br/>
# <a class="ext" href="https://logger.warning("get_peer_name(">logger.warning("get_peer_name(</a>)</small> is depr<a href="ec.htm">ec</a>ated, will be removed")</small><br/>
# <a class="ext" href="https://self.actor.send_unicode("PEER">self.actor.send_unicode("PEER</a> NAME", <a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send(peer.bytes">self.actor.send(peer.bytes</a>)</small><br/>
# name = <a class="ext" href="https://self.actor.recv_unicode(">self.actor.recv_unicode(</a>)</small><br/>
# <a href="return.htm">return</a> name<br/>
<br/>
# def peer_address<small>(self, peer)</small>:<br/>
# """<a href="return.htm">Return</a> the endpoint of a conn<a href="ec.htm">ec</a>ted peer."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("PEER">self.actor.send_unicode("PEER</a> ENDPOINT", <a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send(peer.bytes">self.actor.send(peer.bytes</a>)</small><br/>
# adr = <a class="ext" href="https://self.actor.recv_unicode(">self.actor.recv_unicode(</a>)</small><br/>
# <a href="return.htm">return</a> adr<br/>
<br/>
# def peer_header_value<small>(self, peer, name)</small>:<br/>
# """<a href="return.htm">Return</a> the value of a header of a con<a href="ec.htm">ec</a>ted peer.<br/>
# <a href="return.htm">Return</a>s null if peer or key doesn't exist."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("PEER">self.actor.send_unicode("PEER</a> HEADER", <a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send(peer.bytes">self.actor.send(peer.bytes</a>, <a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send_unicode(name">self.actor.send_unicode(name</a>)</small><br/>
# value = <a class="ext" href="https://self.actor.recv_unicode(">self.actor.recv_unicode(</a>)</small><br/>
# <a href="return.htm">return</a> value<br/>
<br/>
# def peer_headers<small>(self, peer)</small>:<br/>
# """<a href="return.htm">Return</a> the value of a header of a con<a href="ec.htm">ec</a>ted peer.<br/>
# <a href="return.htm">Return</a>s null if peer or key doesn't exist."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("PEER">self.actor.send_unicode("PEER</a> HEADERS", <a class="ext" href="https://zmq.SNDMORE">zmq.SNDMORE</a>)</small><br/>
# <a class="ext" href="https://self.actor.send(peer.bytes">self.actor.send(peer.bytes</a>)</small><br/>
# headers = <a class="ext" href="https://self.actor.recv_pyobj(">self.actor.recv_pyobj(</a>)</small><br/>
# <a href="return.htm">return</a> headers<br/>
<br/>
# def <a href="own.htm">own</a>_<a href="group.htm">group</a>s<small>(self)</small>:<br/>
# """<a href="return.htm">Return</a> list of currently joined <a href="group.htm">group</a>s."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("OWN">self.actor.send_unicode("OWN</a> <a href="group.htm">GROUP</a>S")</small>;<br/>
# <a href="group.htm">group</a>s = <a class="ext" href="https://self.actor.recv_pyobj(">self.actor.recv_pyobj(</a>)</small><br/>
# <a href="return.htm">return</a> <a href="group.htm">group</a>s<br/>
<br/>
# def peer_<a href="group.htm">group</a>s<small>(self)</small>:<br/>
# """<a href="return.htm">Return</a> list of <a href="group.htm">group</a>s kn<a href="own.htm">own</a> through conn<a href="ec.htm">ec</a>ted peers."""<br/>
# <a class="ext" href="https://self.actor.send_unicode("PEER">self.actor.send_unicode("PEER</a> <a href="group.htm">GROUP</a>S")</small><br/>
# <a href="group.htm">group</a>s = <a class="ext" href="https://self.actor.recv_pyobj(">self.actor.recv_pyobj(</a>)</small><br/>
# <a href="return.htm">return</a> <a href="group.htm">group</a>s<br/>
<br/>
# # <a href="return.htm">Return</a> node socket, for dir<a href="ec.htm">ec</a>t polling of socket<br/>
# def socket<small>(self)</small>:<br/>
# """<a href="return.htm">Return</a> socket for talking to the Zyre node, for polling"""<br/>
# <a href="return.htm">return</a> <a class="ext" href="https://self.inbox">self.inbox</a><br/>
<br/>
# @staticmethod<br/>
# def version<small>()</small>:<br/>
# <a href="return.htm">return</a> __version_info__<br/>
<br/>
# def <a href="chat.htm">chat</a>_task<small>(ctx, pipe)</small>:<br/>
# n = Pyre<small>(ctx=ctx)</small><br/>
# <a class="ext" href="https://n.join("CHAT"">n.join("CHAT"</a>)</small><br/>
# <a class="ext" href="https://n.start(">n.start(</a>)</small><br/>
<br/>
# poller = <a class="ext" href="https://zmq.Poller(">zmq.Poller(</a>)</small><br/>
# <a class="ext" href="https://poller.register(pipe">poller.register(pipe</a>, <a class="ext" href="https://zmq.POLLIN">zmq.POLLIN</a>)</small><br/>
# <a class="ext" href="https://poller.register(n.socket(">poller.register(n.socket(</a>)</small>, <a class="ext" href="https://zmq.POLLIN">zmq.POLLIN</a>)</small><br/>
# while<small>(True)</small>:<br/>
# items = dict<small>(<a class="ext" href="https://poller.poll(">poller.poll(</a>)</small>)</small><br/>
# if pipe in items:<br/>
# message = <a class="ext" href="https://pipe.recv(">pipe.recv(</a>)</small><br/>
# if message == '$TERM':<br/>
# break<br/>
# <a class="ext" href="https://logger.debug("CHAT_TASK">logger.debug("CHAT_TASK</a>: <small>{0}</small>".format<small>(message)</small>)</small><br/>
# <a class="ext" href="https://n.shout("CHAT"">n.shout("CHAT"</a>, message)</small><br/>
<br/>
# if <a class="ext" href="https://n.socket(">n.socket(</a>)</small> in items:<br/>
# event = PyreEvent<small>(n)</small><br/>
<br/>
# <a class="ext" href="https://logger.debug("NODE_MSG">logger.debug("NODE_MSG</a> TYPE: <small>{0}</small>".format<small>(<a class="ext" href="https://event.type">event.type</a>)</small>)</small><br/>
# <a class="ext" href="https://logger.debug("NODE_MSG">logger.debug("NODE_MSG</a> PEER: <small>{0}</small>".format<small>(<a class="ext" href="https://event.peer_uuid">event.peer_uuid</a>)</small>)</small><br/>
<br/>
# if <a class="ext" href="https://event.type">event.type</a> == "SHOUT":<br/>
# <a class="ext" href="https://logger.debug("NODE_MSG">logger.debug("NODE_MSG</a> <a href="group.htm">GROUP</a>: <small>{0}</small>".format<small>(<a class="ext" href="https://event.group">event.group</a>)</small>)</small><br/>
<br/>
# <a class="ext" href="https://logger.debug("NODE_MSG">logger.debug("NODE_MSG</a> CONT: <small>{0}</small>".format<small>(<a class="ext" href="https://event.msg">event.msg</a>)</small>)</small><br/>
# <a class="ext" href="https://n.stop(">n.stop(</a>)</small><br/>
<br/>
# if __name__ == '__main__':<br/>
# <a class="ext" href="https://logging.basicConfig(">logging.basicConfig(</a>)</small><br/>
# <a class="ext" href="https://logging.getLogger('__main__'">logging.getLogger('__main__'</a>)</small>.setLevel<small>(<a class="ext" href="https://logging.DEBUG">logging.DEBUG</a>)</small><br/>
<br/>
# ctx = <a class="ext" href="https://zmq.Context(">zmq.Context(</a>)</small><br/>
# <a href="chat.htm">chat</a>_pipe = <a class="ext" href="https://zhelper.zthread_fork(ctx">zhelper.zthread_fork(ctx</a>, <a href="chat.htm">chat</a>_task)</small><br/>
# while True:<br/>
# try:<br/>
# msg = raw_input<small>()</small><br/>
# <a class="ext" href="https://chat_pipe.send_string(msg">chat_pipe.send_string(msg</a>)</small><br/>
# except <small>(KeyboardInterrupt, SystemExit)</small>:<br/>
# <a class="ext" href="https://chat_pipe.send_string('$TERM'">chat_pipe.send_string('$TERM'</a>)</small><br/>
# break<br/>
# <a class="ext" href="https://logger.debug("Exiting"">logger.debug("Exiting"</a>)</small><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
# Pyre<br/>
# ====<br/>
<br/>
# This is a Python port of <small>[Zyre]</small><small>(<a class="ext" href="http://zyre.org)">http://zyre.org)</a> 1.0, implementing the same <small>[ZRE protocol]</small><small>(<a class="ext" href="http://rfc.zeromq.org/spec:36).">http://rfc.zeromq.org/spec:36).</a><br/>
<br/>
# # Pyre - an <a href="open.htm">open</a>-<a href="sourc.htm">sourc</a>e frame<a href="work.htm">work</a> for proximity-based peer-to-peer applications<br/>
<br/>
# ## De<a href="scrip.htm">scrip</a>tion<br/>
<br/>
# Pyre does local area discovery and clustering. A Pyre node broadcasts<br/>
# UDP beacons, and conn<a href="ec.htm">ec</a>ts to peers that it finds. This class wraps a<br/>
# Pyre node with a message-based API.<br/>
<br/>
# All <a href="incom.htm">incom</a>ing events are messages delivered via the r<a href="ec.htm">ec</a>v call of a Pyre<br/>
# instance. The first frame defines the type of the message, and following<br/>
# frames provide further values:<br/>
<br/>
# ENTER fromnode headers<br/>
# a new peer has entered the net<a href="work.htm">work</a><br/>
# EXIT fromnode<br/>
# a peer has left the net<a href="work.htm">work</a><br/>
# JOIN fromnode <a href="group.htm">group</a>name<br/>
# a peer has joined a sp<a href="ec.htm">ec</a>ific <a href="group.htm">group</a><br/>
# LEAVE fromnode <a href="group.htm">group</a>name<br/>
# a peer has joined a sp<a href="ec.htm">ec</a>ific <a href="group.htm">group</a><br/>
# WHISPER fromnode message<br/>
# a peer has sent this node a message<br/>
# SHOUT fromnode <a href="group.htm">group</a>name message<br/>
# a peer has sent one of our <a href="group.htm">group</a>s a message<br/>
<br/>
# In SHOUT and WHISPER the message is a single frame in this version<br/>
# of Pyre. In ENTER, the headers frame contains a packed dictionary, <br/>
# that can be unpacked using <a class="ext" href="https://json.loads(msg">json.loads(msg</a>)</small> <small>(see <a href="chat.htm">chat</a> client)</small>.<br/>
<br/>
# To join or leave a <a href="group.htm">group</a>, use the join<small>()</small> and leave<small>()</small> methods.<br/>
# To set a header value, use the set_header<small>()</small> method. To send a message<br/>
# to a single peer, use whisper<small>()</small>. To send a message to a <a href="group.htm">group</a>, use<br/>
# shout<small>()</small>.<br/>
<br/>
# ## Installation<br/>
<br/>
# For now use Pip:<br/>
<br/>
# pip install <a class="ext" href="https://github.com/zeromq/pyre/archive/master.zip">https://github.com/zeromq/pyre/archive/master.zip</a><br/>
<br/>
# ## API<br/>
<br/>
# import pyre<br/>
# # Constructor, creates a new Zyre node. Note that until you start the<br/>
# # node it is silent and invisible to other nodes on the net<a href="work.htm">work</a>.<br/>
# node = <a class="ext" href="https://pyre.Pyre(">pyre.Pyre(</a>)</small><br/>
<br/>
# # Set node header; these are provided to other nodes during discovery<br/>
# # and come in each ENTER message.<br/>
# <a class="ext" href="https://node.set_header(name">node.set_header(name</a>, value)</small><br/>
<br/>
# # <small>(TODO: Currently a Pyre node starts immediately)</small> Start node, after setting header values. When you start a node it<br/>
# # begins discovery and conn<a href="ec.htm">ec</a>tion.<br/>
# <a class="ext" href="https://node.start(">node.start(</a>)</small><br/>
<br/>
# # Stop node, this signals to other peers that this node will go away.<br/>
# # This is polite; however you can also just destroy the node without<br/>
# # stopping it.<br/>
# <a class="ext" href="https://node.stop(">node.stop(</a>)</small><br/>
<br/>
# # Join a named <a href="group.htm">group</a>; after joining a <a href="group.htm">group</a> you can send messages to<br/>
# # the <a href="group.htm">group</a> and all Zyre nodes in that <a href="group.htm">group</a> will r<a href="ec.htm">ec</a>eive them.<br/>
# <a class="ext" href="https://node.join(group">node.join(group</a>)</small><br/>
<br/>
# # Leave a <a href="group.htm">group</a><br/>
# <a class="ext" href="https://node.leave(group">node.leave(group</a>)</small><br/>
<br/>
# # R<a href="ec.htm">ec</a>eive next message from net<a href="work.htm">work</a>; the message may be a control<br/>
# # message <small>(ENTER, EXIT, JOIN, LEAVE)</small> or data <small>(WHISPER, SHOUT)</small>.<br/>
# # <a href="return.htm">Return</a>s a list of message frames<br/>
# msgs = <a class="ext" href="https://node.recv(">node.recv(</a>)</small>;<br/>
<br/>
# # Send message to single peer, sp<a href="ec.htm">ec</a>ified as a UUID obj<a href="ec.htm">ec</a>t <small>(import uuid)</small><br/>
# # Destroys message after sending<br/>
# <a class="ext" href="https://node.whisper(peer">node.whisper(peer</a>, msg)</small><br/>
<br/>
# # Send message to a named <a href="group.htm">group</a><br/>
# # Destroys message after sending<br/>
# <a class="ext" href="https://node.shout(group">node.shout(group</a>, msg)</small>;<br/>
<br/>
# # Send string to single peer sp<a href="ec.htm">ec</a>ified as a UUID string.<br/>
# # String is formatted using printf sp<a href="ec.htm">ec</a>ifiers.<br/>
# <a class="ext" href="https://node.whispers(peer">node.whispers(peer</a>, msg_string)</small><br/>
<br/>
# # Send message to a named <a href="group.htm">group</a><br/>
# # Destroys message after sending<br/>
# <a class="ext" href="https://node.shouts(group">node.shouts(group</a>, msg_string)</small>;<br/>
<br/>
# # <a href="return.htm">Return</a> handle to the Zyre node, for polling<br/>
# <a class="ext" href="https://node.get_socket(">node.get_socket(</a>)</small><br/>
# # use <a class="ext" href="https://node.get_socket(">node.get_socket(</a>)</small>.getsockopt<small>(<a class="ext" href="https://zmq.FD">zmq.FD</a>)</small> to acquire <br/>
# # the filede<a href="scrip.htm">scrip</a>tor<br/>
# # Don't use this for getting Pyre events you can use the <br/>
# # <a class="ext" href="https://node.inbox">node.inbox</a> to get those events<br/>
<br/>
# ## Example <a href="chat.htm">Chat</a> Client<br/>
<br/>
# ```python<br/>
# try:<br/>
# from zyre_pyzmq import Zyre as Pyre<br/>
# except Exception as e:<br/>
# print<small>("using Python native module", e)</small><br/>
# from pyre import Pyre <br/>
<br/>
# from pyre import zhelper <br/>
# import zmq <br/>
# import uuid<br/>
# import logging<br/>
# import sys<br/>
# import json<br/>
<br/>
# def <a href="chat.htm">chat</a>_task<small>(ctx, pipe)</small>:<br/>
# n = Pyre<small>("<a href="chat.htm">CHAT</a>")</small><br/>
# <a class="ext" href="https://n.set_header("CHAT_Header1"">n.set_header("CHAT_Header1"</a>,"example header1")</small><br/>
# <a class="ext" href="https://n.set_header("CHAT_Header2"">n.set_header("CHAT_Header2"</a>,"example header2")</small><br/>
# <a class="ext" href="https://n.join("CHAT"">n.join("CHAT"</a>)</small><br/>
# <a class="ext" href="https://n.start(">n.start(</a>)</small><br/>
<br/>
# poller = <a class="ext" href="https://zmq.Poller(">zmq.Poller(</a>)</small><br/>
# <a class="ext" href="https://poller.register(pipe">poller.register(pipe</a>, <a class="ext" href="https://zmq.POLLIN">zmq.POLLIN</a>)</small><br/>
# print<small>(<a class="ext" href="https://n.socket(">n.socket(</a>)</small>)</small><br/>
# <a class="ext" href="https://poller.register(n.socket(">poller.register(n.socket(</a>)</small>, <a class="ext" href="https://zmq.POLLIN">zmq.POLLIN</a>)</small><br/>
# print<small>(<a class="ext" href="https://n.socket(">n.socket(</a>)</small>)</small><br/>
# while<small>(True)</small>:<br/>
# items = dict<small>(<a class="ext" href="https://poller.poll(">poller.poll(</a>)</small>)</small><br/>
# print<small>(<a class="ext" href="https://n.socket(">n.socket(</a>)</small>, items)</small><br/>
# if pipe in items and items<small>[pipe]</small> == <a class="ext" href="https://zmq.POLLIN">zmq.POLLIN</a>:<br/>
# message = <a class="ext" href="https://pipe.recv(">pipe.recv(</a>)</small><br/>
# # message to quit<br/>
# if <a class="ext" href="https://message.decode('utf-8'">message.decode('utf-8'</a>)</small> == "$$STOP":<br/>
# break<br/>
# print<small>("<a href="chat.htm">CHAT</a>_TASK: %s" % message)</small><br/>
# <a class="ext" href="https://n.shouts("CHAT"">n.shouts("CHAT"</a>, <a class="ext" href="https://message.decode('utf-8'">message.decode('utf-8'</a>)</small>)</small><br/>
# else:<br/>
# #if <a class="ext" href="https://n.socket(">n.socket(</a>)</small> in items and items<small>[<a class="ext" href="https://n.socket(">n.socket(</a>)</small>]</small> == <a class="ext" href="https://zmq.POLLIN">zmq.POLLIN</a>:<br/>
# cmds = <a class="ext" href="https://n.recv(">n.recv(</a>)</small><br/>
# msg_type = <a class="ext" href="https://cmds.pop(0">cmds.pop(0</a>)</small><br/>
# print<small>("NODE_MSG TYPE: %s" % msg_type)</small><br/>
# print<small>("NODE_MSG PEER: %s" % <a class="ext" href="https://uuid.UUID(bytes=cmds.pop(0">uuid.UUID(bytes=cmds.pop(0</a>)</small>)</small>)</small><br/>
# print<small>("NODE_MSG NAME: %s" % <a class="ext" href="https://cmds.pop(0">cmds.pop(0</a>)</small>)</small><br/>
# if <a class="ext" href="https://msg_type.decode('utf-8'">msg_type.decode('utf-8'</a>)</small> == "SHOUT":<br/>
# print<small>("NODE_MSG <a href="group.htm">GROUP</a>: %s" % <a class="ext" href="https://cmds.pop(0">cmds.pop(0</a>)</small>)</small><br/>
# elif <a class="ext" href="https://msg_type.decode('utf-8'">msg_type.decode('utf-8'</a>)</small> == "ENTER":<br/>
# headers = <a class="ext" href="https://json.loads(cmds.pop(0">json.loads(cmds.pop(0</a>)</small>.d<a href="ec.htm">ec</a>ode<small>('utf-8')</small>)</small><br/>
# print<small>("NODE_MSG HEADERS: %s" % headers)</small><br/>
# for key in headers:<br/>
# print<small>("key = <small>{0}</small>, value = <small>{1}</small>".format<small>(key, headers<small>[key]</small>)</small>)</small><br/>
# print<small>("NODE_MSG CONT: %s" % cmds)</small><br/>
# <a class="ext" href="https://n.stop(">n.stop(</a>)</small><br/>
<br/>
<br/>
# if __name__ == '__main__':<br/>
# # Create a StreamHandler for debugging<br/>
# logger = <a class="ext" href="https://logging.getLogger("pyre"">logging.getLogger("pyre"</a>)</small><br/>
# <a class="ext" href="https://logger.setLevel(logging.INFO">logger.setLevel(logging.INFO</a>)</small><br/>
# <a class="ext" href="https://logger.addHandler(logging.StreamHandler(">logger.addHandler(logging.StreamHandler(</a>)</small>)</small><br/>
# <a class="ext" href="https://logger.propagate">logger.propagate</a> = False<br/>
<br/>
# ctx = <a class="ext" href="https://zmq.Context(">zmq.Context(</a>)</small><br/>
# <a href="chat.htm">chat</a>_pipe = <a class="ext" href="https://zhelper.zthread_fork(ctx">zhelper.zthread_fork(ctx</a>, <a href="chat.htm">chat</a>_task)</small><br/>
# # input in python 2 is different<br/>
# if <a class="ext" href="https://sys.version_info.major">sys.version_info.major</a> < 3:<br/>
# input = raw_input<br/>
<br/>
# while True:<br/>
# try:<br/>
# msg = input<small>()</small><br/>
# <a class="ext" href="https://chat_pipe.send(msg.encode('utf_8'">chat_pipe.send(msg.encode('utf_8'</a>)</small>)</small><br/>
# except <small>(KeyboardInterrupt, SystemExit)</small>:<br/>
# break<br/>
# <a class="ext" href="https://chat_pipe.send("$$STOP".encode('utf_8'">chat_pipe.send("$$STOP".encode('utf_8'</a>)</small>)</small><br/>
# print<small>("FINISHED")</small><br/>
# ```<br/>
<br/>
# Look at the <small>[ZOCP]</small><small>(<a class="ext" href="https://github.com/z25/pyZOCP)">https://github.com/z25/pyZOCP)</a> proj<a href="ec.htm">ec</a>t for examples of how Pyre can be <br/>
# integrated into different environments and frame<a href="work.htm">work</a>s, i.e.:<br/>
# - <small>[Urwid]</small><small>(<a class="ext" href="https://github.com/z25/pyZOCP/blob/master/examples/urwZOCP.py)">https://github.com/z25/pyZOCP/blob/master/examples/urwZOCP.py)</a><br/>
# - <small>[Blender]</small><small>(<a class="ext" href="https://github.com/z25/pyZOCP/blob/master/examples/BpyZOCP.py)">https://github.com/z25/pyZOCP/blob/master/examples/BpyZOCP.py)</a><br/>
# - <small>[Glib]</small><small>(<a class="ext" href="https://github.com/z25/pyZOCP/blob/master/examples/glib_node.py)">https://github.com/z25/pyZOCP/blob/master/examples/glib_node.py)</a><br/>
# - <small>[QT]</small><small>(<a class="ext" href="https://github.com/z25/pyZOCP/blob/master/examples/qt_ui_node.py)">https://github.com/z25/pyZOCP/blob/master/examples/qt_ui_node.py)</a><br/>
<br/>
<br/>
# Pyre uses the <small>[Python Logging]</small><small>(<a class="ext" href="https://docs.python.org/3.4/library/logging.html)">https://docs.python.org/3.4/library/logging.html)</a> module.<br/>
# To change the debug level:<br/>
<br/>
# ```<br/>
# # Create a StreamHandler for debugging<br/>
# logger = <a class="ext" href="https://logging.getLogger("pyre"">logging.getLogger("pyre"</a>)</small><br/>
# <a class="ext" href="https://logger.setLevel(logging.INFO">logger.setLevel(logging.INFO</a>)</small><br/>
# # i.e. <a class="ext" href="https://logging.DEBUG">logging.DEBUG</a>, <a class="ext" href="https://logging.WARNING">logging.WARNING</a><br/>
# <a class="ext" href="https://logger.addHandler(logging.StreamHandler(">logger.addHandler(logging.StreamHandler(</a>)</small>)</small><br/>
# <a class="ext" href="https://logger.propagate">logger.propagate</a> = False<br/>
<br/>
# ```<br/>
<br/>
# ## Requirements<br/>
<br/>
# Python only <a href="need.htm">need</a>s PyZMQ. On some older versions of Python <br/>
# it also <a href="need.htm">need</a>s the <small>[ipaddress]</small><small>(<a class="ext" href="https://docs.python.org/3.4/library/ipaddress.html?highlight=ipaddress#module-ipaddress)">https://docs.python.org/3.4/library/ipaddress.html?highlight=ipaddress#module-ipaddress)</a> module.<br/>
<br/>
# The r<a href="ec.htm">ec</a>ommended Python version is 3.3+<br/>
<br/>
<br/>
# ## Proj<a href="ec.htm">ec</a>t <a href="org.htm">Org</a>anization<br/>
<br/>
# Pyre is <a href="own.htm">own</a>ed by all its authors and contributors. This is an <a href="open.htm">open</a> <a href="sourc.htm">sourc</a>e<br/>
# proj<a href="ec.htm">ec</a>t licensed under the L<a href="gpl.htm">GPL</a>v3. To contribute to Zyre please read the<br/>
# <small>[C4.1 process]</small><small>(<a class="ext" href="http://rfc.zeromq.org/spec:22)">http://rfc.zeromq.org/spec:22)</a> that we use.<br/>
<br/>
# To report an issue, use the <small>[PYRE issue tracker]</small><small>(<a class="ext" href="https://github.com/zeromq/pyre/issues)">https://github.com/zeromq/pyre/issues)</a> at <a class="ext" href="https://github.com.">github.com.</a><br/>
<br/>
# For more information on this proj<a href="ec.htm">ec</a>t's maintenance, see <small>[`<a class="ext" href="https://MAINTENANCE.md`">MAINTENANCE.md`</a>]</small><small>(<a class="ext" href="https://MAINTENANCE.md">MAINTENANCE.md</a>)</small>.<br/>
</p>
<p class='footer'>
Page generated from <a href=".txt/python">python</a> by <a href=".src/lens.el">lens.el</a>.</p>
</body>
</html>