Dirk Alders 4 anos atrás
pai
commit
ddf94e9881

+ 215
- 0
__init__.py Ver arquivo

@@ -0,0 +1,215 @@
1
+#!/usr/bin/env python
2
+# -*- coding: utf-8 -*-
3
+#
4
+"""
5
+state_machine (State Machine)
6
+=============================
7
+
8
+**Author:**
9
+
10
+* Dirk Alders <sudo-dirk@mount-mockery.de>
11
+
12
+**Description:**
13
+
14
+    This Module helps implementing state machines.
15
+
16
+**Submodules:**
17
+
18
+* :class:`state_machine.state_machine`
19
+
20
+**Unittest:**
21
+
22
+    See also the :download:`unittest <state_machine/_testresults_/unittest.pdf>` documentation.
23
+
24
+**Module Documentation:**
25
+
26
+"""
27
+__DEPENDENCIES__ = []
28
+
29
+import logging
30
+import time
31
+
32
+
33
+logger_name = 'STATE_MACHINE'
34
+logger = logging.getLogger(logger_name)
35
+
36
+
37
+__INTERPRETER__ = (2, 3)
38
+"""The supported Interpreter-Versions"""
39
+__DESCRIPTION__ = """This Module helps implementing state machines."""
40
+"""The Module description"""
41
+
42
+
43
+class state_machine(object):
44
+    """
45
+    :param default_state: The default state which is set on initialisation.
46
+    :param log_lvl: The log level, this Module logs to (see Loging-Levels of Module :mod:`logging`)
47
+
48
+    .. note:: Additional keyword parameters well be stored as varibles of the instance (e.g. to give variables or methods for transition condition calculation).
49
+
50
+    A state machine class can be created by deriving it from this class. The transitions are defined by overriding the variable `TRANSITIONS`.
51
+    This Variable is a dictionary, where the key is the start-state and the content is a tuple or list of transitions. Each transition is a tuple or list
52
+    including the following information: (condition-method (str), transition-time (number), target_state (str)).
53
+
54
+    .. note:: The condition-method needs to be implemented as part of the new class.
55
+
56
+    .. note:: It is usefull to define the states as variables of this class.
57
+
58
+
59
+    **Example:**
60
+
61
+    .. literalinclude:: ../examples/example.py
62
+
63
+    .. literalinclude:: ../examples/example.log
64
+    """
65
+    TRANSITIONS = {}
66
+    LOG_PREFIX = 'StateMachine:'
67
+
68
+    def __init__(self, default_state, log_lvl, **kwargs):
69
+        self.__state__ = None
70
+        self.__last_transition_condition__ = None
71
+        self.__conditions_start_time__ = {}
72
+        self.__state_change_callbacks__ = {}
73
+        self.__log_lvl__ = log_lvl
74
+        self.__set_state__(default_state, '__init__')
75
+        for key in kwargs:
76
+            setattr(self, key, kwargs.get(key))
77
+
78
+    def register_state_change_callback(self, state, condition, callback, *args, **kwargs):
79
+        """
80
+        :param state: The target state. The callback will be executed, if the state machine changes to this state. None means all states.
81
+        :type state: str
82
+        :param condition: The transition condition. The callback will be executed, if this condition is responsible for the state change. None means all conditions.
83
+        :type condition: str
84
+        :param callback: The callback to be executed.
85
+
86
+        .. note:: Additional arguments and keyword parameters are supported. These arguments and parameters will be used as arguments and parameters for the callback execution.
87
+
88
+        This methods allows to register callbacks which will be executed on state changes.
89
+        """
90
+        if state not in self.__state_change_callbacks__:
91
+            self.__state_change_callbacks__[state] = {}
92
+        if condition not in self.__state_change_callbacks__[state]:
93
+            self.__state_change_callbacks__[state][condition] = []
94
+        self.__state_change_callbacks__[state][condition].append((callback, args, kwargs))
95
+
96
+    def this_state(self):
97
+        """
98
+        :return: The current state.
99
+
100
+        This method returns the current state of the state machine.
101
+        """
102
+        return self.__state__
103
+
104
+    def this_state_is(self, state):
105
+        """
106
+        :param state: The state to be checked
107
+        :type state: str
108
+        :return: True if the given state is currently active, else False.
109
+        :rtype: bool
110
+
111
+        This methods returns the boolean information if the state machine is currently in the given state.
112
+        """
113
+        return self.__state__ == state
114
+
115
+    def this_state_duration(self):
116
+        """
117
+        :return: The time how long the current state is active.
118
+        :rtype: float
119
+
120
+        This method returns the time how long the current state is active.
121
+        """
122
+        return time.time() - self.__time_stamp_state_change__
123
+
124
+    def last_transition_condition(self):
125
+        """
126
+        :return: The last transition condition.
127
+        :rtype: str
128
+
129
+        This method returns the last transition condition.
130
+        """
131
+        return self.__last_transition_condition__
132
+
133
+    def last_transition_condition_was(self, condition):
134
+        """
135
+        :param condition: The condition to be checked
136
+        :type condition: str
137
+        :return: True if the given condition was the last transition condition, else False.
138
+        :rtype: bool
139
+
140
+        This methods returns the boolean information if the last transition condition is equivalent to the given condition.
141
+        """
142
+        return self.__last_transition_condition__ == condition
143
+
144
+    def previous_state(self):
145
+        """
146
+        :return: The previous state.
147
+        :rtype: str
148
+
149
+        This method returns the previous state of the state machine.
150
+        """
151
+        return self.__prev_state__
152
+
153
+    def previous_state_was(self, state):
154
+        """
155
+        :param state: The state to be checked
156
+        :type state: str
157
+        :return: True if the given state was previously active, else False.
158
+        :rtype: bool
159
+
160
+        This methods returns the boolean information if the state machine was previously in the given state.
161
+        """
162
+        return self.__prev_state__ == state
163
+
164
+    def previous_state_duration(self):
165
+        """
166
+        :return: The time how long the previous state was active.
167
+        :rtype: float
168
+
169
+        This method returns the time how long the previous state was active.
170
+        """
171
+        return self.__prev_state_dt__
172
+
173
+    def __set_state__(self, target_state, condition):
174
+        logger.log(self.__log_lvl__, "%s State change (%s): %s -> %s", self.LOG_PREFIX, repr(condition), repr(self.__state__), repr(target_state))
175
+        timestamp = time.time()
176
+        self.__prev_state__ = self.__state__
177
+        if self.__prev_state__ is None:
178
+            self.__prev_state_dt__ = 0.
179
+        else:
180
+            self.__prev_state_dt__ = timestamp - self.__time_stamp_state_change__
181
+        self.__state__ = target_state
182
+        self.__last_transition_condition__ = condition
183
+        self.__time_stamp_state_change__ = timestamp
184
+        self.__conditions_start_time__ = {}
185
+        for callback, args, kwargs in self.__state_change_callbacks__.get(None, {}).get(None, []):
186
+            callback(*args, **kwargs)
187
+        for callback, args, kwargs in self.__state_change_callbacks__.get(target_state, {}).get(None, []):
188
+            callback(*args, **kwargs)
189
+        for callback, args, kwargs in self.__state_change_callbacks__.get(None, {}).get(condition, []):
190
+            callback(*args, **kwargs)
191
+        for callback, args, kwargs in self.__state_change_callbacks__.get(target_state, {}).get(condition, []):
192
+            callback(*args, **kwargs)
193
+
194
+    def work(self):
195
+        """
196
+        This Method needs to be executed cyclicly to enable the state machine.
197
+        """
198
+        tm = time.time()
199
+        transitions = self.TRANSITIONS.get(self.this_state())
200
+        if transitions is not None:
201
+            active_transitions = []
202
+            cnt = 0
203
+            for method_name, transition_delay, target_state in transitions:
204
+                method = getattr(self, method_name)
205
+                if method():
206
+                    if method_name not in self.__conditions_start_time__:
207
+                        self.__conditions_start_time__[method_name] = tm
208
+                    if tm - self.__conditions_start_time__[method_name] >= transition_delay:
209
+                        active_transitions.append((transition_delay - tm + self.__conditions_start_time__[method_name], cnt, target_state, method_name))
210
+                else:
211
+                    self.__conditions_start_time__[method_name] = tm
212
+                cnt += 1
213
+            if len(active_transitions) > 0:
214
+                active_transitions.sort()
215
+                self.__set_state__(active_transitions[0][2], active_transitions[0][3])

BIN
_docs_/_downloads/unittest.pdf Ver arquivo


+ 23
- 0
_docs_/_sources/index.rst.txt Ver arquivo

@@ -0,0 +1,23 @@
1
+.. state_machine documentation master file, created by
2
+   sphinx-quickstart on Fri May 17 06:48:25 2019.
3
+   You can adapt this file completely to your liking, but it should at least
4
+   contain the root `toctree` directive.
5
+
6
+Welcome to state_machine's documentation!
7
+=========================================
8
+
9
+.. automodule:: state_machine
10
+   :members:
11
+
12
+.. toctree::
13
+   :maxdepth: 2
14
+   :caption: Contents:
15
+
16
+
17
+
18
+Indices and tables
19
+==================
20
+
21
+* :ref:`genindex`
22
+* :ref:`modindex`
23
+* :ref:`search`

BIN
_docs_/_static/ajax-loader.gif Ver arquivo


+ 607
- 0
_docs_/_static/alabaster.css Ver arquivo

@@ -0,0 +1,607 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+@import url("basic.css");
19
+
20
+/* -- page layout ----------------------------------------------------------- */
21
+
22
+body {
23
+    font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif;
24
+    font-size: 17px;
25
+    background-color: white;
26
+    color: #000;
27
+    margin: 0;
28
+    padding: 0;
29
+}
30
+
31
+
32
+div.document {
33
+    width: auto;
34
+    margin: 30px auto 0 auto;
35
+}
36
+
37
+div.documentwrapper {
38
+    float: left;
39
+    width: 100%;
40
+}
41
+
42
+div.bodywrapper {
43
+    margin: 0 0 0 220px;
44
+}
45
+
46
+div.sphinxsidebar {
47
+    width: 220px;
48
+    font-size: 14px;
49
+    line-height: 1.5;
50
+}
51
+
52
+hr {
53
+    border: 1px solid #B1B4B6;
54
+}
55
+
56
+div.body {
57
+    background-color: #ffffff;
58
+    color: #3E4349;
59
+    padding: 0 30px 0 30px;
60
+}
61
+
62
+div.body > .section {
63
+    text-align: left;
64
+}
65
+
66
+div.footer {
67
+    width: auto;
68
+    margin: 20px auto 30px auto;
69
+    font-size: 14px;
70
+    color: #888;
71
+    text-align: right;
72
+}
73
+
74
+div.footer a {
75
+    color: #888;
76
+}
77
+
78
+p.caption {
79
+    font-family: ;
80
+    font-size: inherit;
81
+}
82
+
83
+
84
+div.relations {
85
+    display: none;
86
+}
87
+
88
+
89
+div.sphinxsidebar a {
90
+    color: #444;
91
+    text-decoration: none;
92
+    border-bottom: 1px dotted #999;
93
+}
94
+
95
+div.sphinxsidebar a:hover {
96
+    border-bottom: 1px solid #999;
97
+}
98
+
99
+div.sphinxsidebarwrapper {
100
+    padding: 18px 10px;
101
+}
102
+
103
+div.sphinxsidebarwrapper p.logo {
104
+    padding: 0;
105
+    margin: -10px 0 0 0px;
106
+    text-align: center;
107
+}
108
+
109
+div.sphinxsidebarwrapper h1.logo {
110
+    margin-top: -10px;
111
+    text-align: center;
112
+    margin-bottom: 5px;
113
+    text-align: left;
114
+}
115
+
116
+div.sphinxsidebarwrapper h1.logo-name {
117
+    margin-top: 0px;
118
+}
119
+
120
+div.sphinxsidebarwrapper p.blurb {
121
+    margin-top: 0;
122
+    font-style: normal;
123
+}
124
+
125
+div.sphinxsidebar h3,
126
+div.sphinxsidebar h4 {
127
+    font-family: 'Garamond', 'Georgia', serif;
128
+    color: #444;
129
+    font-size: 24px;
130
+    font-weight: normal;
131
+    margin: 0 0 5px 0;
132
+    padding: 0;
133
+}
134
+
135
+div.sphinxsidebar h4 {
136
+    font-size: 20px;
137
+}
138
+
139
+div.sphinxsidebar h3 a {
140
+    color: #444;
141
+}
142
+
143
+div.sphinxsidebar p.logo a,
144
+div.sphinxsidebar h3 a,
145
+div.sphinxsidebar p.logo a:hover,
146
+div.sphinxsidebar h3 a:hover {
147
+    border: none;
148
+}
149
+
150
+div.sphinxsidebar p {
151
+    color: #555;
152
+    margin: 10px 0;
153
+}
154
+
155
+div.sphinxsidebar ul {
156
+    margin: 10px 0;
157
+    padding: 0;
158
+    color: #000;
159
+}
160
+
161
+div.sphinxsidebar ul li.toctree-l1 > a {
162
+    font-size: 120%;
163
+}
164
+
165
+div.sphinxsidebar ul li.toctree-l2 > a {
166
+    font-size: 110%;
167
+}
168
+
169
+div.sphinxsidebar input {
170
+    border: 1px solid #CCC;
171
+    font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif;
172
+    font-size: 1em;
173
+}
174
+
175
+div.sphinxsidebar hr {
176
+    border: none;
177
+    height: 1px;
178
+    color: #AAA;
179
+    background: #AAA;
180
+
181
+    text-align: left;
182
+    margin-left: 0;
183
+    width: 50%;
184
+}
185
+
186
+/* -- body styles ----------------------------------------------------------- */
187
+
188
+a {
189
+    color: #004B6B;
190
+    text-decoration: underline;
191
+}
192
+
193
+a:hover {
194
+    color: #6D4100;
195
+    text-decoration: underline;
196
+}
197
+
198
+div.body h1,
199
+div.body h2,
200
+div.body h3,
201
+div.body h4,
202
+div.body h5,
203
+div.body h6 {
204
+    font-family: 'Garamond', 'Georgia', serif;
205
+    font-weight: normal;
206
+    margin: 30px 0px 10px 0px;
207
+    padding: 0;
208
+}
209
+
210
+div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
211
+div.body h2 { font-size: 180%; }
212
+div.body h3 { font-size: 150%; }
213
+div.body h4 { font-size: 130%; }
214
+div.body h5 { font-size: 100%; }
215
+div.body h6 { font-size: 100%; }
216
+
217
+a.headerlink {
218
+    color: #DDD;
219
+    padding: 0 4px;
220
+    text-decoration: none;
221
+}
222
+
223
+a.headerlink:hover {
224
+    color: #444;
225
+    background: #EAEAEA;
226
+}
227
+
228
+div.body p, div.body dd, div.body li {
229
+    line-height: 1.4em;
230
+}
231
+
232
+div.admonition {
233
+    margin: 20px 0px;
234
+    padding: 10px 30px;
235
+    background-color: #FCC;
236
+    border: 1px solid #FAA;
237
+}
238
+
239
+div.admonition tt.xref, div.admonition a tt {
240
+    border-bottom: 1px solid #fafafa;
241
+}
242
+
243
+dd div.admonition {
244
+    margin-left: -60px;
245
+    padding-left: 60px;
246
+}
247
+
248
+div.admonition p.admonition-title {
249
+    font-family: 'Garamond', 'Georgia', serif;
250
+    font-weight: normal;
251
+    font-size: 24px;
252
+    margin: 0 0 10px 0;
253
+    padding: 0;
254
+    line-height: 1;
255
+}
256
+
257
+div.admonition p.last {
258
+    margin-bottom: 0;
259
+}
260
+
261
+div.highlight {
262
+    background-color: white;
263
+}
264
+
265
+dt:target, .highlight {
266
+    background: #FAF3E8;
267
+}
268
+
269
+div.note {
270
+    background-color: #EEE;
271
+    border: 1px solid #CCC;
272
+}
273
+
274
+div.seealso {
275
+    background-color: #EEE;
276
+    border: 1px solid #CCC;
277
+}
278
+
279
+div.topic {
280
+    background-color: #eee;
281
+}
282
+
283
+p.admonition-title {
284
+    display: inline;
285
+}
286
+
287
+p.admonition-title:after {
288
+    content: ":";
289
+}
290
+
291
+pre, tt, code {
292
+    font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
293
+    font-size: 0.9em;
294
+}
295
+
296
+.hll {
297
+    background-color: #FFC;
298
+    margin: 0 -12px;
299
+    padding: 0 12px;
300
+    display: block;
301
+}
302
+
303
+img.screenshot {
304
+}
305
+
306
+tt.descname, tt.descclassname, code.descname, code.descclassname {
307
+    font-size: 0.95em;
308
+}
309
+
310
+tt.descname, code.descname {
311
+    padding-right: 0.08em;
312
+}
313
+
314
+img.screenshot {
315
+    -moz-box-shadow: 2px 2px 4px #eee;
316
+    -webkit-box-shadow: 2px 2px 4px #eee;
317
+    box-shadow: 2px 2px 4px #eee;
318
+}
319
+
320
+table.docutils {
321
+    border: 1px solid #888;
322
+    -moz-box-shadow: 2px 2px 4px #eee;
323
+    -webkit-box-shadow: 2px 2px 4px #eee;
324
+    box-shadow: 2px 2px 4px #eee;
325
+}
326
+
327
+table.docutils td, table.docutils th {
328
+    border: 1px solid #888;
329
+    padding: 0.25em 0.7em;
330
+}
331
+
332
+table.field-list, table.footnote {
333
+    border: none;
334
+    -moz-box-shadow: none;
335
+    -webkit-box-shadow: none;
336
+    box-shadow: none;
337
+}
338
+
339
+table.footnote {
340
+    margin: 15px 0;
341
+    width: 100%;
342
+    border: 1px solid #EEE;
343
+    background: #FDFDFD;
344
+    font-size: 0.9em;
345
+}
346
+
347
+table.footnote + table.footnote {
348
+    margin-top: -15px;
349
+    border-top: none;
350
+}
351
+
352
+table.field-list th {
353
+    padding: 0 0.8em 0 0;
354
+}
355
+
356
+table.field-list td {
357
+    padding: 0;
358
+}
359
+
360
+table.field-list p {
361
+    margin-bottom: 0.8em;
362
+}
363
+
364
+table.footnote td.label {
365
+    width: .1px;
366
+    padding: 0.3em 0 0.3em 0.5em;
367
+}
368
+
369
+table.footnote td {
370
+    padding: 0.3em 0.5em;
371
+}
372
+
373
+dl {
374
+    margin: 0;
375
+    padding: 0;
376
+}
377
+
378
+dl dd {
379
+    margin-left: 30px;
380
+}
381
+
382
+blockquote {
383
+    margin: 0 0 0 30px;
384
+    padding: 0;
385
+}
386
+
387
+ul, ol {
388
+    /* Matches the 30px from the narrow-screen "li > ul" selector below */
389
+    margin: 10px 0 10px 30px;
390
+    padding: 0;
391
+}
392
+
393
+pre {
394
+    background: #EEE;
395
+    padding: 7px 30px;
396
+    margin: 15px 0px;
397
+    line-height: 1.3em;
398
+}
399
+
400
+dl pre, blockquote pre, li pre {
401
+    margin-left: 0;
402
+    padding-left: 30px;
403
+}
404
+
405
+dl dl pre {
406
+    margin-left: -90px;
407
+    padding-left: 90px;
408
+}
409
+
410
+tt, code {
411
+    background-color: #ecf0f3;
412
+    color: #222;
413
+    /* padding: 1px 2px; */
414
+}
415
+
416
+tt.xref, code.xref, a tt {
417
+    background-color: #FBFBFB;
418
+    border-bottom: 1px solid white;
419
+}
420
+
421
+a.reference {
422
+    text-decoration: none;
423
+    border-bottom: 1px dotted #004B6B;
424
+}
425
+
426
+/* Don't put an underline on images */
427
+a.image-reference, a.image-reference:hover {
428
+    border-bottom: none;
429
+}
430
+
431
+a.reference:hover {
432
+    border-bottom: 1px solid #6D4100;
433
+}
434
+
435
+a.footnote-reference {
436
+    text-decoration: none;
437
+    font-size: 0.7em;
438
+    vertical-align: top;
439
+    border-bottom: 1px dotted #004B6B;
440
+}
441
+
442
+a.footnote-reference:hover {
443
+    border-bottom: 1px solid #6D4100;
444
+}
445
+
446
+a:hover tt, a:hover code {
447
+    background: #EEE;
448
+}
449
+
450
+
451
+@media screen and (max-width: 870px) {
452
+
453
+    div.sphinxsidebar {
454
+    	display: none;
455
+    }
456
+
457
+    div.document {
458
+       width: 100%;
459
+
460
+    }
461
+
462
+    div.documentwrapper {
463
+    	margin-left: 0;
464
+    	margin-top: 0;
465
+    	margin-right: 0;
466
+    	margin-bottom: 0;
467
+    }
468
+
469
+    div.bodywrapper {
470
+    	margin-top: 0;
471
+    	margin-right: 0;
472
+    	margin-bottom: 0;
473
+    	margin-left: 0;
474
+    }
475
+
476
+    ul {
477
+    	margin-left: 0;
478
+    }
479
+
480
+	li > ul {
481
+        /* Matches the 30px from the "ul, ol" selector above */
482
+		margin-left: 30px;
483
+	}
484
+
485
+    .document {
486
+    	width: auto;
487
+    }
488
+
489
+    .footer {
490
+    	width: auto;
491
+    }
492
+
493
+    .bodywrapper {
494
+    	margin: 0;
495
+    }
496
+
497
+    .footer {
498
+    	width: auto;
499
+    }
500
+
501
+    .github {
502
+        display: none;
503
+    }
504
+
505
+
506
+
507
+}
508
+
509
+
510
+
511
+@media screen and (max-width: 875px) {
512
+
513
+    body {
514
+        margin: 0;
515
+        padding: 20px 30px;
516
+    }
517
+
518
+    div.documentwrapper {
519
+        float: none;
520
+        background: white;
521
+    }
522
+
523
+    div.sphinxsidebar {
524
+        display: block;
525
+        float: none;
526
+        width: 102.5%;
527
+        margin: 50px -30px -20px -30px;
528
+        padding: 10px 20px;
529
+        background: #333;
530
+        color: #FFF;
531
+    }
532
+
533
+    div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
534
+    div.sphinxsidebar h3 a {
535
+        color: white;
536
+    }
537
+
538
+    div.sphinxsidebar a {
539
+        color: #AAA;
540
+    }
541
+
542
+    div.sphinxsidebar p.logo {
543
+        display: none;
544
+    }
545
+
546
+    div.document {
547
+        width: 100%;
548
+        margin: 0;
549
+    }
550
+
551
+    div.footer {
552
+        display: none;
553
+    }
554
+
555
+    div.bodywrapper {
556
+        margin: 0;
557
+    }
558
+
559
+    div.body {
560
+        min-height: 0;
561
+        padding: 0;
562
+    }
563
+
564
+    .rtd_doc_footer {
565
+        display: none;
566
+    }
567
+
568
+    .document {
569
+        width: auto;
570
+    }
571
+
572
+    .footer {
573
+        width: auto;
574
+    }
575
+
576
+    .footer {
577
+        width: auto;
578
+    }
579
+
580
+    .github {
581
+        display: none;
582
+    }
583
+}
584
+
585
+
586
+/* misc. */
587
+
588
+.revsys-inline {
589
+    display: none!important;
590
+}
591
+
592
+/* Make nested-list/multi-paragraph items look better in Releases changelog
593
+ * pages. Without this, docutils' magical list fuckery causes inconsistent
594
+ * formatting between different release sub-lists.
595
+ */
596
+div#changelog > div.section > ul > li > p:only-child {
597
+    margin-bottom: 0;
598
+}
599
+
600
+/* Hide fugly table cell borders in ..bibliography:: directive output */
601
+table.docutils.citation, table.docutils.citation td, table.docutils.citation th {
602
+  border: none;
603
+  /* Below needed in some edge cases; if not applied, bottom shadows appear */
604
+  -moz-box-shadow: none;
605
+  -webkit-box-shadow: none;
606
+  box-shadow: none;
607
+}

+ 648
- 0
_docs_/_static/basic.css Ver arquivo

@@ -0,0 +1,648 @@
1
+/*
2
+ * basic.css
3
+ * ~~~~~~~~~
4
+ *
5
+ * Sphinx stylesheet -- basic theme.
6
+ *
7
+ * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
8
+ * :license: BSD, see LICENSE for details.
9
+ *
10
+ */
11
+
12
+/* -- main layout ----------------------------------------------------------- */
13
+
14
+div.clearer {
15
+    clear: both;
16
+}
17
+
18
+/* -- relbar ---------------------------------------------------------------- */
19
+
20
+div.related {
21
+    width: 100%;
22
+    font-size: 90%;
23
+}
24
+
25
+div.related h3 {
26
+    display: none;
27
+}
28
+
29
+div.related ul {
30
+    margin: 0;
31
+    padding: 0 0 0 10px;
32
+    list-style: none;
33
+}
34
+
35
+div.related li {
36
+    display: inline;
37
+}
38
+
39
+div.related li.right {
40
+    float: right;
41
+    margin-right: 5px;
42
+}
43
+
44
+/* -- sidebar --------------------------------------------------------------- */
45
+
46
+div.sphinxsidebarwrapper {
47
+    padding: 10px 5px 0 10px;
48
+}
49
+
50
+div.sphinxsidebar {
51
+    float: left;
52
+    width: 230px;
53
+    margin-left: -100%;
54
+    font-size: 90%;
55
+    word-wrap: break-word;
56
+    overflow-wrap : break-word;
57
+}
58
+
59
+div.sphinxsidebar ul {
60
+    list-style: none;
61
+}
62
+
63
+div.sphinxsidebar ul ul,
64
+div.sphinxsidebar ul.want-points {
65
+    margin-left: 20px;
66
+    list-style: square;
67
+}
68
+
69
+div.sphinxsidebar ul ul {
70
+    margin-top: 0;
71
+    margin-bottom: 0;
72
+}
73
+
74
+div.sphinxsidebar form {
75
+    margin-top: 10px;
76
+}
77
+
78
+div.sphinxsidebar input {
79
+    border: 1px solid #98dbcc;
80
+    font-family: sans-serif;
81
+    font-size: 1em;
82
+}
83
+
84
+div.sphinxsidebar #searchbox input[type="text"] {
85
+    width: 170px;
86
+}
87
+
88
+img {
89
+    border: 0;
90
+    max-width: 100%;
91
+}
92
+
93
+/* -- search page ----------------------------------------------------------- */
94
+
95
+ul.search {
96
+    margin: 10px 0 0 20px;
97
+    padding: 0;
98
+}
99
+
100
+ul.search li {
101
+    padding: 5px 0 5px 20px;
102
+    background-image: url(file.png);
103
+    background-repeat: no-repeat;
104
+    background-position: 0 7px;
105
+}
106
+
107
+ul.search li a {
108
+    font-weight: bold;
109
+}
110
+
111
+ul.search li div.context {
112
+    color: #888;
113
+    margin: 2px 0 0 30px;
114
+    text-align: left;
115
+}
116
+
117
+ul.keywordmatches li.goodmatch a {
118
+    font-weight: bold;
119
+}
120
+
121
+/* -- index page ------------------------------------------------------------ */
122
+
123
+table.contentstable {
124
+    width: 90%;
125
+    margin-left: auto;
126
+    margin-right: auto;
127
+}
128
+
129
+table.contentstable p.biglink {
130
+    line-height: 150%;
131
+}
132
+
133
+a.biglink {
134
+    font-size: 1.3em;
135
+}
136
+
137
+span.linkdescr {
138
+    font-style: italic;
139
+    padding-top: 5px;
140
+    font-size: 90%;
141
+}
142
+
143
+/* -- general index --------------------------------------------------------- */
144
+
145
+table.indextable {
146
+    width: 100%;
147
+}
148
+
149
+table.indextable td {
150
+    text-align: left;
151
+    vertical-align: top;
152
+}
153
+
154
+table.indextable ul {
155
+    margin-top: 0;
156
+    margin-bottom: 0;
157
+    list-style-type: none;
158
+}
159
+
160
+table.indextable > tbody > tr > td > ul {
161
+    padding-left: 0em;
162
+}
163
+
164
+table.indextable tr.pcap {
165
+    height: 10px;
166
+}
167
+
168
+table.indextable tr.cap {
169
+    margin-top: 10px;
170
+    background-color: #f2f2f2;
171
+}
172
+
173
+img.toggler {
174
+    margin-right: 3px;
175
+    margin-top: 3px;
176
+    cursor: pointer;
177
+}
178
+
179
+div.modindex-jumpbox {
180
+    border-top: 1px solid #ddd;
181
+    border-bottom: 1px solid #ddd;
182
+    margin: 1em 0 1em 0;
183
+    padding: 0.4em;
184
+}
185
+
186
+div.genindex-jumpbox {
187
+    border-top: 1px solid #ddd;
188
+    border-bottom: 1px solid #ddd;
189
+    margin: 1em 0 1em 0;
190
+    padding: 0.4em;
191
+}
192
+
193
+/* -- domain module index --------------------------------------------------- */
194
+
195
+table.modindextable td {
196
+    padding: 2px;
197
+    border-collapse: collapse;
198
+}
199
+
200
+/* -- general body styles --------------------------------------------------- */
201
+
202
+div.body p, div.body dd, div.body li, div.body blockquote {
203
+    -moz-hyphens: auto;
204
+    -ms-hyphens: auto;
205
+    -webkit-hyphens: auto;
206
+    hyphens: auto;
207
+}
208
+
209
+a.headerlink {
210
+    visibility: hidden;
211
+}
212
+
213
+h1:hover > a.headerlink,
214
+h2:hover > a.headerlink,
215
+h3:hover > a.headerlink,
216
+h4:hover > a.headerlink,
217
+h5:hover > a.headerlink,
218
+h6:hover > a.headerlink,
219
+dt:hover > a.headerlink,
220
+caption:hover > a.headerlink,
221
+p.caption:hover > a.headerlink,
222
+div.code-block-caption:hover > a.headerlink {
223
+    visibility: visible;
224
+}
225
+
226
+div.body p.caption {
227
+    text-align: inherit;
228
+}
229
+
230
+div.body td {
231
+    text-align: left;
232
+}
233
+
234
+.first {
235
+    margin-top: 0 !important;
236
+}
237
+
238
+p.rubric {
239
+    margin-top: 30px;
240
+    font-weight: bold;
241
+}
242
+
243
+img.align-left, .figure.align-left, object.align-left {
244
+    clear: left;
245
+    float: left;
246
+    margin-right: 1em;
247
+}
248
+
249
+img.align-right, .figure.align-right, object.align-right {
250
+    clear: right;
251
+    float: right;
252
+    margin-left: 1em;
253
+}
254
+
255
+img.align-center, .figure.align-center, object.align-center {
256
+  display: block;
257
+  margin-left: auto;
258
+  margin-right: auto;
259
+}
260
+
261
+.align-left {
262
+    text-align: left;
263
+}
264
+
265
+.align-center {
266
+    text-align: center;
267
+}
268
+
269
+.align-right {
270
+    text-align: right;
271
+}
272
+
273
+/* -- sidebars -------------------------------------------------------------- */
274
+
275
+div.sidebar {
276
+    margin: 0 0 0.5em 1em;
277
+    border: 1px solid #ddb;
278
+    padding: 7px 7px 0 7px;
279
+    background-color: #ffe;
280
+    width: 40%;
281
+    float: right;
282
+}
283
+
284
+p.sidebar-title {
285
+    font-weight: bold;
286
+}
287
+
288
+/* -- topics ---------------------------------------------------------------- */
289
+
290
+div.topic {
291
+    border: 1px solid #ccc;
292
+    padding: 7px 7px 0 7px;
293
+    margin: 10px 0 10px 0;
294
+}
295
+
296
+p.topic-title {
297
+    font-size: 1.1em;
298
+    font-weight: bold;
299
+    margin-top: 10px;
300
+}
301
+
302
+/* -- admonitions ----------------------------------------------------------- */
303
+
304
+div.admonition {
305
+    margin-top: 10px;
306
+    margin-bottom: 10px;
307
+    padding: 7px;
308
+}
309
+
310
+div.admonition dt {
311
+    font-weight: bold;
312
+}
313
+
314
+div.admonition dl {
315
+    margin-bottom: 0;
316
+}
317
+
318
+p.admonition-title {
319
+    margin: 0px 10px 5px 0px;
320
+    font-weight: bold;
321
+}
322
+
323
+div.body p.centered {
324
+    text-align: center;
325
+    margin-top: 25px;
326
+}
327
+
328
+/* -- tables ---------------------------------------------------------------- */
329
+
330
+table.docutils {
331
+    border: 0;
332
+    border-collapse: collapse;
333
+}
334
+
335
+table.align-center {
336
+    margin-left: auto;
337
+    margin-right: auto;
338
+}
339
+
340
+table caption span.caption-number {
341
+    font-style: italic;
342
+}
343
+
344
+table caption span.caption-text {
345
+}
346
+
347
+table.docutils td, table.docutils th {
348
+    padding: 1px 8px 1px 5px;
349
+    border-top: 0;
350
+    border-left: 0;
351
+    border-right: 0;
352
+    border-bottom: 1px solid #aaa;
353
+}
354
+
355
+table.footnote td, table.footnote th {
356
+    border: 0 !important;
357
+}
358
+
359
+th {
360
+    text-align: left;
361
+    padding-right: 5px;
362
+}
363
+
364
+table.citation {
365
+    border-left: solid 1px gray;
366
+    margin-left: 1px;
367
+}
368
+
369
+table.citation td {
370
+    border-bottom: none;
371
+}
372
+
373
+/* -- figures --------------------------------------------------------------- */
374
+
375
+div.figure {
376
+    margin: 0.5em;
377
+    padding: 0.5em;
378
+}
379
+
380
+div.figure p.caption {
381
+    padding: 0.3em;
382
+}
383
+
384
+div.figure p.caption span.caption-number {
385
+    font-style: italic;
386
+}
387
+
388
+div.figure p.caption span.caption-text {
389
+}
390
+
391
+/* -- field list styles ----------------------------------------------------- */
392
+
393
+table.field-list td, table.field-list th {
394
+    border: 0 !important;
395
+}
396
+
397
+.field-list ul {
398
+    margin: 0;
399
+    padding-left: 1em;
400
+}
401
+
402
+.field-list p {
403
+    margin: 0;
404
+}
405
+
406
+.field-name {
407
+    -moz-hyphens: manual;
408
+    -ms-hyphens: manual;
409
+    -webkit-hyphens: manual;
410
+    hyphens: manual;
411
+}
412
+
413
+/* -- other body styles ----------------------------------------------------- */
414
+
415
+ol.arabic {
416
+    list-style: decimal;
417
+}
418
+
419
+ol.loweralpha {
420
+    list-style: lower-alpha;
421
+}
422
+
423
+ol.upperalpha {
424
+    list-style: upper-alpha;
425
+}
426
+
427
+ol.lowerroman {
428
+    list-style: lower-roman;
429
+}
430
+
431
+ol.upperroman {
432
+    list-style: upper-roman;
433
+}
434
+
435
+dl {
436
+    margin-bottom: 15px;
437
+}
438
+
439
+dd p {
440
+    margin-top: 0px;
441
+}
442
+
443
+dd ul, dd table {
444
+    margin-bottom: 10px;
445
+}
446
+
447
+dd {
448
+    margin-top: 3px;
449
+    margin-bottom: 10px;
450
+    margin-left: 30px;
451
+}
452
+
453
+dt:target, span.highlighted {
454
+    background-color: #fbe54e;
455
+}
456
+
457
+rect.highlighted {
458
+    fill: #fbe54e;
459
+}
460
+
461
+dl.glossary dt {
462
+    font-weight: bold;
463
+    font-size: 1.1em;
464
+}
465
+
466
+.optional {
467
+    font-size: 1.3em;
468
+}
469
+
470
+.sig-paren {
471
+    font-size: larger;
472
+}
473
+
474
+.versionmodified {
475
+    font-style: italic;
476
+}
477
+
478
+.system-message {
479
+    background-color: #fda;
480
+    padding: 5px;
481
+    border: 3px solid red;
482
+}
483
+
484
+.footnote:target  {
485
+    background-color: #ffa;
486
+}
487
+
488
+.line-block {
489
+    display: block;
490
+    margin-top: 1em;
491
+    margin-bottom: 1em;
492
+}
493
+
494
+.line-block .line-block {
495
+    margin-top: 0;
496
+    margin-bottom: 0;
497
+    margin-left: 1.5em;
498
+}
499
+
500
+.guilabel, .menuselection {
501
+    font-family: sans-serif;
502
+}
503
+
504
+.accelerator {
505
+    text-decoration: underline;
506
+}
507
+
508
+.classifier {
509
+    font-style: oblique;
510
+}
511
+
512
+abbr, acronym {
513
+    border-bottom: dotted 1px;
514
+    cursor: help;
515
+}
516
+
517
+/* -- code displays --------------------------------------------------------- */
518
+
519
+pre {
520
+    overflow: auto;
521
+    overflow-y: hidden;  /* fixes display issues on Chrome browsers */
522
+}
523
+
524
+span.pre {
525
+    -moz-hyphens: none;
526
+    -ms-hyphens: none;
527
+    -webkit-hyphens: none;
528
+    hyphens: none;
529
+}
530
+
531
+td.linenos pre {
532
+    padding: 5px 0px;
533
+    border: 0;
534
+    background-color: transparent;
535
+    color: #aaa;
536
+}
537
+
538
+table.highlighttable {
539
+    margin-left: 0.5em;
540
+}
541
+
542
+table.highlighttable td {
543
+    padding: 0 0.5em 0 0.5em;
544
+}
545
+
546
+div.code-block-caption {
547
+    padding: 2px 5px;
548
+    font-size: small;
549
+}
550
+
551
+div.code-block-caption code {
552
+    background-color: transparent;
553
+}
554
+
555
+div.code-block-caption + div > div.highlight > pre {
556
+    margin-top: 0;
557
+}
558
+
559
+div.code-block-caption span.caption-number {
560
+    padding: 0.1em 0.3em;
561
+    font-style: italic;
562
+}
563
+
564
+div.code-block-caption span.caption-text {
565
+}
566
+
567
+div.literal-block-wrapper {
568
+    padding: 1em 1em 0;
569
+}
570
+
571
+div.literal-block-wrapper div.highlight {
572
+    margin: 0;
573
+}
574
+
575
+code.descname {
576
+    background-color: transparent;
577
+    font-weight: bold;
578
+    font-size: 1.2em;
579
+}
580
+
581
+code.descclassname {
582
+    background-color: transparent;
583
+}
584
+
585
+code.xref, a code {
586
+    background-color: transparent;
587
+    font-weight: bold;
588
+}
589
+
590
+h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
591
+    background-color: transparent;
592
+}
593
+
594
+.viewcode-link {
595
+    float: right;
596
+}
597
+
598
+.viewcode-back {
599
+    float: right;
600
+    font-family: sans-serif;
601
+}
602
+
603
+div.viewcode-block:target {
604
+    margin: -1px -10px;
605
+    padding: 0 10px;
606
+}
607
+
608
+/* -- math display ---------------------------------------------------------- */
609
+
610
+img.math {
611
+    vertical-align: middle;
612
+}
613
+
614
+div.body div.math p {
615
+    text-align: center;
616
+}
617
+
618
+span.eqno {
619
+    float: right;
620
+}
621
+
622
+span.eqno a.headerlink {
623
+    position: relative;
624
+    left: 0px;
625
+    z-index: 1;
626
+}
627
+
628
+div.math:hover a.headerlink {
629
+    visibility: visible;
630
+}
631
+
632
+/* -- printout stylesheet --------------------------------------------------- */
633
+
634
+@media print {
635
+    div.document,
636
+    div.documentwrapper,
637
+    div.bodywrapper {
638
+        margin: 0 !important;
639
+        width: 100%;
640
+    }
641
+
642
+    div.sphinxsidebar,
643
+    div.related,
644
+    div.footer,
645
+    #top-link {
646
+        display: none;
647
+    }
648
+}

BIN
_docs_/_static/comment-bright.png Ver arquivo


BIN
_docs_/_static/comment-close.png Ver arquivo


BIN
_docs_/_static/comment.png Ver arquivo


+ 1
- 0
_docs_/_static/custom.css Ver arquivo

@@ -0,0 +1 @@
1
+/* This file intentionally left blank. */

+ 311
- 0
_docs_/_static/doctools.js Ver arquivo

@@ -0,0 +1,311 @@
1
+/*
2
+ * doctools.js
3
+ * ~~~~~~~~~~~
4
+ *
5
+ * Sphinx JavaScript utilities for all documentation.
6
+ *
7
+ * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
8
+ * :license: BSD, see LICENSE for details.
9
+ *
10
+ */
11
+
12
+/**
13
+ * select a different prefix for underscore
14
+ */
15
+$u = _.noConflict();
16
+
17
+/**
18
+ * make the code below compatible with browsers without
19
+ * an installed firebug like debugger
20
+if (!window.console || !console.firebug) {
21
+  var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
22
+    "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
23
+    "profile", "profileEnd"];
24
+  window.console = {};
25
+  for (var i = 0; i < names.length; ++i)
26
+    window.console[names[i]] = function() {};
27
+}
28
+ */
29
+
30
+/**
31
+ * small helper function to urldecode strings
32
+ */
33
+jQuery.urldecode = function(x) {
34
+  return decodeURIComponent(x).replace(/\+/g, ' ');
35
+};
36
+
37
+/**
38
+ * small helper function to urlencode strings
39
+ */
40
+jQuery.urlencode = encodeURIComponent;
41
+
42
+/**
43
+ * This function returns the parsed url parameters of the
44
+ * current request. Multiple values per key are supported,
45
+ * it will always return arrays of strings for the value parts.
46
+ */
47
+jQuery.getQueryParameters = function(s) {
48
+  if (typeof s === 'undefined')
49
+    s = document.location.search;
50
+  var parts = s.substr(s.indexOf('?') + 1).split('&');
51
+  var result = {};
52
+  for (var i = 0; i < parts.length; i++) {
53
+    var tmp = parts[i].split('=', 2);
54
+    var key = jQuery.urldecode(tmp[0]);
55
+    var value = jQuery.urldecode(tmp[1]);
56
+    if (key in result)
57
+      result[key].push(value);
58
+    else
59
+      result[key] = [value];
60
+  }
61
+  return result;
62
+};
63
+
64
+/**
65
+ * highlight a given string on a jquery object by wrapping it in
66
+ * span elements with the given class name.
67
+ */
68
+jQuery.fn.highlightText = function(text, className) {
69
+  function highlight(node, addItems) {
70
+    if (node.nodeType === 3) {
71
+      var val = node.nodeValue;
72
+      var pos = val.toLowerCase().indexOf(text);
73
+      if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
74
+        var span;
75
+        var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
76
+        if (isInSVG) {
77
+          span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
78
+        } else {
79
+          span = document.createElement("span");
80
+          span.className = className;
81
+        }
82
+        span.appendChild(document.createTextNode(val.substr(pos, text.length)));
83
+        node.parentNode.insertBefore(span, node.parentNode.insertBefore(
84
+          document.createTextNode(val.substr(pos + text.length)),
85
+          node.nextSibling));
86
+        node.nodeValue = val.substr(0, pos);
87
+        if (isInSVG) {
88
+          var bbox = span.getBBox();
89
+          var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
90
+       	  rect.x.baseVal.value = bbox.x;
91
+          rect.y.baseVal.value = bbox.y;
92
+          rect.width.baseVal.value = bbox.width;
93
+          rect.height.baseVal.value = bbox.height;
94
+          rect.setAttribute('class', className);
95
+          var parentOfText = node.parentNode.parentNode;
96
+          addItems.push({
97
+              "parent": node.parentNode,
98
+              "target": rect});
99
+        }
100
+      }
101
+    }
102
+    else if (!jQuery(node).is("button, select, textarea")) {
103
+      jQuery.each(node.childNodes, function() {
104
+        highlight(this, addItems);
105
+      });
106
+    }
107
+  }
108
+  var addItems = [];
109
+  var result = this.each(function() {
110
+    highlight(this, addItems);
111
+  });
112
+  for (var i = 0; i < addItems.length; ++i) {
113
+    jQuery(addItems[i].parent).before(addItems[i].target);
114
+  }
115
+  return result;
116
+};
117
+
118
+/*
119
+ * backward compatibility for jQuery.browser
120
+ * This will be supported until firefox bug is fixed.
121
+ */
122
+if (!jQuery.browser) {
123
+  jQuery.uaMatch = function(ua) {
124
+    ua = ua.toLowerCase();
125
+
126
+    var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
127
+      /(webkit)[ \/]([\w.]+)/.exec(ua) ||
128
+      /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
129
+      /(msie) ([\w.]+)/.exec(ua) ||
130
+      ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
131
+      [];
132
+
133
+    return {
134
+      browser: match[ 1 ] || "",
135
+      version: match[ 2 ] || "0"
136
+    };
137
+  };
138
+  jQuery.browser = {};
139
+  jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
140
+}
141
+
142
+/**
143
+ * Small JavaScript module for the documentation.
144
+ */
145
+var Documentation = {
146
+
147
+  init : function() {
148
+    this.fixFirefoxAnchorBug();
149
+    this.highlightSearchWords();
150
+    this.initIndexTable();
151
+    
152
+  },
153
+
154
+  /**
155
+   * i18n support
156
+   */
157
+  TRANSLATIONS : {},
158
+  PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; },
159
+  LOCALE : 'unknown',
160
+
161
+  // gettext and ngettext don't access this so that the functions
162
+  // can safely bound to a different name (_ = Documentation.gettext)
163
+  gettext : function(string) {
164
+    var translated = Documentation.TRANSLATIONS[string];
165
+    if (typeof translated === 'undefined')
166
+      return string;
167
+    return (typeof translated === 'string') ? translated : translated[0];
168
+  },
169
+
170
+  ngettext : function(singular, plural, n) {
171
+    var translated = Documentation.TRANSLATIONS[singular];
172
+    if (typeof translated === 'undefined')
173
+      return (n == 1) ? singular : plural;
174
+    return translated[Documentation.PLURALEXPR(n)];
175
+  },
176
+
177
+  addTranslations : function(catalog) {
178
+    for (var key in catalog.messages)
179
+      this.TRANSLATIONS[key] = catalog.messages[key];
180
+    this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
181
+    this.LOCALE = catalog.locale;
182
+  },
183
+
184
+  /**
185
+   * add context elements like header anchor links
186
+   */
187
+  addContextElements : function() {
188
+    $('div[id] > :header:first').each(function() {
189
+      $('<a class="headerlink">\u00B6</a>').
190
+      attr('href', '#' + this.id).
191
+      attr('title', _('Permalink to this headline')).
192
+      appendTo(this);
193
+    });
194
+    $('dt[id]').each(function() {
195
+      $('<a class="headerlink">\u00B6</a>').
196
+      attr('href', '#' + this.id).
197
+      attr('title', _('Permalink to this definition')).
198
+      appendTo(this);
199
+    });
200
+  },
201
+
202
+  /**
203
+   * workaround a firefox stupidity
204
+   * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
205
+   */
206
+  fixFirefoxAnchorBug : function() {
207
+    if (document.location.hash && $.browser.mozilla)
208
+      window.setTimeout(function() {
209
+        document.location.href += '';
210
+      }, 10);
211
+  },
212
+
213
+  /**
214
+   * highlight the search words provided in the url in the text
215
+   */
216
+  highlightSearchWords : function() {
217
+    var params = $.getQueryParameters();
218
+    var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
219
+    if (terms.length) {
220
+      var body = $('div.body');
221
+      if (!body.length) {
222
+        body = $('body');
223
+      }
224
+      window.setTimeout(function() {
225
+        $.each(terms, function() {
226
+          body.highlightText(this.toLowerCase(), 'highlighted');
227
+        });
228
+      }, 10);
229
+      $('<p class="highlight-link"><a href="javascript:Documentation.' +
230
+        'hideSearchWords()">' + _('Hide Search Matches') + '</a></p>')
231
+          .appendTo($('#searchbox'));
232
+    }
233
+  },
234
+
235
+  /**
236
+   * init the domain index toggle buttons
237
+   */
238
+  initIndexTable : function() {
239
+    var togglers = $('img.toggler').click(function() {
240
+      var src = $(this).attr('src');
241
+      var idnum = $(this).attr('id').substr(7);
242
+      $('tr.cg-' + idnum).toggle();
243
+      if (src.substr(-9) === 'minus.png')
244
+        $(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
245
+      else
246
+        $(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
247
+    }).css('display', '');
248
+    if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {
249
+        togglers.click();
250
+    }
251
+  },
252
+
253
+  /**
254
+   * helper function to hide the search marks again
255
+   */
256
+  hideSearchWords : function() {
257
+    $('#searchbox .highlight-link').fadeOut(300);
258
+    $('span.highlighted').removeClass('highlighted');
259
+  },
260
+
261
+  /**
262
+   * make the url absolute
263
+   */
264
+  makeURL : function(relativeURL) {
265
+    return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
266
+  },
267
+
268
+  /**
269
+   * get the current relative url
270
+   */
271
+  getCurrentURL : function() {
272
+    var path = document.location.pathname;
273
+    var parts = path.split(/\//);
274
+    $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
275
+      if (this === '..')
276
+        parts.pop();
277
+    });
278
+    var url = parts.join('/');
279
+    return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
280
+  },
281
+
282
+  initOnKeyListeners: function() {
283
+    $(document).keyup(function(event) {
284
+      var activeElementType = document.activeElement.tagName;
285
+      // don't navigate when in search box or textarea
286
+      if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') {
287
+        switch (event.keyCode) {
288
+          case 37: // left
289
+            var prevHref = $('link[rel="prev"]').prop('href');
290
+            if (prevHref) {
291
+              window.location.href = prevHref;
292
+              return false;
293
+            }
294
+          case 39: // right
295
+            var nextHref = $('link[rel="next"]').prop('href');
296
+            if (nextHref) {
297
+              window.location.href = nextHref;
298
+              return false;
299
+            }
300
+        }
301
+      }
302
+    });
303
+  }
304
+};
305
+
306
+// quick alias for translations
307
+_ = Documentation.gettext;
308
+
309
+$(document).ready(function() {
310
+  Documentation.init();
311
+});

BIN
_docs_/_static/down-pressed.png Ver arquivo


BIN
_docs_/_static/down.png Ver arquivo


BIN
_docs_/_static/file.png Ver arquivo


+ 10253
- 0
_docs_/_static/jquery.js
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


BIN
_docs_/_static/minus.png Ver arquivo


BIN
_docs_/_static/plus.png Ver arquivo


+ 69
- 0
_docs_/_static/pygments.css Ver arquivo

@@ -0,0 +1,69 @@
1
+.highlight .hll { background-color: #ffffcc }
2
+.highlight  { background: #eeffcc; }
3
+.highlight .c { color: #408090; font-style: italic } /* Comment */
4
+.highlight .err { border: 1px solid #FF0000 } /* Error */
5
+.highlight .k { color: #007020; font-weight: bold } /* Keyword */
6
+.highlight .o { color: #666666 } /* Operator */
7
+.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
8
+.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
9
+.highlight .cp { color: #007020 } /* Comment.Preproc */
10
+.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
11
+.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
12
+.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
13
+.highlight .gd { color: #A00000 } /* Generic.Deleted */
14
+.highlight .ge { font-style: italic } /* Generic.Emph */
15
+.highlight .gr { color: #FF0000 } /* Generic.Error */
16
+.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
17
+.highlight .gi { color: #00A000 } /* Generic.Inserted */
18
+.highlight .go { color: #333333 } /* Generic.Output */
19
+.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
20
+.highlight .gs { font-weight: bold } /* Generic.Strong */
21
+.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
22
+.highlight .gt { color: #0044DD } /* Generic.Traceback */
23
+.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
24
+.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
25
+.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
26
+.highlight .kp { color: #007020 } /* Keyword.Pseudo */
27
+.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
28
+.highlight .kt { color: #902000 } /* Keyword.Type */
29
+.highlight .m { color: #208050 } /* Literal.Number */
30
+.highlight .s { color: #4070a0 } /* Literal.String */
31
+.highlight .na { color: #4070a0 } /* Name.Attribute */
32
+.highlight .nb { color: #007020 } /* Name.Builtin */
33
+.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
34
+.highlight .no { color: #60add5 } /* Name.Constant */
35
+.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
36
+.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
37
+.highlight .ne { color: #007020 } /* Name.Exception */
38
+.highlight .nf { color: #06287e } /* Name.Function */
39
+.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
40
+.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
41
+.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
42
+.highlight .nv { color: #bb60d5 } /* Name.Variable */
43
+.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
44
+.highlight .w { color: #bbbbbb } /* Text.Whitespace */
45
+.highlight .mb { color: #208050 } /* Literal.Number.Bin */
46
+.highlight .mf { color: #208050 } /* Literal.Number.Float */
47
+.highlight .mh { color: #208050 } /* Literal.Number.Hex */
48
+.highlight .mi { color: #208050 } /* Literal.Number.Integer */
49
+.highlight .mo { color: #208050 } /* Literal.Number.Oct */
50
+.highlight .sa { color: #4070a0 } /* Literal.String.Affix */
51
+.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
52
+.highlight .sc { color: #4070a0 } /* Literal.String.Char */
53
+.highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */
54
+.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
55
+.highlight .s2 { color: #4070a0 } /* Literal.String.Double */
56
+.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
57
+.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
58
+.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
59
+.highlight .sx { color: #c65d09 } /* Literal.String.Other */
60
+.highlight .sr { color: #235388 } /* Literal.String.Regex */
61
+.highlight .s1 { color: #4070a0 } /* Literal.String.Single */
62
+.highlight .ss { color: #517918 } /* Literal.String.Symbol */
63
+.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
64
+.highlight .fm { color: #06287e } /* Name.Function.Magic */
65
+.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
66
+.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
67
+.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
68
+.highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */
69
+.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */

+ 761
- 0
_docs_/_static/searchtools.js Ver arquivo

@@ -0,0 +1,761 @@
1
+/*
2
+ * searchtools.js_t
3
+ * ~~~~~~~~~~~~~~~~
4
+ *
5
+ * Sphinx JavaScript utilities for the full-text search.
6
+ *
7
+ * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
8
+ * :license: BSD, see LICENSE for details.
9
+ *
10
+ */
11
+
12
+
13
+/* Non-minified version JS is _stemmer.js if file is provided */ 
14
+/**
15
+ * Porter Stemmer
16
+ */
17
+var Stemmer = function() {
18
+
19
+  var step2list = {
20
+    ational: 'ate',
21
+    tional: 'tion',
22
+    enci: 'ence',
23
+    anci: 'ance',
24
+    izer: 'ize',
25
+    bli: 'ble',
26
+    alli: 'al',
27
+    entli: 'ent',
28
+    eli: 'e',
29
+    ousli: 'ous',
30
+    ization: 'ize',
31
+    ation: 'ate',
32
+    ator: 'ate',
33
+    alism: 'al',
34
+    iveness: 'ive',
35
+    fulness: 'ful',
36
+    ousness: 'ous',
37
+    aliti: 'al',
38
+    iviti: 'ive',
39
+    biliti: 'ble',
40
+    logi: 'log'
41
+  };
42
+
43
+  var step3list = {
44
+    icate: 'ic',
45
+    ative: '',
46
+    alize: 'al',
47
+    iciti: 'ic',
48
+    ical: 'ic',
49
+    ful: '',
50
+    ness: ''
51
+  };
52
+
53
+  var c = "[^aeiou]";          // consonant
54
+  var v = "[aeiouy]";          // vowel
55
+  var C = c + "[^aeiouy]*";    // consonant sequence
56
+  var V = v + "[aeiou]*";      // vowel sequence
57
+
58
+  var mgr0 = "^(" + C + ")?" + V + C;                      // [C]VC... is m>0
59
+  var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$";    // [C]VC[V] is m=1
60
+  var mgr1 = "^(" + C + ")?" + V + C + V + C;              // [C]VCVC... is m>1
61
+  var s_v   = "^(" + C + ")?" + v;                         // vowel in stem
62
+
63
+  this.stemWord = function (w) {
64
+    var stem;
65
+    var suffix;
66
+    var firstch;
67
+    var origword = w;
68
+
69
+    if (w.length < 3)
70
+      return w;
71
+
72
+    var re;
73
+    var re2;
74
+    var re3;
75
+    var re4;
76
+
77
+    firstch = w.substr(0,1);
78
+    if (firstch == "y")
79
+      w = firstch.toUpperCase() + w.substr(1);
80
+
81
+    // Step 1a
82
+    re = /^(.+?)(ss|i)es$/;
83
+    re2 = /^(.+?)([^s])s$/;
84
+
85
+    if (re.test(w))
86
+      w = w.replace(re,"$1$2");
87
+    else if (re2.test(w))
88
+      w = w.replace(re2,"$1$2");
89
+
90
+    // Step 1b
91
+    re = /^(.+?)eed$/;
92
+    re2 = /^(.+?)(ed|ing)$/;
93
+    if (re.test(w)) {
94
+      var fp = re.exec(w);
95
+      re = new RegExp(mgr0);
96
+      if (re.test(fp[1])) {
97
+        re = /.$/;
98
+        w = w.replace(re,"");
99
+      }
100
+    }
101
+    else if (re2.test(w)) {
102
+      var fp = re2.exec(w);
103
+      stem = fp[1];
104
+      re2 = new RegExp(s_v);
105
+      if (re2.test(stem)) {
106
+        w = stem;
107
+        re2 = /(at|bl|iz)$/;
108
+        re3 = new RegExp("([^aeiouylsz])\\1$");
109
+        re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
110
+        if (re2.test(w))
111
+          w = w + "e";
112
+        else if (re3.test(w)) {
113
+          re = /.$/;
114
+          w = w.replace(re,"");
115
+        }
116
+        else if (re4.test(w))
117
+          w = w + "e";
118
+      }
119
+    }
120
+
121
+    // Step 1c
122
+    re = /^(.+?)y$/;
123
+    if (re.test(w)) {
124
+      var fp = re.exec(w);
125
+      stem = fp[1];
126
+      re = new RegExp(s_v);
127
+      if (re.test(stem))
128
+        w = stem + "i";
129
+    }
130
+
131
+    // Step 2
132
+    re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
133
+    if (re.test(w)) {
134
+      var fp = re.exec(w);
135
+      stem = fp[1];
136
+      suffix = fp[2];
137
+      re = new RegExp(mgr0);
138
+      if (re.test(stem))
139
+        w = stem + step2list[suffix];
140
+    }
141
+
142
+    // Step 3
143
+    re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
144
+    if (re.test(w)) {
145
+      var fp = re.exec(w);
146
+      stem = fp[1];
147
+      suffix = fp[2];
148
+      re = new RegExp(mgr0);
149
+      if (re.test(stem))
150
+        w = stem + step3list[suffix];
151
+    }
152
+
153
+    // Step 4
154
+    re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
155
+    re2 = /^(.+?)(s|t)(ion)$/;
156
+    if (re.test(w)) {
157
+      var fp = re.exec(w);
158
+      stem = fp[1];
159
+      re = new RegExp(mgr1);
160
+      if (re.test(stem))
161
+        w = stem;
162
+    }
163
+    else if (re2.test(w)) {
164
+      var fp = re2.exec(w);
165
+      stem = fp[1] + fp[2];
166
+      re2 = new RegExp(mgr1);
167
+      if (re2.test(stem))
168
+        w = stem;
169
+    }
170
+
171
+    // Step 5
172
+    re = /^(.+?)e$/;
173
+    if (re.test(w)) {
174
+      var fp = re.exec(w);
175
+      stem = fp[1];
176
+      re = new RegExp(mgr1);
177
+      re2 = new RegExp(meq1);
178
+      re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
179
+      if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
180
+        w = stem;
181
+    }
182
+    re = /ll$/;
183
+    re2 = new RegExp(mgr1);
184
+    if (re.test(w) && re2.test(w)) {
185
+      re = /.$/;
186
+      w = w.replace(re,"");
187
+    }
188
+
189
+    // and turn initial Y back to y
190
+    if (firstch == "y")
191
+      w = firstch.toLowerCase() + w.substr(1);
192
+    return w;
193
+  }
194
+}
195
+
196
+
197
+
198
+/**
199
+ * Simple result scoring code.
200
+ */
201
+var Scorer = {
202
+  // Implement the following function to further tweak the score for each result
203
+  // The function takes a result array [filename, title, anchor, descr, score]
204
+  // and returns the new score.
205
+  /*
206
+  score: function(result) {
207
+    return result[4];
208
+  },
209
+  */
210
+
211
+  // query matches the full name of an object
212
+  objNameMatch: 11,
213
+  // or matches in the last dotted part of the object name
214
+  objPartialMatch: 6,
215
+  // Additive scores depending on the priority of the object
216
+  objPrio: {0:  15,   // used to be importantResults
217
+            1:  5,   // used to be objectResults
218
+            2: -5},  // used to be unimportantResults
219
+  //  Used when the priority is not in the mapping.
220
+  objPrioDefault: 0,
221
+
222
+  // query found in title
223
+  title: 15,
224
+  // query found in terms
225
+  term: 5
226
+};
227
+
228
+
229
+
230
+
231
+
232
+var splitChars = (function() {
233
+    var result = {};
234
+    var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648,
235
+         1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702,
236
+         2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971,
237
+         2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345,
238
+         3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761,
239
+         3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823,
240
+         4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125,
241
+         8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695,
242
+         11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587,
243
+         43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141];
244
+    var i, j, start, end;
245
+    for (i = 0; i < singles.length; i++) {
246
+        result[singles[i]] = true;
247
+    }
248
+    var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709],
249
+         [722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161],
250
+         [1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568],
251
+         [1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807],
252
+         [1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047],
253
+         [2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383],
254
+         [2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450],
255
+         [2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547],
256
+         [2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673],
257
+         [2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820],
258
+         [2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946],
259
+         [2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023],
260
+         [3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173],
261
+         [3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332],
262
+         [3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481],
263
+         [3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718],
264
+         [3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791],
265
+         [3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095],
266
+         [4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205],
267
+         [4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687],
268
+         [4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968],
269
+         [4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869],
270
+         [5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102],
271
+         [6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271],
272
+         [6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592],
273
+         [6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822],
274
+         [6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167],
275
+         [7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959],
276
+         [7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143],
277
+         [8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318],
278
+         [8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483],
279
+         [8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101],
280
+         [10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567],
281
+         [11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292],
282
+         [12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444],
283
+         [12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783],
284
+         [12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311],
285
+         [19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511],
286
+         [42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774],
287
+         [42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071],
288
+         [43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263],
289
+         [43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519],
290
+         [43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647],
291
+         [43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967],
292
+         [44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295],
293
+         [57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274],
294
+         [64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007],
295
+         [65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381],
296
+         [65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]];
297
+    for (i = 0; i < ranges.length; i++) {
298
+        start = ranges[i][0];
299
+        end = ranges[i][1];
300
+        for (j = start; j <= end; j++) {
301
+            result[j] = true;
302
+        }
303
+    }
304
+    return result;
305
+})();
306
+
307
+function splitQuery(query) {
308
+    var result = [];
309
+    var start = -1;
310
+    for (var i = 0; i < query.length; i++) {
311
+        if (splitChars[query.charCodeAt(i)]) {
312
+            if (start !== -1) {
313
+                result.push(query.slice(start, i));
314
+                start = -1;
315
+            }
316
+        } else if (start === -1) {
317
+            start = i;
318
+        }
319
+    }
320
+    if (start !== -1) {
321
+        result.push(query.slice(start));
322
+    }
323
+    return result;
324
+}
325
+
326
+
327
+
328
+
329
+/**
330
+ * Search Module
331
+ */
332
+var Search = {
333
+
334
+  _index : null,
335
+  _queued_query : null,
336
+  _pulse_status : -1,
337
+
338
+  init : function() {
339
+      var params = $.getQueryParameters();
340
+      if (params.q) {
341
+          var query = params.q[0];
342
+          $('input[name="q"]')[0].value = query;
343
+          this.performSearch(query);
344
+      }
345
+  },
346
+
347
+  loadIndex : function(url) {
348
+    $.ajax({type: "GET", url: url, data: null,
349
+            dataType: "script", cache: true,
350
+            complete: function(jqxhr, textstatus) {
351
+              if (textstatus != "success") {
352
+                document.getElementById("searchindexloader").src = url;
353
+              }
354
+            }});
355
+  },
356
+
357
+  setIndex : function(index) {
358
+    var q;
359
+    this._index = index;
360
+    if ((q = this._queued_query) !== null) {
361
+      this._queued_query = null;
362
+      Search.query(q);
363
+    }
364
+  },
365
+
366
+  hasIndex : function() {
367
+      return this._index !== null;
368
+  },
369
+
370
+  deferQuery : function(query) {
371
+      this._queued_query = query;
372
+  },
373
+
374
+  stopPulse : function() {
375
+      this._pulse_status = 0;
376
+  },
377
+
378
+  startPulse : function() {
379
+    if (this._pulse_status >= 0)
380
+        return;
381
+    function pulse() {
382
+      var i;
383
+      Search._pulse_status = (Search._pulse_status + 1) % 4;
384
+      var dotString = '';
385
+      for (i = 0; i < Search._pulse_status; i++)
386
+        dotString += '.';
387
+      Search.dots.text(dotString);
388
+      if (Search._pulse_status > -1)
389
+        window.setTimeout(pulse, 500);
390
+    }
391
+    pulse();
392
+  },
393
+
394
+  /**
395
+   * perform a search for something (or wait until index is loaded)
396
+   */
397
+  performSearch : function(query) {
398
+    // create the required interface elements
399
+    this.out = $('#search-results');
400
+    this.title = $('<h2>' + _('Searching') + '</h2>').appendTo(this.out);
401
+    this.dots = $('<span></span>').appendTo(this.title);
402
+    this.status = $('<p style="display: none"></p>').appendTo(this.out);
403
+    this.output = $('<ul class="search"/>').appendTo(this.out);
404
+
405
+    $('#search-progress').text(_('Preparing search...'));
406
+    this.startPulse();
407
+
408
+    // index already loaded, the browser was quick!
409
+    if (this.hasIndex())
410
+      this.query(query);
411
+    else
412
+      this.deferQuery(query);
413
+  },
414
+
415
+  /**
416
+   * execute search (requires search index to be loaded)
417
+   */
418
+  query : function(query) {
419
+    var i;
420
+    var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"];
421
+
422
+    // stem the searchterms and add them to the correct list
423
+    var stemmer = new Stemmer();
424
+    var searchterms = [];
425
+    var excluded = [];
426
+    var hlterms = [];
427
+    var tmp = splitQuery(query);
428
+    var objectterms = [];
429
+    for (i = 0; i < tmp.length; i++) {
430
+      if (tmp[i] !== "") {
431
+          objectterms.push(tmp[i].toLowerCase());
432
+      }
433
+
434
+      if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i].match(/^\d+$/) ||
435
+          tmp[i] === "") {
436
+        // skip this "word"
437
+        continue;
438
+      }
439
+      // stem the word
440
+      var word = stemmer.stemWord(tmp[i].toLowerCase());
441
+      // prevent stemmer from cutting word smaller than two chars
442
+      if(word.length < 3 && tmp[i].length >= 3) {
443
+        word = tmp[i];
444
+      }
445
+      var toAppend;
446
+      // select the correct list
447
+      if (word[0] == '-') {
448
+        toAppend = excluded;
449
+        word = word.substr(1);
450
+      }
451
+      else {
452
+        toAppend = searchterms;
453
+        hlterms.push(tmp[i].toLowerCase());
454
+      }
455
+      // only add if not already in the list
456
+      if (!$u.contains(toAppend, word))
457
+        toAppend.push(word);
458
+    }
459
+    var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
460
+
461
+    // console.debug('SEARCH: searching for:');
462
+    // console.info('required: ', searchterms);
463
+    // console.info('excluded: ', excluded);
464
+
465
+    // prepare search
466
+    var terms = this._index.terms;
467
+    var titleterms = this._index.titleterms;
468
+
469
+    // array of [filename, title, anchor, descr, score]
470
+    var results = [];
471
+    $('#search-progress').empty();
472
+
473
+    // lookup as object
474
+    for (i = 0; i < objectterms.length; i++) {
475
+      var others = [].concat(objectterms.slice(0, i),
476
+                             objectterms.slice(i+1, objectterms.length));
477
+      results = results.concat(this.performObjectSearch(objectterms[i], others));
478
+    }
479
+
480
+    // lookup as search terms in fulltext
481
+    results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms));
482
+
483
+    // let the scorer override scores with a custom scoring function
484
+    if (Scorer.score) {
485
+      for (i = 0; i < results.length; i++)
486
+        results[i][4] = Scorer.score(results[i]);
487
+    }
488
+
489
+    // now sort the results by score (in opposite order of appearance, since the
490
+    // display function below uses pop() to retrieve items) and then
491
+    // alphabetically
492
+    results.sort(function(a, b) {
493
+      var left = a[4];
494
+      var right = b[4];
495
+      if (left > right) {
496
+        return 1;
497
+      } else if (left < right) {
498
+        return -1;
499
+      } else {
500
+        // same score: sort alphabetically
501
+        left = a[1].toLowerCase();
502
+        right = b[1].toLowerCase();
503
+        return (left > right) ? -1 : ((left < right) ? 1 : 0);
504
+      }
505
+    });
506
+
507
+    // for debugging
508
+    //Search.lastresults = results.slice();  // a copy
509
+    //console.info('search results:', Search.lastresults);
510
+
511
+    // print the results
512
+    var resultCount = results.length;
513
+    function displayNextItem() {
514
+      // results left, load the summary and display it
515
+      if (results.length) {
516
+        var item = results.pop();
517
+        var listItem = $('<li style="display:none"></li>');
518
+        if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') {
519
+          // dirhtml builder
520
+          var dirname = item[0] + '/';
521
+          if (dirname.match(/\/index\/$/)) {
522
+            dirname = dirname.substring(0, dirname.length-6);
523
+          } else if (dirname == 'index/') {
524
+            dirname = '';
525
+          }
526
+          listItem.append($('<a/>').attr('href',
527
+            DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
528
+            highlightstring + item[2]).html(item[1]));
529
+        } else {
530
+          // normal html builders
531
+          listItem.append($('<a/>').attr('href',
532
+            item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
533
+            highlightstring + item[2]).html(item[1]));
534
+        }
535
+        if (item[3]) {
536
+          listItem.append($('<span> (' + item[3] + ')</span>'));
537
+          Search.output.append(listItem);
538
+          listItem.slideDown(5, function() {
539
+            displayNextItem();
540
+          });
541
+        } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
542
+          var suffix = DOCUMENTATION_OPTIONS.SOURCELINK_SUFFIX;
543
+          if (suffix === undefined) {
544
+            suffix = '.txt';
545
+          }
546
+          $.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5] + (item[5].slice(-suffix.length) === suffix ? '' : suffix),
547
+                  dataType: "text",
548
+                  complete: function(jqxhr, textstatus) {
549
+                    var data = jqxhr.responseText;
550
+                    if (data !== '' && data !== undefined) {
551
+                      listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
552
+                    }
553
+                    Search.output.append(listItem);
554
+                    listItem.slideDown(5, function() {
555
+                      displayNextItem();
556
+                    });
557
+                  }});
558
+        } else {
559
+          // no source available, just display title
560
+          Search.output.append(listItem);
561
+          listItem.slideDown(5, function() {
562
+            displayNextItem();
563
+          });
564
+        }
565
+      }
566
+      // search finished, update title and status message
567
+      else {
568
+        Search.stopPulse();
569
+        Search.title.text(_('Search Results'));
570
+        if (!resultCount)
571
+          Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
572
+        else
573
+            Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
574
+        Search.status.fadeIn(500);
575
+      }
576
+    }
577
+    displayNextItem();
578
+  },
579
+
580
+  /**
581
+   * search for object names
582
+   */
583
+  performObjectSearch : function(object, otherterms) {
584
+    var filenames = this._index.filenames;
585
+    var docnames = this._index.docnames;
586
+    var objects = this._index.objects;
587
+    var objnames = this._index.objnames;
588
+    var titles = this._index.titles;
589
+
590
+    var i;
591
+    var results = [];
592
+
593
+    for (var prefix in objects) {
594
+      for (var name in objects[prefix]) {
595
+        var fullname = (prefix ? prefix + '.' : '') + name;
596
+        if (fullname.toLowerCase().indexOf(object) > -1) {
597
+          var score = 0;
598
+          var parts = fullname.split('.');
599
+          // check for different match types: exact matches of full name or
600
+          // "last name" (i.e. last dotted part)
601
+          if (fullname == object || parts[parts.length - 1] == object) {
602
+            score += Scorer.objNameMatch;
603
+          // matches in last name
604
+          } else if (parts[parts.length - 1].indexOf(object) > -1) {
605
+            score += Scorer.objPartialMatch;
606
+          }
607
+          var match = objects[prefix][name];
608
+          var objname = objnames[match[1]][2];
609
+          var title = titles[match[0]];
610
+          // If more than one term searched for, we require other words to be
611
+          // found in the name/title/description
612
+          if (otherterms.length > 0) {
613
+            var haystack = (prefix + ' ' + name + ' ' +
614
+                            objname + ' ' + title).toLowerCase();
615
+            var allfound = true;
616
+            for (i = 0; i < otherterms.length; i++) {
617
+              if (haystack.indexOf(otherterms[i]) == -1) {
618
+                allfound = false;
619
+                break;
620
+              }
621
+            }
622
+            if (!allfound) {
623
+              continue;
624
+            }
625
+          }
626
+          var descr = objname + _(', in ') + title;
627
+
628
+          var anchor = match[3];
629
+          if (anchor === '')
630
+            anchor = fullname;
631
+          else if (anchor == '-')
632
+            anchor = objnames[match[1]][1] + '-' + fullname;
633
+          // add custom score for some objects according to scorer
634
+          if (Scorer.objPrio.hasOwnProperty(match[2])) {
635
+            score += Scorer.objPrio[match[2]];
636
+          } else {
637
+            score += Scorer.objPrioDefault;
638
+          }
639
+          results.push([docnames[match[0]], fullname, '#'+anchor, descr, score, filenames[match[0]]]);
640
+        }
641
+      }
642
+    }
643
+
644
+    return results;
645
+  },
646
+
647
+  /**
648
+   * search for full-text terms in the index
649
+   */
650
+  performTermsSearch : function(searchterms, excluded, terms, titleterms) {
651
+    var docnames = this._index.docnames;
652
+    var filenames = this._index.filenames;
653
+    var titles = this._index.titles;
654
+
655
+    var i, j, file;
656
+    var fileMap = {};
657
+    var scoreMap = {};
658
+    var results = [];
659
+
660
+    // perform the search on the required terms
661
+    for (i = 0; i < searchterms.length; i++) {
662
+      var word = searchterms[i];
663
+      var files = [];
664
+      var _o = [
665
+        {files: terms[word], score: Scorer.term},
666
+        {files: titleterms[word], score: Scorer.title}
667
+      ];
668
+
669
+      // no match but word was a required one
670
+      if ($u.every(_o, function(o){return o.files === undefined;})) {
671
+        break;
672
+      }
673
+      // found search word in contents
674
+      $u.each(_o, function(o) {
675
+        var _files = o.files;
676
+        if (_files === undefined)
677
+          return
678
+
679
+        if (_files.length === undefined)
680
+          _files = [_files];
681
+        files = files.concat(_files);
682
+
683
+        // set score for the word in each file to Scorer.term
684
+        for (j = 0; j < _files.length; j++) {
685
+          file = _files[j];
686
+          if (!(file in scoreMap))
687
+            scoreMap[file] = {}
688
+          scoreMap[file][word] = o.score;
689
+        }
690
+      });
691
+
692
+      // create the mapping
693
+      for (j = 0; j < files.length; j++) {
694
+        file = files[j];
695
+        if (file in fileMap)
696
+          fileMap[file].push(word);
697
+        else
698
+          fileMap[file] = [word];
699
+      }
700
+    }
701
+
702
+    // now check if the files don't contain excluded terms
703
+    for (file in fileMap) {
704
+      var valid = true;
705
+
706
+      // check if all requirements are matched
707
+      if (fileMap[file].length != searchterms.length)
708
+          continue;
709
+
710
+      // ensure that none of the excluded terms is in the search result
711
+      for (i = 0; i < excluded.length; i++) {
712
+        if (terms[excluded[i]] == file ||
713
+            titleterms[excluded[i]] == file ||
714
+            $u.contains(terms[excluded[i]] || [], file) ||
715
+            $u.contains(titleterms[excluded[i]] || [], file)) {
716
+          valid = false;
717
+          break;
718
+        }
719
+      }
720
+
721
+      // if we have still a valid result we can add it to the result list
722
+      if (valid) {
723
+        // select one (max) score for the file.
724
+        // for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
725
+        var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
726
+        results.push([docnames[file], titles[file], '', null, score, filenames[file]]);
727
+      }
728
+    }
729
+    return results;
730
+  },
731
+
732
+  /**
733
+   * helper function to return a node containing the
734
+   * search summary for a given text. keywords is a list
735
+   * of stemmed words, hlwords is the list of normal, unstemmed
736
+   * words. the first one is used to find the occurrence, the
737
+   * latter for highlighting it.
738
+   */
739
+  makeSearchSummary : function(text, keywords, hlwords) {
740
+    var textLower = text.toLowerCase();
741
+    var start = 0;
742
+    $.each(keywords, function() {
743
+      var i = textLower.indexOf(this.toLowerCase());
744
+      if (i > -1)
745
+        start = i;
746
+    });
747
+    start = Math.max(start - 120, 0);
748
+    var excerpt = ((start > 0) ? '...' : '') +
749
+      $.trim(text.substr(start, 240)) +
750
+      ((start + 240 - text.length) ? '...' : '');
751
+    var rv = $('<div class="context"></div>').text(excerpt);
752
+    $.each(hlwords, function() {
753
+      rv = rv.highlightText(this, 'highlighted');
754
+    });
755
+    return rv;
756
+  }
757
+};
758
+
759
+$(document).ready(function() {
760
+  Search.init();
761
+});

+ 1548
- 0
_docs_/_static/underscore.js
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


BIN
_docs_/_static/up-pressed.png Ver arquivo


BIN
_docs_/_static/up.png Ver arquivo


+ 808
- 0
_docs_/_static/websupport.js Ver arquivo

@@ -0,0 +1,808 @@
1
+/*
2
+ * websupport.js
3
+ * ~~~~~~~~~~~~~
4
+ *
5
+ * sphinx.websupport utilities for all documentation.
6
+ *
7
+ * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
8
+ * :license: BSD, see LICENSE for details.
9
+ *
10
+ */
11
+
12
+(function($) {
13
+  $.fn.autogrow = function() {
14
+    return this.each(function() {
15
+    var textarea = this;
16
+
17
+    $.fn.autogrow.resize(textarea);
18
+
19
+    $(textarea)
20
+      .focus(function() {
21
+        textarea.interval = setInterval(function() {
22
+          $.fn.autogrow.resize(textarea);
23
+        }, 500);
24
+      })
25
+      .blur(function() {
26
+        clearInterval(textarea.interval);
27
+      });
28
+    });
29
+  };
30
+
31
+  $.fn.autogrow.resize = function(textarea) {
32
+    var lineHeight = parseInt($(textarea).css('line-height'), 10);
33
+    var lines = textarea.value.split('\n');
34
+    var columns = textarea.cols;
35
+    var lineCount = 0;
36
+    $.each(lines, function() {
37
+      lineCount += Math.ceil(this.length / columns) || 1;
38
+    });
39
+    var height = lineHeight * (lineCount + 1);
40
+    $(textarea).css('height', height);
41
+  };
42
+})(jQuery);
43
+
44
+(function($) {
45
+  var comp, by;
46
+
47
+  function init() {
48
+    initEvents();
49
+    initComparator();
50
+  }
51
+
52
+  function initEvents() {
53
+    $(document).on("click", 'a.comment-close', function(event) {
54
+      event.preventDefault();
55
+      hide($(this).attr('id').substring(2));
56
+    });
57
+    $(document).on("click", 'a.vote', function(event) {
58
+      event.preventDefault();
59
+      handleVote($(this));
60
+    });
61
+    $(document).on("click", 'a.reply', function(event) {
62
+      event.preventDefault();
63
+      openReply($(this).attr('id').substring(2));
64
+    });
65
+    $(document).on("click", 'a.close-reply', function(event) {
66
+      event.preventDefault();
67
+      closeReply($(this).attr('id').substring(2));
68
+    });
69
+    $(document).on("click", 'a.sort-option', function(event) {
70
+      event.preventDefault();
71
+      handleReSort($(this));
72
+    });
73
+    $(document).on("click", 'a.show-proposal', function(event) {
74
+      event.preventDefault();
75
+      showProposal($(this).attr('id').substring(2));
76
+    });
77
+    $(document).on("click", 'a.hide-proposal', function(event) {
78
+      event.preventDefault();
79
+      hideProposal($(this).attr('id').substring(2));
80
+    });
81
+    $(document).on("click", 'a.show-propose-change', function(event) {
82
+      event.preventDefault();
83
+      showProposeChange($(this).attr('id').substring(2));
84
+    });
85
+    $(document).on("click", 'a.hide-propose-change', function(event) {
86
+      event.preventDefault();
87
+      hideProposeChange($(this).attr('id').substring(2));
88
+    });
89
+    $(document).on("click", 'a.accept-comment', function(event) {
90
+      event.preventDefault();
91
+      acceptComment($(this).attr('id').substring(2));
92
+    });
93
+    $(document).on("click", 'a.delete-comment', function(event) {
94
+      event.preventDefault();
95
+      deleteComment($(this).attr('id').substring(2));
96
+    });
97
+    $(document).on("click", 'a.comment-markup', function(event) {
98
+      event.preventDefault();
99
+      toggleCommentMarkupBox($(this).attr('id').substring(2));
100
+    });
101
+  }
102
+
103
+  /**
104
+   * Set comp, which is a comparator function used for sorting and
105
+   * inserting comments into the list.
106
+   */
107
+  function setComparator() {
108
+    // If the first three letters are "asc", sort in ascending order
109
+    // and remove the prefix.
110
+    if (by.substring(0,3) == 'asc') {
111
+      var i = by.substring(3);
112
+      comp = function(a, b) { return a[i] - b[i]; };
113
+    } else {
114
+      // Otherwise sort in descending order.
115
+      comp = function(a, b) { return b[by] - a[by]; };
116
+    }
117
+
118
+    // Reset link styles and format the selected sort option.
119
+    $('a.sel').attr('href', '#').removeClass('sel');
120
+    $('a.by' + by).removeAttr('href').addClass('sel');
121
+  }
122
+
123
+  /**
124
+   * Create a comp function. If the user has preferences stored in
125
+   * the sortBy cookie, use those, otherwise use the default.
126
+   */
127
+  function initComparator() {
128
+    by = 'rating'; // Default to sort by rating.
129
+    // If the sortBy cookie is set, use that instead.
130
+    if (document.cookie.length > 0) {
131
+      var start = document.cookie.indexOf('sortBy=');
132
+      if (start != -1) {
133
+        start = start + 7;
134
+        var end = document.cookie.indexOf(";", start);
135
+        if (end == -1) {
136
+          end = document.cookie.length;
137
+          by = unescape(document.cookie.substring(start, end));
138
+        }
139
+      }
140
+    }
141
+    setComparator();
142
+  }
143
+
144
+  /**
145
+   * Show a comment div.
146
+   */
147
+  function show(id) {
148
+    $('#ao' + id).hide();
149
+    $('#ah' + id).show();
150
+    var context = $.extend({id: id}, opts);
151
+    var popup = $(renderTemplate(popupTemplate, context)).hide();
152
+    popup.find('textarea[name="proposal"]').hide();
153
+    popup.find('a.by' + by).addClass('sel');
154
+    var form = popup.find('#cf' + id);
155
+    form.submit(function(event) {
156
+      event.preventDefault();
157
+      addComment(form);
158
+    });
159
+    $('#s' + id).after(popup);
160
+    popup.slideDown('fast', function() {
161
+      getComments(id);
162
+    });
163
+  }
164
+
165
+  /**
166
+   * Hide a comment div.
167
+   */
168
+  function hide(id) {
169
+    $('#ah' + id).hide();
170
+    $('#ao' + id).show();
171
+    var div = $('#sc' + id);
172
+    div.slideUp('fast', function() {
173
+      div.remove();
174
+    });
175
+  }
176
+
177
+  /**
178
+   * Perform an ajax request to get comments for a node
179
+   * and insert the comments into the comments tree.
180
+   */
181
+  function getComments(id) {
182
+    $.ajax({
183
+     type: 'GET',
184
+     url: opts.getCommentsURL,
185
+     data: {node: id},
186
+     success: function(data, textStatus, request) {
187
+       var ul = $('#cl' + id);
188
+       var speed = 100;
189
+       $('#cf' + id)
190
+         .find('textarea[name="proposal"]')
191
+         .data('source', data.source);
192
+
193
+       if (data.comments.length === 0) {
194
+         ul.html('<li>No comments yet.</li>');
195
+         ul.data('empty', true);
196
+       } else {
197
+         // If there are comments, sort them and put them in the list.
198
+         var comments = sortComments(data.comments);
199
+         speed = data.comments.length * 100;
200
+         appendComments(comments, ul);
201
+         ul.data('empty', false);
202
+       }
203
+       $('#cn' + id).slideUp(speed + 200);
204
+       ul.slideDown(speed);
205
+     },
206
+     error: function(request, textStatus, error) {
207
+       showError('Oops, there was a problem retrieving the comments.');
208
+     },
209
+     dataType: 'json'
210
+    });
211
+  }
212
+
213
+  /**
214
+   * Add a comment via ajax and insert the comment into the comment tree.
215
+   */
216
+  function addComment(form) {
217
+    var node_id = form.find('input[name="node"]').val();
218
+    var parent_id = form.find('input[name="parent"]').val();
219
+    var text = form.find('textarea[name="comment"]').val();
220
+    var proposal = form.find('textarea[name="proposal"]').val();
221
+
222
+    if (text == '') {
223
+      showError('Please enter a comment.');
224
+      return;
225
+    }
226
+
227
+    // Disable the form that is being submitted.
228
+    form.find('textarea,input').attr('disabled', 'disabled');
229
+
230
+    // Send the comment to the server.
231
+    $.ajax({
232
+      type: "POST",
233
+      url: opts.addCommentURL,
234
+      dataType: 'json',
235
+      data: {
236
+        node: node_id,
237
+        parent: parent_id,
238
+        text: text,
239
+        proposal: proposal
240
+      },
241
+      success: function(data, textStatus, error) {
242
+        // Reset the form.
243
+        if (node_id) {
244
+          hideProposeChange(node_id);
245
+        }
246
+        form.find('textarea')
247
+          .val('')
248
+          .add(form.find('input'))
249
+          .removeAttr('disabled');
250
+	var ul = $('#cl' + (node_id || parent_id));
251
+        if (ul.data('empty')) {
252
+          $(ul).empty();
253
+          ul.data('empty', false);
254
+        }
255
+        insertComment(data.comment);
256
+        var ao = $('#ao' + node_id);
257
+        ao.find('img').attr({'src': opts.commentBrightImage});
258
+        if (node_id) {
259
+          // if this was a "root" comment, remove the commenting box
260
+          // (the user can get it back by reopening the comment popup)
261
+          $('#ca' + node_id).slideUp();
262
+        }
263
+      },
264
+      error: function(request, textStatus, error) {
265
+        form.find('textarea,input').removeAttr('disabled');
266
+        showError('Oops, there was a problem adding the comment.');
267
+      }
268
+    });
269
+  }
270
+
271
+  /**
272
+   * Recursively append comments to the main comment list and children
273
+   * lists, creating the comment tree.
274
+   */
275
+  function appendComments(comments, ul) {
276
+    $.each(comments, function() {
277
+      var div = createCommentDiv(this);
278
+      ul.append($(document.createElement('li')).html(div));
279
+      appendComments(this.children, div.find('ul.comment-children'));
280
+      // To avoid stagnating data, don't store the comments children in data.
281
+      this.children = null;
282
+      div.data('comment', this);
283
+    });
284
+  }
285
+
286
+  /**
287
+   * After adding a new comment, it must be inserted in the correct
288
+   * location in the comment tree.
289
+   */
290
+  function insertComment(comment) {
291
+    var div = createCommentDiv(comment);
292
+
293
+    // To avoid stagnating data, don't store the comments children in data.
294
+    comment.children = null;
295
+    div.data('comment', comment);
296
+
297
+    var ul = $('#cl' + (comment.node || comment.parent));
298
+    var siblings = getChildren(ul);
299
+
300
+    var li = $(document.createElement('li'));
301
+    li.hide();
302
+
303
+    // Determine where in the parents children list to insert this comment.
304
+    for(i=0; i < siblings.length; i++) {
305
+      if (comp(comment, siblings[i]) <= 0) {
306
+        $('#cd' + siblings[i].id)
307
+          .parent()
308
+          .before(li.html(div));
309
+        li.slideDown('fast');
310
+        return;
311
+      }
312
+    }
313
+
314
+    // If we get here, this comment rates lower than all the others,
315
+    // or it is the only comment in the list.
316
+    ul.append(li.html(div));
317
+    li.slideDown('fast');
318
+  }
319
+
320
+  function acceptComment(id) {
321
+    $.ajax({
322
+      type: 'POST',
323
+      url: opts.acceptCommentURL,
324
+      data: {id: id},
325
+      success: function(data, textStatus, request) {
326
+        $('#cm' + id).fadeOut('fast');
327
+        $('#cd' + id).removeClass('moderate');
328
+      },
329
+      error: function(request, textStatus, error) {
330
+        showError('Oops, there was a problem accepting the comment.');
331
+      }
332
+    });
333
+  }
334
+
335
+  function deleteComment(id) {
336
+    $.ajax({
337
+      type: 'POST',
338
+      url: opts.deleteCommentURL,
339
+      data: {id: id},
340
+      success: function(data, textStatus, request) {
341
+        var div = $('#cd' + id);
342
+        if (data == 'delete') {
343
+          // Moderator mode: remove the comment and all children immediately
344
+          div.slideUp('fast', function() {
345
+            div.remove();
346
+          });
347
+          return;
348
+        }
349
+        // User mode: only mark the comment as deleted
350
+        div
351
+          .find('span.user-id:first')
352
+          .text('[deleted]').end()
353
+          .find('div.comment-text:first')
354
+          .text('[deleted]').end()
355
+          .find('#cm' + id + ', #dc' + id + ', #ac' + id + ', #rc' + id +
356
+                ', #sp' + id + ', #hp' + id + ', #cr' + id + ', #rl' + id)
357
+          .remove();
358
+        var comment = div.data('comment');
359
+        comment.username = '[deleted]';
360
+        comment.text = '[deleted]';
361
+        div.data('comment', comment);
362
+      },
363
+      error: function(request, textStatus, error) {
364
+        showError('Oops, there was a problem deleting the comment.');
365
+      }
366
+    });
367
+  }
368
+
369
+  function showProposal(id) {
370
+    $('#sp' + id).hide();
371
+    $('#hp' + id).show();
372
+    $('#pr' + id).slideDown('fast');
373
+  }
374
+
375
+  function hideProposal(id) {
376
+    $('#hp' + id).hide();
377
+    $('#sp' + id).show();
378
+    $('#pr' + id).slideUp('fast');
379
+  }
380
+
381
+  function showProposeChange(id) {
382
+    $('#pc' + id).hide();
383
+    $('#hc' + id).show();
384
+    var textarea = $('#pt' + id);
385
+    textarea.val(textarea.data('source'));
386
+    $.fn.autogrow.resize(textarea[0]);
387
+    textarea.slideDown('fast');
388
+  }
389
+
390
+  function hideProposeChange(id) {
391
+    $('#hc' + id).hide();
392
+    $('#pc' + id).show();
393
+    var textarea = $('#pt' + id);
394
+    textarea.val('').removeAttr('disabled');
395
+    textarea.slideUp('fast');
396
+  }
397
+
398
+  function toggleCommentMarkupBox(id) {
399
+    $('#mb' + id).toggle();
400
+  }
401
+
402
+  /** Handle when the user clicks on a sort by link. */
403
+  function handleReSort(link) {
404
+    var classes = link.attr('class').split(/\s+/);
405
+    for (var i=0; i<classes.length; i++) {
406
+      if (classes[i] != 'sort-option') {
407
+	by = classes[i].substring(2);
408
+      }
409
+    }
410
+    setComparator();
411
+    // Save/update the sortBy cookie.
412
+    var expiration = new Date();
413
+    expiration.setDate(expiration.getDate() + 365);
414
+    document.cookie= 'sortBy=' + escape(by) +
415
+                     ';expires=' + expiration.toUTCString();
416
+    $('ul.comment-ul').each(function(index, ul) {
417
+      var comments = getChildren($(ul), true);
418
+      comments = sortComments(comments);
419
+      appendComments(comments, $(ul).empty());
420
+    });
421
+  }
422
+
423
+  /**
424
+   * Function to process a vote when a user clicks an arrow.
425
+   */
426
+  function handleVote(link) {
427
+    if (!opts.voting) {
428
+      showError("You'll need to login to vote.");
429
+      return;
430
+    }
431
+
432
+    var id = link.attr('id');
433
+    if (!id) {
434
+      // Didn't click on one of the voting arrows.
435
+      return;
436
+    }
437
+    // If it is an unvote, the new vote value is 0,
438
+    // Otherwise it's 1 for an upvote, or -1 for a downvote.
439
+    var value = 0;
440
+    if (id.charAt(1) != 'u') {
441
+      value = id.charAt(0) == 'u' ? 1 : -1;
442
+    }
443
+    // The data to be sent to the server.
444
+    var d = {
445
+      comment_id: id.substring(2),
446
+      value: value
447
+    };
448
+
449
+    // Swap the vote and unvote links.
450
+    link.hide();
451
+    $('#' + id.charAt(0) + (id.charAt(1) == 'u' ? 'v' : 'u') + d.comment_id)
452
+      .show();
453
+
454
+    // The div the comment is displayed in.
455
+    var div = $('div#cd' + d.comment_id);
456
+    var data = div.data('comment');
457
+
458
+    // If this is not an unvote, and the other vote arrow has
459
+    // already been pressed, unpress it.
460
+    if ((d.value !== 0) && (data.vote === d.value * -1)) {
461
+      $('#' + (d.value == 1 ? 'd' : 'u') + 'u' + d.comment_id).hide();
462
+      $('#' + (d.value == 1 ? 'd' : 'u') + 'v' + d.comment_id).show();
463
+    }
464
+
465
+    // Update the comments rating in the local data.
466
+    data.rating += (data.vote === 0) ? d.value : (d.value - data.vote);
467
+    data.vote = d.value;
468
+    div.data('comment', data);
469
+
470
+    // Change the rating text.
471
+    div.find('.rating:first')
472
+      .text(data.rating + ' point' + (data.rating == 1 ? '' : 's'));
473
+
474
+    // Send the vote information to the server.
475
+    $.ajax({
476
+      type: "POST",
477
+      url: opts.processVoteURL,
478
+      data: d,
479
+      error: function(request, textStatus, error) {
480
+        showError('Oops, there was a problem casting that vote.');
481
+      }
482
+    });
483
+  }
484
+
485
+  /**
486
+   * Open a reply form used to reply to an existing comment.
487
+   */
488
+  function openReply(id) {
489
+    // Swap out the reply link for the hide link
490
+    $('#rl' + id).hide();
491
+    $('#cr' + id).show();
492
+
493
+    // Add the reply li to the children ul.
494
+    var div = $(renderTemplate(replyTemplate, {id: id})).hide();
495
+    $('#cl' + id)
496
+      .prepend(div)
497
+      // Setup the submit handler for the reply form.
498
+      .find('#rf' + id)
499
+      .submit(function(event) {
500
+        event.preventDefault();
501
+        addComment($('#rf' + id));
502
+        closeReply(id);
503
+      })
504
+      .find('input[type=button]')
505
+      .click(function() {
506
+        closeReply(id);
507
+      });
508
+    div.slideDown('fast', function() {
509
+      $('#rf' + id).find('textarea').focus();
510
+    });
511
+  }
512
+
513
+  /**
514
+   * Close the reply form opened with openReply.
515
+   */
516
+  function closeReply(id) {
517
+    // Remove the reply div from the DOM.
518
+    $('#rd' + id).slideUp('fast', function() {
519
+      $(this).remove();
520
+    });
521
+
522
+    // Swap out the hide link for the reply link
523
+    $('#cr' + id).hide();
524
+    $('#rl' + id).show();
525
+  }
526
+
527
+  /**
528
+   * Recursively sort a tree of comments using the comp comparator.
529
+   */
530
+  function sortComments(comments) {
531
+    comments.sort(comp);
532
+    $.each(comments, function() {
533
+      this.children = sortComments(this.children);
534
+    });
535
+    return comments;
536
+  }
537
+
538
+  /**
539
+   * Get the children comments from a ul. If recursive is true,
540
+   * recursively include childrens' children.
541
+   */
542
+  function getChildren(ul, recursive) {
543
+    var children = [];
544
+    ul.children().children("[id^='cd']")
545
+      .each(function() {
546
+        var comment = $(this).data('comment');
547
+        if (recursive)
548
+          comment.children = getChildren($(this).find('#cl' + comment.id), true);
549
+        children.push(comment);
550
+      });
551
+    return children;
552
+  }
553
+
554
+  /** Create a div to display a comment in. */
555
+  function createCommentDiv(comment) {
556
+    if (!comment.displayed && !opts.moderator) {
557
+      return $('<div class="moderate">Thank you!  Your comment will show up '
558
+               + 'once it is has been approved by a moderator.</div>');
559
+    }
560
+    // Prettify the comment rating.
561
+    comment.pretty_rating = comment.rating + ' point' +
562
+      (comment.rating == 1 ? '' : 's');
563
+    // Make a class (for displaying not yet moderated comments differently)
564
+    comment.css_class = comment.displayed ? '' : ' moderate';
565
+    // Create a div for this comment.
566
+    var context = $.extend({}, opts, comment);
567
+    var div = $(renderTemplate(commentTemplate, context));
568
+
569
+    // If the user has voted on this comment, highlight the correct arrow.
570
+    if (comment.vote) {
571
+      var direction = (comment.vote == 1) ? 'u' : 'd';
572
+      div.find('#' + direction + 'v' + comment.id).hide();
573
+      div.find('#' + direction + 'u' + comment.id).show();
574
+    }
575
+
576
+    if (opts.moderator || comment.text != '[deleted]') {
577
+      div.find('a.reply').show();
578
+      if (comment.proposal_diff)
579
+        div.find('#sp' + comment.id).show();
580
+      if (opts.moderator && !comment.displayed)
581
+        div.find('#cm' + comment.id).show();
582
+      if (opts.moderator || (opts.username == comment.username))
583
+        div.find('#dc' + comment.id).show();
584
+    }
585
+    return div;
586
+  }
587
+
588
+  /**
589
+   * A simple template renderer. Placeholders such as <%id%> are replaced
590
+   * by context['id'] with items being escaped. Placeholders such as <#id#>
591
+   * are not escaped.
592
+   */
593
+  function renderTemplate(template, context) {
594
+    var esc = $(document.createElement('div'));
595
+
596
+    function handle(ph, escape) {
597
+      var cur = context;
598
+      $.each(ph.split('.'), function() {
599
+        cur = cur[this];
600
+      });
601
+      return escape ? esc.text(cur || "").html() : cur;
602
+    }
603
+
604
+    return template.replace(/<([%#])([\w\.]*)\1>/g, function() {
605
+      return handle(arguments[2], arguments[1] == '%' ? true : false);
606
+    });
607
+  }
608
+
609
+  /** Flash an error message briefly. */
610
+  function showError(message) {
611
+    $(document.createElement('div')).attr({'class': 'popup-error'})
612
+      .append($(document.createElement('div'))
613
+               .attr({'class': 'error-message'}).text(message))
614
+      .appendTo('body')
615
+      .fadeIn("slow")
616
+      .delay(2000)
617
+      .fadeOut("slow");
618
+  }
619
+
620
+  /** Add a link the user uses to open the comments popup. */
621
+  $.fn.comment = function() {
622
+    return this.each(function() {
623
+      var id = $(this).attr('id').substring(1);
624
+      var count = COMMENT_METADATA[id];
625
+      var title = count + ' comment' + (count == 1 ? '' : 's');
626
+      var image = count > 0 ? opts.commentBrightImage : opts.commentImage;
627
+      var addcls = count == 0 ? ' nocomment' : '';
628
+      $(this)
629
+        .append(
630
+          $(document.createElement('a')).attr({
631
+            href: '#',
632
+            'class': 'sphinx-comment-open' + addcls,
633
+            id: 'ao' + id
634
+          })
635
+            .append($(document.createElement('img')).attr({
636
+              src: image,
637
+              alt: 'comment',
638
+              title: title
639
+            }))
640
+            .click(function(event) {
641
+              event.preventDefault();
642
+              show($(this).attr('id').substring(2));
643
+            })
644
+        )
645
+        .append(
646
+          $(document.createElement('a')).attr({
647
+            href: '#',
648
+            'class': 'sphinx-comment-close hidden',
649
+            id: 'ah' + id
650
+          })
651
+            .append($(document.createElement('img')).attr({
652
+              src: opts.closeCommentImage,
653
+              alt: 'close',
654
+              title: 'close'
655
+            }))
656
+            .click(function(event) {
657
+              event.preventDefault();
658
+              hide($(this).attr('id').substring(2));
659
+            })
660
+        );
661
+    });
662
+  };
663
+
664
+  var opts = {
665
+    processVoteURL: '/_process_vote',
666
+    addCommentURL: '/_add_comment',
667
+    getCommentsURL: '/_get_comments',
668
+    acceptCommentURL: '/_accept_comment',
669
+    deleteCommentURL: '/_delete_comment',
670
+    commentImage: '/static/_static/comment.png',
671
+    closeCommentImage: '/static/_static/comment-close.png',
672
+    loadingImage: '/static/_static/ajax-loader.gif',
673
+    commentBrightImage: '/static/_static/comment-bright.png',
674
+    upArrow: '/static/_static/up.png',
675
+    downArrow: '/static/_static/down.png',
676
+    upArrowPressed: '/static/_static/up-pressed.png',
677
+    downArrowPressed: '/static/_static/down-pressed.png',
678
+    voting: false,
679
+    moderator: false
680
+  };
681
+
682
+  if (typeof COMMENT_OPTIONS != "undefined") {
683
+    opts = jQuery.extend(opts, COMMENT_OPTIONS);
684
+  }
685
+
686
+  var popupTemplate = '\
687
+    <div class="sphinx-comments" id="sc<%id%>">\
688
+      <p class="sort-options">\
689
+        Sort by:\
690
+        <a href="#" class="sort-option byrating">best rated</a>\
691
+        <a href="#" class="sort-option byascage">newest</a>\
692
+        <a href="#" class="sort-option byage">oldest</a>\
693
+      </p>\
694
+      <div class="comment-header">Comments</div>\
695
+      <div class="comment-loading" id="cn<%id%>">\
696
+        loading comments... <img src="<%loadingImage%>" alt="" /></div>\
697
+      <ul id="cl<%id%>" class="comment-ul"></ul>\
698
+      <div id="ca<%id%>">\
699
+      <p class="add-a-comment">Add a comment\
700
+        (<a href="#" class="comment-markup" id="ab<%id%>">markup</a>):</p>\
701
+      <div class="comment-markup-box" id="mb<%id%>">\
702
+        reStructured text markup: <i>*emph*</i>, <b>**strong**</b>, \
703
+        <code>``code``</code>, \
704
+        code blocks: <code>::</code> and an indented block after blank line</div>\
705
+      <form method="post" id="cf<%id%>" class="comment-form" action="">\
706
+        <textarea name="comment" cols="80"></textarea>\
707
+        <p class="propose-button">\
708
+          <a href="#" id="pc<%id%>" class="show-propose-change">\
709
+            Propose a change &#9657;\
710
+          </a>\
711
+          <a href="#" id="hc<%id%>" class="hide-propose-change">\
712
+            Propose a change &#9663;\
713
+          </a>\
714
+        </p>\
715
+        <textarea name="proposal" id="pt<%id%>" cols="80"\
716
+                  spellcheck="false"></textarea>\
717
+        <input type="submit" value="Add comment" />\
718
+        <input type="hidden" name="node" value="<%id%>" />\
719
+        <input type="hidden" name="parent" value="" />\
720
+      </form>\
721
+      </div>\
722
+    </div>';
723
+
724
+  var commentTemplate = '\
725
+    <div id="cd<%id%>" class="sphinx-comment<%css_class%>">\
726
+      <div class="vote">\
727
+        <div class="arrow">\
728
+          <a href="#" id="uv<%id%>" class="vote" title="vote up">\
729
+            <img src="<%upArrow%>" />\
730
+          </a>\
731
+          <a href="#" id="uu<%id%>" class="un vote" title="vote up">\
732
+            <img src="<%upArrowPressed%>" />\
733
+          </a>\
734
+        </div>\
735
+        <div class="arrow">\
736
+          <a href="#" id="dv<%id%>" class="vote" title="vote down">\
737
+            <img src="<%downArrow%>" id="da<%id%>" />\
738
+          </a>\
739
+          <a href="#" id="du<%id%>" class="un vote" title="vote down">\
740
+            <img src="<%downArrowPressed%>" />\
741
+          </a>\
742
+        </div>\
743
+      </div>\
744
+      <div class="comment-content">\
745
+        <p class="tagline comment">\
746
+          <span class="user-id"><%username%></span>\
747
+          <span class="rating"><%pretty_rating%></span>\
748
+          <span class="delta"><%time.delta%></span>\
749
+        </p>\
750
+        <div class="comment-text comment"><#text#></div>\
751
+        <p class="comment-opts comment">\
752
+          <a href="#" class="reply hidden" id="rl<%id%>">reply &#9657;</a>\
753
+          <a href="#" class="close-reply" id="cr<%id%>">reply &#9663;</a>\
754
+          <a href="#" id="sp<%id%>" class="show-proposal">proposal &#9657;</a>\
755
+          <a href="#" id="hp<%id%>" class="hide-proposal">proposal &#9663;</a>\
756
+          <a href="#" id="dc<%id%>" class="delete-comment hidden">delete</a>\
757
+          <span id="cm<%id%>" class="moderation hidden">\
758
+            <a href="#" id="ac<%id%>" class="accept-comment">accept</a>\
759
+          </span>\
760
+        </p>\
761
+        <pre class="proposal" id="pr<%id%>">\
762
+<#proposal_diff#>\
763
+        </pre>\
764
+          <ul class="comment-children" id="cl<%id%>"></ul>\
765
+        </div>\
766
+        <div class="clearleft"></div>\
767
+      </div>\
768
+    </div>';
769
+
770
+  var replyTemplate = '\
771
+    <li>\
772
+      <div class="reply-div" id="rd<%id%>">\
773
+        <form id="rf<%id%>">\
774
+          <textarea name="comment" cols="80"></textarea>\
775
+          <input type="submit" value="Add reply" />\
776
+          <input type="button" value="Cancel" />\
777
+          <input type="hidden" name="parent" value="<%id%>" />\
778
+          <input type="hidden" name="node" value="" />\
779
+        </form>\
780
+      </div>\
781
+    </li>';
782
+
783
+  $(document).ready(function() {
784
+    init();
785
+  });
786
+})(jQuery);
787
+
788
+$(document).ready(function() {
789
+  // add comment anchors for all paragraphs that are commentable
790
+  $('.sphinx-has-comment').comment();
791
+
792
+  // highlight search words in search results
793
+  $("div.context").each(function() {
794
+    var params = $.getQueryParameters();
795
+    var terms = (params.q) ? params.q[0].split(/\s+/) : [];
796
+    var result = $(this);
797
+    $.each(terms, function() {
798
+      result.highlightText(this.toLowerCase(), 'highlighted');
799
+    });
800
+  });
801
+
802
+  // directly open comment window if requested
803
+  var anchor = document.location.hash;
804
+  if (anchor.substring(0, 9) == '#comment-') {
805
+    $('#ao' + anchor.substring(9)).click();
806
+    document.location.hash = '#s' + anchor.substring(9);
807
+  }
808
+});

+ 161
- 0
_docs_/genindex.html Ver arquivo

@@ -0,0 +1,161 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    <title>Index &#8212; state_machine  documentation</title>
10
+    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
11
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
12
+    <script type="text/javascript">
13
+      var DOCUMENTATION_OPTIONS = {
14
+        URL_ROOT:    './',
15
+        VERSION:     '',
16
+        COLLAPSE_INDEX: false,
17
+        FILE_SUFFIX: '.html',
18
+        HAS_SOURCE:  true,
19
+        SOURCELINK_SUFFIX: '.txt'
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="_static/jquery.js"></script>
23
+    <script type="text/javascript" src="_static/underscore.js"></script>
24
+    <script type="text/javascript" src="_static/doctools.js"></script>
25
+    <link rel="index" title="Index" href="#" />
26
+    <link rel="search" title="Search" href="search.html" />
27
+   
28
+  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
29
+  
30
+  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
31
+
32
+  </head>
33
+  <body>
34
+  
35
+
36
+    <div class="document">
37
+      <div class="documentwrapper">
38
+        <div class="bodywrapper">
39
+          <div class="body" role="main">
40
+            
41
+
42
+<h1 id="index">Index</h1>
43
+
44
+<div class="genindex-jumpbox">
45
+ <a href="#L"><strong>L</strong></a>
46
+ | <a href="#P"><strong>P</strong></a>
47
+ | <a href="#R"><strong>R</strong></a>
48
+ | <a href="#S"><strong>S</strong></a>
49
+ | <a href="#T"><strong>T</strong></a>
50
+ | <a href="#W"><strong>W</strong></a>
51
+ 
52
+</div>
53
+<h2 id="L">L</h2>
54
+<table style="width: 100%" class="indextable genindextable"><tr>
55
+  <td style="width: 33%; vertical-align: top;"><ul>
56
+      <li><a href="index.html#state_machine.state_machine.last_transition_condition">last_transition_condition() (state_machine.state_machine method)</a>
57
+</li>
58
+  </ul></td>
59
+  <td style="width: 33%; vertical-align: top;"><ul>
60
+      <li><a href="index.html#state_machine.state_machine.last_transition_condition_was">last_transition_condition_was() (state_machine.state_machine method)</a>
61
+</li>
62
+  </ul></td>
63
+</tr></table>
64
+
65
+<h2 id="P">P</h2>
66
+<table style="width: 100%" class="indextable genindextable"><tr>
67
+  <td style="width: 33%; vertical-align: top;"><ul>
68
+      <li><a href="index.html#state_machine.state_machine.previous_state">previous_state() (state_machine.state_machine method)</a>
69
+</li>
70
+  </ul></td>
71
+  <td style="width: 33%; vertical-align: top;"><ul>
72
+      <li><a href="index.html#state_machine.state_machine.previous_state_duration">previous_state_duration() (state_machine.state_machine method)</a>
73
+</li>
74
+      <li><a href="index.html#state_machine.state_machine.previous_state_was">previous_state_was() (state_machine.state_machine method)</a>
75
+</li>
76
+  </ul></td>
77
+</tr></table>
78
+
79
+<h2 id="R">R</h2>
80
+<table style="width: 100%" class="indextable genindextable"><tr>
81
+  <td style="width: 33%; vertical-align: top;"><ul>
82
+      <li><a href="index.html#state_machine.state_machine.register_state_change_callback">register_state_change_callback() (state_machine.state_machine method)</a>
83
+</li>
84
+  </ul></td>
85
+</tr></table>
86
+
87
+<h2 id="S">S</h2>
88
+<table style="width: 100%" class="indextable genindextable"><tr>
89
+  <td style="width: 33%; vertical-align: top;"><ul>
90
+      <li><a href="index.html#state_machine.state_machine">state_machine (class in state_machine)</a>
91
+
92
+      <ul>
93
+        <li><a href="index.html#module-state_machine">(module)</a>
94
+</li>
95
+      </ul></li>
96
+  </ul></td>
97
+</tr></table>
98
+
99
+<h2 id="T">T</h2>
100
+<table style="width: 100%" class="indextable genindextable"><tr>
101
+  <td style="width: 33%; vertical-align: top;"><ul>
102
+      <li><a href="index.html#state_machine.state_machine.this_state">this_state() (state_machine.state_machine method)</a>
103
+</li>
104
+  </ul></td>
105
+  <td style="width: 33%; vertical-align: top;"><ul>
106
+      <li><a href="index.html#state_machine.state_machine.this_state_duration">this_state_duration() (state_machine.state_machine method)</a>
107
+</li>
108
+      <li><a href="index.html#state_machine.state_machine.this_state_is">this_state_is() (state_machine.state_machine method)</a>
109
+</li>
110
+  </ul></td>
111
+</tr></table>
112
+
113
+<h2 id="W">W</h2>
114
+<table style="width: 100%" class="indextable genindextable"><tr>
115
+  <td style="width: 33%; vertical-align: top;"><ul>
116
+      <li><a href="index.html#state_machine.state_machine.work">work() (state_machine.state_machine method)</a>
117
+</li>
118
+  </ul></td>
119
+</tr></table>
120
+
121
+
122
+
123
+          </div>
124
+        </div>
125
+      </div>
126
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
127
+        <div class="sphinxsidebarwrapper"><div class="relations">
128
+<h3>Related Topics</h3>
129
+<ul>
130
+  <li><a href="index.html">Documentation overview</a><ul>
131
+  </ul></li>
132
+</ul>
133
+</div>
134
+<div id="searchbox" style="display: none" role="search">
135
+  <h3>Quick search</h3>
136
+    <form class="search" action="search.html" method="get">
137
+      <div><input type="text" name="q" /></div>
138
+      <div><input type="submit" value="Go" /></div>
139
+      <input type="hidden" name="check_keywords" value="yes" />
140
+      <input type="hidden" name="area" value="default" />
141
+    </form>
142
+</div>
143
+<script type="text/javascript">$('#searchbox').show(0);</script>
144
+        </div>
145
+      </div>
146
+      <div class="clearer"></div>
147
+    </div>
148
+    <div class="footer">
149
+      &copy;2019, Dirk Alders.
150
+      
151
+      |
152
+      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.7</a>
153
+      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
154
+      
155
+    </div>
156
+
157
+    
158
+
159
+    
160
+  </body>
161
+</html>

+ 366
- 0
_docs_/index.html Ver arquivo

@@ -0,0 +1,366 @@
1
+
2
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+
5
+<html xmlns="http://www.w3.org/1999/xhtml">
6
+  <head>
7
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+    <title>Welcome to state_machine’s documentation! &#8212; state_machine  documentation</title>
9
+    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
10
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
11
+    <script type="text/javascript">
12
+      var DOCUMENTATION_OPTIONS = {
13
+        URL_ROOT:    './',
14
+        VERSION:     '',
15
+        COLLAPSE_INDEX: false,
16
+        FILE_SUFFIX: '.html',
17
+        HAS_SOURCE:  true,
18
+        SOURCELINK_SUFFIX: '.txt'
19
+      };
20
+    </script>
21
+    <script type="text/javascript" src="_static/jquery.js"></script>
22
+    <script type="text/javascript" src="_static/underscore.js"></script>
23
+    <script type="text/javascript" src="_static/doctools.js"></script>
24
+    <link rel="index" title="Index" href="genindex.html" />
25
+    <link rel="search" title="Search" href="search.html" />
26
+   
27
+  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
28
+  
29
+  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
30
+
31
+  </head>
32
+  <body>
33
+  
34
+
35
+    <div class="document">
36
+      <div class="documentwrapper">
37
+        <div class="bodywrapper">
38
+          <div class="body" role="main">
39
+            
40
+  <div class="section" id="module-state_machine">
41
+<span id="welcome-to-state-machine-s-documentation"></span><h1>Welcome to state_machine’s documentation!<a class="headerlink" href="#module-state_machine" title="Permalink to this headline">¶</a></h1>
42
+<div class="section" id="state-machine-state-machine">
43
+<h2>state_machine (State Machine)<a class="headerlink" href="#state-machine-state-machine" title="Permalink to this headline">¶</a></h2>
44
+<p><strong>Author:</strong></p>
45
+<ul class="simple">
46
+<li>Dirk Alders &lt;<a class="reference external" href="mailto:sudo-dirk&#37;&#52;&#48;mount-mockery&#46;de">sudo-dirk<span>&#64;</span>mount-mockery<span>&#46;</span>de</a>&gt;</li>
47
+</ul>
48
+<p><strong>Description:</strong></p>
49
+<blockquote>
50
+<div>This Module helps implementing state machines.</div></blockquote>
51
+<p><strong>Submodules:</strong></p>
52
+<ul class="simple">
53
+<li><a class="reference internal" href="#state_machine.state_machine" title="state_machine.state_machine"><code class="xref py py-class docutils literal"><span class="pre">state_machine.state_machine</span></code></a></li>
54
+</ul>
55
+<p><strong>Unittest:</strong></p>
56
+<blockquote>
57
+<div>See also the <a class="reference download internal" href="_downloads/unittest.pdf" download=""><code class="xref download docutils literal"><span class="pre">unittest</span></code></a> documentation.</div></blockquote>
58
+<p><strong>Module Documentation:</strong></p>
59
+<dl class="class">
60
+<dt id="state_machine.state_machine">
61
+<em class="property">class </em><code class="descclassname">state_machine.</code><code class="descname">state_machine</code><span class="sig-paren">(</span><em>default_state</em>, <em>log_lvl</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#state_machine.state_machine" title="Permalink to this definition">¶</a></dt>
62
+<dd><table class="docutils field-list" frame="void" rules="none">
63
+<col class="field-name" />
64
+<col class="field-body" />
65
+<tbody valign="top">
66
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
67
+<li><strong>default_state</strong> – The default state which is set on initialisation.</li>
68
+<li><strong>log_lvl</strong> – The log level, this Module logs to (see Loging-Levels of Module <code class="xref py py-mod docutils literal"><span class="pre">logging</span></code>)</li>
69
+</ul>
70
+</td>
71
+</tr>
72
+</tbody>
73
+</table>
74
+<div class="admonition note">
75
+<p class="first admonition-title">Note</p>
76
+<p class="last">Additional keyword parameters well be stored as varibles of the instance (e.g. to give variables or methods for transition condition calculation).</p>
77
+</div>
78
+<p>A state machine class can be created by deriving it from this class. The transitions are defined by overriding the variable <cite>TRANSITIONS</cite>.
79
+This Variable is a dictionary, where the key is the start-state and the content is a tuple or list of transitions. Each transition is a tuple or list
80
+including the following information: (condition-method (str), transition-time (number), target_state (str)).</p>
81
+<div class="admonition note">
82
+<p class="first admonition-title">Note</p>
83
+<p class="last">The condition-method needs to be implemented as part of the new class.</p>
84
+</div>
85
+<div class="admonition note">
86
+<p class="first admonition-title">Note</p>
87
+<p class="last">It is usefull to define the states as variables of this class.</p>
88
+</div>
89
+<p><strong>Example:</strong></p>
90
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="ch">#!/usr/bin/env python</span>
91
+<span class="c1"># -*- coding: UTF-8 -*-</span>
92
+
93
+<span class="kn">import</span> <span class="nn">logging</span>
94
+<span class="kn">import</span> <span class="nn">os</span>
95
+<span class="kn">import</span> <span class="nn">sys</span>
96
+
97
+<span class="kn">import</span> <span class="nn">report</span>
98
+<span class="kn">import</span> <span class="nn">state_machine</span>
99
+
100
+<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s1">&#39;__example__&#39;</span><span class="p">)</span>
101
+<span class="n">report</span><span class="o">.</span><span class="n">consoleLoggingConfigure</span><span class="p">(</span><span class="n">loggers</span><span class="o">=</span><span class="p">[</span><span class="n">state_machine</span><span class="o">.</span><span class="n">logger_name</span><span class="p">,</span> <span class="s1">&#39;__example__&#39;</span><span class="p">,</span> <span class="p">],</span> <span class="n">level</span><span class="o">=</span><span class="s1">&#39;DEBUG&#39;</span><span class="p">)</span>
102
+
103
+
104
+<span class="k">class</span> <span class="nc">trafic_lights</span><span class="p">(</span><span class="n">state_machine</span><span class="o">.</span><span class="n">state_machine</span><span class="p">):</span>
105
+    <span class="n">LOG_PREFIX</span> <span class="o">=</span> <span class="s1">&#39;TraficLights:&#39;</span>
106
+
107
+    <span class="n">STATE_RED</span> <span class="o">=</span> <span class="s1">&#39;state_red&#39;</span>
108
+    <span class="n">STATE_GREEN</span> <span class="o">=</span> <span class="s1">&#39;state_green&#39;</span>
109
+
110
+    <span class="n">CONDITION_TRUE</span> <span class="o">=</span> <span class="s1">&#39;condition_true&#39;</span>
111
+    <span class="n">CONDITION_PEDASTRIAN_REQUEST</span> <span class="o">=</span> <span class="s1">&#39;condition_pedastrian_request&#39;</span>
112
+
113
+    <span class="n">TRANSITIONS</span> <span class="o">=</span> <span class="p">{</span>
114
+        <span class="n">STATE_RED</span><span class="p">:</span> <span class="p">(</span>
115
+            <span class="p">(</span><span class="n">CONDITION_PEDASTRIAN_REQUEST</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">STATE_GREEN</span><span class="p">),</span>
116
+        <span class="p">),</span>
117
+        <span class="n">STATE_GREEN</span><span class="p">:</span> <span class="p">(</span>
118
+            <span class="p">(</span><span class="n">CONDITION_TRUE</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">STATE_RED</span><span class="p">),</span>
119
+        <span class="p">)</span>
120
+    <span class="p">}</span>
121
+
122
+    <span class="k">def</span> <span class="nf">condition_true</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
123
+        <span class="k">return</span> <span class="kc">True</span>
124
+
125
+    <span class="k">def</span> <span class="nf">set_padestrian_request</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
126
+        <span class="n">logger</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__log_lvl__</span><span class="p">,</span> <span class="s1">&#39;</span><span class="si">%s</span><span class="s1"> Pedestrian gave state change request.&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">LOG_PREFIX</span><span class="p">)</span>
127
+        <span class="bp">self</span><span class="o">.</span><span class="n">pedastrian_request</span> <span class="o">=</span> <span class="kc">True</span>
128
+
129
+    <span class="k">def</span> <span class="nf">condition_pedastrian_request</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
130
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">pedastrian_request</span>
131
+
132
+
133
+<span class="n">sm</span> <span class="o">=</span> <span class="n">trafic_lights</span><span class="p">(</span><span class="n">trafic_lights</span><span class="o">.</span><span class="n">STATE_RED</span><span class="p">,</span> <span class="n">logging</span><span class="o">.</span><span class="n">INFO</span><span class="p">,</span> <span class="n">pedastrian_request</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
134
+<span class="n">sm</span><span class="o">.</span><span class="n">register_state_change_callback</span><span class="p">(</span><span class="n">sm</span><span class="o">.</span><span class="n">STATE_GREEN</span><span class="p">,</span> <span class="n">sm</span><span class="o">.</span><span class="n">CONDITION_PEDASTRIAN_REQUEST</span><span class="p">,</span> <span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">,</span> <span class="s1">&#39;Callback information: Traffic light had been changed to green caused by pedastrian request&#39;</span><span class="p">)</span>
135
+<span class="k">while</span> <span class="ow">not</span> <span class="n">sm</span><span class="o">.</span><span class="n">previous_state_was</span><span class="p">(</span><span class="n">sm</span><span class="o">.</span><span class="n">STATE_GREEN</span><span class="p">):</span>
136
+    <span class="k">if</span> <span class="n">sm</span><span class="o">.</span><span class="n">this_state_is</span><span class="p">(</span><span class="n">sm</span><span class="o">.</span><span class="n">STATE_RED</span><span class="p">)</span> <span class="ow">and</span> <span class="n">sm</span><span class="o">.</span><span class="n">this_state_duration</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mf">0.2</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">sm</span><span class="o">.</span><span class="n">condition_pedastrian_request</span><span class="p">():</span>
137
+        <span class="n">sm</span><span class="o">.</span><span class="n">set_padestrian_request</span><span class="p">()</span>
138
+    <span class="n">sm</span><span class="o">.</span><span class="n">work</span><span class="p">()</span>
139
+</pre></div>
140
+</div>
141
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="mi">2019</span><span class="o">-</span><span class="mi">12</span><span class="o">-</span><span class="mi">26</span> <span class="mi">13</span><span class="p">:</span><span class="mi">40</span><span class="p">:</span><span class="mi">44</span><span class="p">,</span><span class="mi">154</span><span class="p">:</span> <span class="n">INFO</span>    <span class="o">-</span> <span class="n">TraficLights</span><span class="p">:</span> <span class="n">State</span> <span class="n">change</span> <span class="p">(</span><span class="s1">&#39;__init__&#39;</span><span class="p">):</span> <span class="kc">None</span> <span class="o">-&gt;</span> <span class="s1">&#39;state_red&#39;</span>
142
+<span class="mi">2019</span><span class="o">-</span><span class="mi">12</span><span class="o">-</span><span class="mi">26</span> <span class="mi">13</span><span class="p">:</span><span class="mi">40</span><span class="p">:</span><span class="mi">44</span><span class="p">,</span><span class="mi">354</span><span class="p">:</span> <span class="n">INFO</span>    <span class="o">-</span> <span class="n">TraficLights</span><span class="p">:</span> <span class="n">Pedestrian</span> <span class="n">gave</span> <span class="n">state</span> <span class="n">change</span> <span class="n">request</span><span class="o">.</span>
143
+<span class="mi">2019</span><span class="o">-</span><span class="mi">12</span><span class="o">-</span><span class="mi">26</span> <span class="mi">13</span><span class="p">:</span><span class="mi">40</span><span class="p">:</span><span class="mi">45</span><span class="p">,</span><span class="mi">354</span><span class="p">:</span> <span class="n">INFO</span>    <span class="o">-</span> <span class="n">TraficLights</span><span class="p">:</span> <span class="n">State</span> <span class="n">change</span> <span class="p">(</span><span class="s1">&#39;condition_pedastrian_request&#39;</span><span class="p">):</span> <span class="s1">&#39;state_red&#39;</span> <span class="o">-&gt;</span> <span class="s1">&#39;state_green&#39;</span>
144
+<span class="mi">2019</span><span class="o">-</span><span class="mi">12</span><span class="o">-</span><span class="mi">26</span> <span class="mi">13</span><span class="p">:</span><span class="mi">40</span><span class="p">:</span><span class="mi">45</span><span class="p">,</span><span class="mi">354</span><span class="p">:</span> <span class="n">INFO</span>    <span class="o">-</span> <span class="n">Callback</span> <span class="n">information</span><span class="p">:</span> <span class="n">Traffic</span> <span class="n">light</span> <span class="n">had</span> <span class="n">been</span> <span class="n">changed</span> <span class="n">to</span> <span class="n">green</span> <span class="n">caused</span> <span class="n">by</span> <span class="n">pedastrian</span> <span class="n">request</span>
145
+<span class="mi">2019</span><span class="o">-</span><span class="mi">12</span><span class="o">-</span><span class="mi">26</span> <span class="mi">13</span><span class="p">:</span><span class="mi">40</span><span class="p">:</span><span class="mi">48</span><span class="p">,</span><span class="mi">355</span><span class="p">:</span> <span class="n">INFO</span>    <span class="o">-</span> <span class="n">TraficLights</span><span class="p">:</span> <span class="n">State</span> <span class="n">change</span> <span class="p">(</span><span class="s1">&#39;condition_true&#39;</span><span class="p">):</span> <span class="s1">&#39;state_green&#39;</span> <span class="o">-&gt;</span> <span class="s1">&#39;state_red&#39;</span>
146
+</pre></div>
147
+</div>
148
+<dl class="method">
149
+<dt id="state_machine.state_machine.last_transition_condition">
150
+<code class="descname">last_transition_condition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#state_machine.state_machine.last_transition_condition" title="Permalink to this definition">¶</a></dt>
151
+<dd><table class="docutils field-list" frame="void" rules="none">
152
+<col class="field-name" />
153
+<col class="field-body" />
154
+<tbody valign="top">
155
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The last transition condition.</td>
156
+</tr>
157
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">str</td>
158
+</tr>
159
+</tbody>
160
+</table>
161
+<p>This method returns the last transition condition.</p>
162
+</dd></dl>
163
+
164
+<dl class="method">
165
+<dt id="state_machine.state_machine.last_transition_condition_was">
166
+<code class="descname">last_transition_condition_was</code><span class="sig-paren">(</span><em>condition</em><span class="sig-paren">)</span><a class="headerlink" href="#state_machine.state_machine.last_transition_condition_was" title="Permalink to this definition">¶</a></dt>
167
+<dd><table class="docutils field-list" frame="void" rules="none">
168
+<col class="field-name" />
169
+<col class="field-body" />
170
+<tbody valign="top">
171
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>condition</strong> (<em>str</em>) – The condition to be checked</td>
172
+</tr>
173
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">True if the given condition was the last transition condition, else False.</td>
174
+</tr>
175
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
176
+</tr>
177
+</tbody>
178
+</table>
179
+<p>This methods returns the boolean information if the last transition condition is equivalent to the given condition.</p>
180
+</dd></dl>
181
+
182
+<dl class="method">
183
+<dt id="state_machine.state_machine.previous_state">
184
+<code class="descname">previous_state</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#state_machine.state_machine.previous_state" title="Permalink to this definition">¶</a></dt>
185
+<dd><table class="docutils field-list" frame="void" rules="none">
186
+<col class="field-name" />
187
+<col class="field-body" />
188
+<tbody valign="top">
189
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The previous state.</td>
190
+</tr>
191
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">str</td>
192
+</tr>
193
+</tbody>
194
+</table>
195
+<p>This method returns the previous state of the state machine.</p>
196
+</dd></dl>
197
+
198
+<dl class="method">
199
+<dt id="state_machine.state_machine.previous_state_duration">
200
+<code class="descname">previous_state_duration</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#state_machine.state_machine.previous_state_duration" title="Permalink to this definition">¶</a></dt>
201
+<dd><table class="docutils field-list" frame="void" rules="none">
202
+<col class="field-name" />
203
+<col class="field-body" />
204
+<tbody valign="top">
205
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The time how long the previous state was active.</td>
206
+</tr>
207
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">float</td>
208
+</tr>
209
+</tbody>
210
+</table>
211
+<p>This method returns the time how long the previous state was active.</p>
212
+</dd></dl>
213
+
214
+<dl class="method">
215
+<dt id="state_machine.state_machine.previous_state_was">
216
+<code class="descname">previous_state_was</code><span class="sig-paren">(</span><em>state</em><span class="sig-paren">)</span><a class="headerlink" href="#state_machine.state_machine.previous_state_was" title="Permalink to this definition">¶</a></dt>
217
+<dd><table class="docutils field-list" frame="void" rules="none">
218
+<col class="field-name" />
219
+<col class="field-body" />
220
+<tbody valign="top">
221
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>state</strong> (<em>str</em>) – The state to be checked</td>
222
+</tr>
223
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">True if the given state was previously active, else False.</td>
224
+</tr>
225
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
226
+</tr>
227
+</tbody>
228
+</table>
229
+<p>This methods returns the boolean information if the state machine was previously in the given state.</p>
230
+</dd></dl>
231
+
232
+<dl class="method">
233
+<dt id="state_machine.state_machine.register_state_change_callback">
234
+<code class="descname">register_state_change_callback</code><span class="sig-paren">(</span><em>state</em>, <em>condition</em>, <em>callback</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#state_machine.state_machine.register_state_change_callback" title="Permalink to this definition">¶</a></dt>
235
+<dd><table class="docutils field-list" frame="void" rules="none">
236
+<col class="field-name" />
237
+<col class="field-body" />
238
+<tbody valign="top">
239
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
240
+<li><strong>state</strong> (<em>str</em>) – The target state. The callback will be executed, if the state machine changes to this state. None means all states.</li>
241
+<li><strong>condition</strong> (<em>str</em>) – The transition condition. The callback will be executed, if this condition is responsible for the state change. None means all conditions.</li>
242
+<li><strong>callback</strong> – The callback to be executed.</li>
243
+</ul>
244
+</td>
245
+</tr>
246
+</tbody>
247
+</table>
248
+<div class="admonition note">
249
+<p class="first admonition-title">Note</p>
250
+<p class="last">Additional arguments and keyword parameters are supported. These arguments and parameters will be used as arguments and parameters for the callback execution.</p>
251
+</div>
252
+<p>This methods allows to register callbacks which will be executed on state changes.</p>
253
+</dd></dl>
254
+
255
+<dl class="method">
256
+<dt id="state_machine.state_machine.this_state">
257
+<code class="descname">this_state</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#state_machine.state_machine.this_state" title="Permalink to this definition">¶</a></dt>
258
+<dd><table class="docutils field-list" frame="void" rules="none">
259
+<col class="field-name" />
260
+<col class="field-body" />
261
+<tbody valign="top">
262
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The current state.</td>
263
+</tr>
264
+</tbody>
265
+</table>
266
+<p>This method returns the current state of the state machine.</p>
267
+</dd></dl>
268
+
269
+<dl class="method">
270
+<dt id="state_machine.state_machine.this_state_duration">
271
+<code class="descname">this_state_duration</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#state_machine.state_machine.this_state_duration" title="Permalink to this definition">¶</a></dt>
272
+<dd><table class="docutils field-list" frame="void" rules="none">
273
+<col class="field-name" />
274
+<col class="field-body" />
275
+<tbody valign="top">
276
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The time how long the current state is active.</td>
277
+</tr>
278
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">float</td>
279
+</tr>
280
+</tbody>
281
+</table>
282
+<p>This method returns the time how long the current state is active.</p>
283
+</dd></dl>
284
+
285
+<dl class="method">
286
+<dt id="state_machine.state_machine.this_state_is">
287
+<code class="descname">this_state_is</code><span class="sig-paren">(</span><em>state</em><span class="sig-paren">)</span><a class="headerlink" href="#state_machine.state_machine.this_state_is" title="Permalink to this definition">¶</a></dt>
288
+<dd><table class="docutils field-list" frame="void" rules="none">
289
+<col class="field-name" />
290
+<col class="field-body" />
291
+<tbody valign="top">
292
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>state</strong> (<em>str</em>) – The state to be checked</td>
293
+</tr>
294
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">True if the given state is currently active, else False.</td>
295
+</tr>
296
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
297
+</tr>
298
+</tbody>
299
+</table>
300
+<p>This methods returns the boolean information if the state machine is currently in the given state.</p>
301
+</dd></dl>
302
+
303
+<dl class="method">
304
+<dt id="state_machine.state_machine.work">
305
+<code class="descname">work</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#state_machine.state_machine.work" title="Permalink to this definition">¶</a></dt>
306
+<dd><p>This Method needs to be executed cyclicly to enable the state machine.</p>
307
+</dd></dl>
308
+
309
+</dd></dl>
310
+
311
+</div>
312
+<div class="toctree-wrapper compound">
313
+</div>
314
+</div>
315
+<div class="section" id="indices-and-tables">
316
+<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
317
+<ul class="simple">
318
+<li><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></li>
319
+<li><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></li>
320
+<li><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></li>
321
+</ul>
322
+</div>
323
+
324
+
325
+          </div>
326
+        </div>
327
+      </div>
328
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
329
+        <div class="sphinxsidebarwrapper"><div class="relations">
330
+<h3>Related Topics</h3>
331
+<ul>
332
+  <li><a href="#">Documentation overview</a><ul>
333
+  </ul></li>
334
+</ul>
335
+</div>
336
+<div id="searchbox" style="display: none" role="search">
337
+  <h3>Quick search</h3>
338
+    <form class="search" action="search.html" method="get">
339
+      <div><input type="text" name="q" /></div>
340
+      <div><input type="submit" value="Go" /></div>
341
+      <input type="hidden" name="check_keywords" value="yes" />
342
+      <input type="hidden" name="area" value="default" />
343
+    </form>
344
+</div>
345
+<script type="text/javascript">$('#searchbox').show(0);</script>
346
+        </div>
347
+      </div>
348
+      <div class="clearer"></div>
349
+    </div>
350
+    <div class="footer">
351
+      &copy;2019, Dirk Alders.
352
+      
353
+      |
354
+      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.7</a>
355
+      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
356
+      
357
+      |
358
+      <a href="_sources/index.rst.txt"
359
+          rel="nofollow">Page source</a>
360
+    </div>
361
+
362
+    
363
+
364
+    
365
+  </body>
366
+</html>

BIN
_docs_/objects.inv Ver arquivo


+ 104
- 0
_docs_/py-modindex.html Ver arquivo

@@ -0,0 +1,104 @@
1
+
2
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+
5
+<html xmlns="http://www.w3.org/1999/xhtml">
6
+  <head>
7
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+    <title>Python Module Index &#8212; state_machine  documentation</title>
9
+    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
10
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
11
+    <script type="text/javascript">
12
+      var DOCUMENTATION_OPTIONS = {
13
+        URL_ROOT:    './',
14
+        VERSION:     '',
15
+        COLLAPSE_INDEX: false,
16
+        FILE_SUFFIX: '.html',
17
+        HAS_SOURCE:  true,
18
+        SOURCELINK_SUFFIX: '.txt'
19
+      };
20
+    </script>
21
+    <script type="text/javascript" src="_static/jquery.js"></script>
22
+    <script type="text/javascript" src="_static/underscore.js"></script>
23
+    <script type="text/javascript" src="_static/doctools.js"></script>
24
+    <link rel="index" title="Index" href="genindex.html" />
25
+    <link rel="search" title="Search" href="search.html" />
26
+
27
+   
28
+  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
29
+  
30
+  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
31
+
32
+
33
+    <script type="text/javascript">
34
+      DOCUMENTATION_OPTIONS.COLLAPSE_INDEX = true;
35
+    </script>
36
+
37
+
38
+  </head>
39
+  <body>
40
+  
41
+
42
+    <div class="document">
43
+      <div class="documentwrapper">
44
+        <div class="bodywrapper">
45
+          <div class="body" role="main">
46
+            
47
+
48
+   <h1>Python Module Index</h1>
49
+
50
+   <div class="modindex-jumpbox">
51
+   <a href="#cap-s"><strong>s</strong></a>
52
+   </div>
53
+
54
+   <table class="indextable modindextable">
55
+     <tr class="pcap"><td></td><td>&#160;</td><td></td></tr>
56
+     <tr class="cap" id="cap-s"><td></td><td>
57
+       <strong>s</strong></td><td></td></tr>
58
+     <tr>
59
+       <td></td>
60
+       <td>
61
+       <a href="index.html#module-state_machine"><code class="xref">state_machine</code></a></td><td>
62
+       <em></em></td></tr>
63
+   </table>
64
+
65
+
66
+          </div>
67
+        </div>
68
+      </div>
69
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
70
+        <div class="sphinxsidebarwrapper"><div class="relations">
71
+<h3>Related Topics</h3>
72
+<ul>
73
+  <li><a href="index.html">Documentation overview</a><ul>
74
+  </ul></li>
75
+</ul>
76
+</div>
77
+<div id="searchbox" style="display: none" role="search">
78
+  <h3>Quick search</h3>
79
+    <form class="search" action="search.html" method="get">
80
+      <div><input type="text" name="q" /></div>
81
+      <div><input type="submit" value="Go" /></div>
82
+      <input type="hidden" name="check_keywords" value="yes" />
83
+      <input type="hidden" name="area" value="default" />
84
+    </form>
85
+</div>
86
+<script type="text/javascript">$('#searchbox').show(0);</script>
87
+        </div>
88
+      </div>
89
+      <div class="clearer"></div>
90
+    </div>
91
+    <div class="footer">
92
+      &copy;2019, Dirk Alders.
93
+      
94
+      |
95
+      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.7</a>
96
+      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
97
+      
98
+    </div>
99
+
100
+    
101
+
102
+    
103
+  </body>
104
+</html>

+ 100
- 0
_docs_/search.html Ver arquivo

@@ -0,0 +1,100 @@
1
+
2
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+
5
+<html xmlns="http://www.w3.org/1999/xhtml">
6
+  <head>
7
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+    <title>Search &#8212; state_machine  documentation</title>
9
+    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
10
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
11
+    <script type="text/javascript">
12
+      var DOCUMENTATION_OPTIONS = {
13
+        URL_ROOT:    './',
14
+        VERSION:     '',
15
+        COLLAPSE_INDEX: false,
16
+        FILE_SUFFIX: '.html',
17
+        HAS_SOURCE:  true,
18
+        SOURCELINK_SUFFIX: '.txt'
19
+      };
20
+    </script>
21
+    <script type="text/javascript" src="_static/jquery.js"></script>
22
+    <script type="text/javascript" src="_static/underscore.js"></script>
23
+    <script type="text/javascript" src="_static/doctools.js"></script>
24
+    <script type="text/javascript" src="_static/searchtools.js"></script>
25
+    <link rel="index" title="Index" href="genindex.html" />
26
+    <link rel="search" title="Search" href="#" />
27
+  <script type="text/javascript">
28
+    jQuery(function() { Search.loadIndex("searchindex.js"); });
29
+  </script>
30
+  
31
+  <script type="text/javascript" id="searchindexloader"></script>
32
+  
33
+   
34
+  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
35
+  
36
+  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
37
+
38
+
39
+  </head>
40
+  <body>
41
+  
42
+
43
+    <div class="document">
44
+      <div class="documentwrapper">
45
+        <div class="bodywrapper">
46
+          <div class="body" role="main">
47
+            
48
+  <h1 id="search-documentation">Search</h1>
49
+  <div id="fallback" class="admonition warning">
50
+  <script type="text/javascript">$('#fallback').hide();</script>
51
+  <p>
52
+    Please activate JavaScript to enable the search
53
+    functionality.
54
+  </p>
55
+  </div>
56
+  <p>
57
+    From here you can search these documents. Enter your search
58
+    words into the box below and click "search". Note that the search
59
+    function will automatically search for all of the words. Pages
60
+    containing fewer words won't appear in the result list.
61
+  </p>
62
+  <form action="" method="get">
63
+    <input type="text" name="q" value="" />
64
+    <input type="submit" value="search" />
65
+    <span id="search-progress" style="padding-left: 10px"></span>
66
+  </form>
67
+  
68
+  <div id="search-results">
69
+  
70
+  </div>
71
+
72
+          </div>
73
+        </div>
74
+      </div>
75
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
76
+        <div class="sphinxsidebarwrapper"><div class="relations">
77
+<h3>Related Topics</h3>
78
+<ul>
79
+  <li><a href="index.html">Documentation overview</a><ul>
80
+  </ul></li>
81
+</ul>
82
+</div>
83
+        </div>
84
+      </div>
85
+      <div class="clearer"></div>
86
+    </div>
87
+    <div class="footer">
88
+      &copy;2019, Dirk Alders.
89
+      
90
+      |
91
+      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.7</a>
92
+      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
93
+      
94
+    </div>
95
+
96
+    
97
+
98
+    
99
+  </body>
100
+</html>

+ 1
- 0
_docs_/searchindex.js Ver arquivo

@@ -0,0 +1 @@
1
+Search.setIndex({docnames:["index"],envversion:52,filenames:["index.rst"],objects:{"":{state_machine:[0,0,0,"-"]},"state_machine.state_machine":{last_transition_condition:[0,2,1,""],last_transition_condition_was:[0,2,1,""],previous_state:[0,2,1,""],previous_state_duration:[0,2,1,""],previous_state_was:[0,2,1,""],register_state_change_callback:[0,2,1,""],this_state:[0,2,1,""],this_state_duration:[0,2,1,""],this_state_is:[0,2,1,""],work:[0,2,1,""]},state_machine:{state_machine:[0,1,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method"},terms:{"boolean":0,"class":0,"default":0,"float":0,"import":0,"long":0,"new":0,"return":0,"true":0,"while":0,The:0,These:0,__example__:0,__init__:0,__log_lvl__:0,activ:0,addit:0,alder:0,all:0,allow:0,also:0,arg:0,argument:0,author:0,been:0,bin:0,bool:0,calcul:0,callback:0,can:0,caus:0,chang:0,check:0,code:0,condit:0,condition_pedastrian_request:0,condition_tru:0,consoleloggingconfigur:0,content:0,creat:0,current:0,cyclicli:0,debug:0,def:0,default_st:0,defin:0,deriv:0,descript:0,dictionari:0,dirk:0,each:0,els:0,enabl:0,env:0,equival:0,exampl:0,execut:0,fals:0,follow:0,from:0,gave:0,getlogg:0,give:0,given:0,green:0,had:0,help:0,how:0,implement:0,includ:0,index:0,info:0,inform:0,initialis:0,instanc:0,kei:0,keyword:0,kwarg:0,last:0,last_transition_condit:0,last_transition_condition_wa:0,level:0,light:0,list:0,log:0,log_lvl:0,log_prefix:0,loge:0,logger:0,logger_nam:0,mean:0,method:0,mockeri:0,modul:0,mount:0,need:0,none:0,number:0,overrid:0,page:0,paramet:0,part:0,pedastrian:0,pedastrian_request:0,pedestrian:0,previou:0,previous:0,previous_st:0,previous_state_dur:0,previous_state_wa:0,python:0,regist:0,register_state_change_callback:0,report:0,request:0,respons:0,search:0,see:0,self:0,set:0,set_padestrian_request:0,start:0,state_green:0,state_r:0,store:0,str:0,submodul:0,sudo:0,support:0,sys:0,target:0,target_st:0,thi:0,this_stat:0,this_state_dur:0,this_state_i:0,time:0,traffic:0,trafic_light:0,traficlight:0,transit:0,tupl:0,type:0,unittest:0,used:0,useful:0,usr:0,utf:0,variabl:0,varibl:0,well:0,where:0,which:0,work:0},titles:["Welcome to state_machine\u2019s documentation!"],titleterms:{document:0,indic:0,machin:0,state:0,state_machin:0,tabl:0,welcom:0}})

+ 17279
- 0
_testresults_/unittest.json
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


BIN
_testresults_/unittest.pdf Ver arquivo


Carregando…
Cancelar
Salvar