Source

knife / docs / _build / html / arepeatknife.html

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>knife.active.repeatknife — Actively evaluated repeating knife &mdash; knife  documentation</title>
    
    <link rel="stylesheet" href="_static/haiku.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/print.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/theme_extras.js"></script>
    <link rel="top" title="knife  documentation" href="index.html" />
    <link rel="next" title="knife.active.sliceknife — Actively evaluated slicing knife" href="asliceknife.html" />
    <link rel="prev" title="knife.active.reduceknife — Actively evaluated reducing knife" href="areduceknife.html" /> 
  </head>
  <body>
      <div class="header"><img class="rightlogo" src="_static/knife-smaller.png" alt="Logo"/><h1 class="heading"><a href="index.html">
          <span>knife  documentation</span></a></h1>
        <h2 class="heading"><span>knife.active.repeatknife — Actively evaluated repeating knife</span></h2>
      </div>
      <div class="topnav">
      
        <p>
        «&#160;&#160;<a href="areduceknife.html"><tt class="docutils literal docutils literal docutils literal"><span class="pre">knife.active.reduceknife</span></tt> &#8212; Actively evaluated reducing knife</a>
        &#160;&#160;::&#160;&#160;
        <a class="uplink" href="index.html">Contents</a>
        &#160;&#160;::&#160;&#160;
        <a href="asliceknife.html"><tt class="docutils literal"><span class="pre">knife.active.sliceknife</span></tt> &#8212; Actively evaluated slicing knife</a>&#160;&#160;»
        </p>

      </div>
      <div class="content">
        
        
  <div class="section" id="module-knife.active">
<span id="knife-active-repeatknife-actively-evaluated-repeating-knife"></span><h1><a class="reference internal" href="#knife.active.repeatknife" title="knife.active.repeatknife"><tt class="xref py py-class docutils literal"><span class="pre">knife.active.repeatknife</span></tt></a> &#8212; Actively evaluated repeating knife<a class="headerlink" href="#module-knife.active" title="Permalink to this headline"></a></h1>
<dl class="class">
<dt id="knife.active.repeatknife">
<em class="property">class </em><tt class="descclassname">knife.active.</tt><tt class="descname">repeatknife</tt><big>(</big><em>*things</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife" title="Permalink to this definition"></a></dt>
<dd><p>Actively evaluated repeating knife. Provides repetition operations for
incoming things.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">knife.active</span> <span class="kn">import</span> <span class="n">repeatknife</span>
</pre></div>
</div>
<dl class="method">
<dt id="knife.active.repeatknife.__init__">
<tt class="descname">__init__</tt><big>(</big><em>*things</em>, <em>snapshots=5</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.__init__" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>things</strong> &#8211; incoming things</li>
<li><strong>snapshots</strong> (<em>integer</em>) &#8211; snapshots to keep (default: <tt class="docutils literal"><span class="pre">5</span></tt>)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.__len__">
<tt class="descname">__len__</tt><big>(</big><big>)</big><a class="headerlink" href="#knife.active.repeatknife.__len__" title="Permalink to this definition"></a></dt>
<dd><p>Number of incoming things.</p>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.__iter__">
<tt class="descname">__iter__</tt><big>(</big><big>)</big><a class="headerlink" href="#knife.active.repeatknife.__iter__" title="Permalink to this definition"></a></dt>
<dd><p>Iterate over outgoing things.</p>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.append">
<tt class="descname">append</tt><big>(</big><em>*things</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.append" title="Permalink to this definition"></a></dt>
<dd><p>Insert <cite>things</cite> <strong>after</strong> other incoming things.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>things</strong> &#8211; incoming things</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">knife</span> <span class="kn">import</span> <span class="n">__</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">__</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[3, 4, 5, 1, 2, 3, 4, 5, 6]</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.apply">
<tt class="descname">apply</tt><big>(</big><em>worker</em>, <em>*args</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.apply" title="Permalink to this definition"></a></dt>
<dd><p>Assign <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#callable" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">callable</span></tt></a> used to work on incoming things plus any
<a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-positional-argument" title="(in Python v2.7)"><em class="xref std std-term">positional argument</em></a>s and <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-keyword-argument" title="(in Python v2.7)"><em class="xref std std-term">keyword argument</em></a>s
it will use.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Global <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-positional-argument" title="(in Python v2.7)"><em class="xref std std-term">positional argument</em></a>s and <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-keyword-argument" title="(in Python v2.7)"><em class="xref std std-term">keyword argument</em></a>s
assigned with <a class="reference internal" href="#knife.active.repeatknife.params" title="knife.active.repeatknife.params"><tt class="xref py py-meth docutils literal"><span class="pre">params</span></tt></a> are reset whenever <a class="reference internal" href="#knife.active.repeatknife.apply" title="knife.active.repeatknife.apply"><tt class="xref py py-func docutils literal"><span class="pre">apply</span></tt></a> is
called.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>worker</strong> &#8211; a <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#callable" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">callable</span></tt></a></td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.ascii">
<tt class="descname">ascii</tt><big>(</big><em>errors='strict'</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.ascii" title="Permalink to this definition"></a></dt>
<dd><p><a class="reference external" href="http://docs.python.org/2.7/library/stdtypes.html#str.encode" title="(in Python v2.7)"><tt class="xref py py-meth docutils literal"><span class="pre">encode</span></tt></a> outgoing things as <a class="reference external" href="http://docs.python.org/py3k/library/functions.html#bytes">bytes</a> with the <tt class="docutils literal"><span class="pre">'latin-1'</span></tt> codec.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>errors</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; <a class="reference external" href="http://docs.python.org/library/codecs.html#codec-base-classes">error handling</a> for encoding</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">stuf.six</span> <span class="kn">import</span> <span class="n">u</span><span class="p">,</span> <span class="n">b</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">test</span> <span class="o">=</span> <span class="n">__</span><span class="p">([</span><span class="mi">1</span><span class="p">],</span> <span class="bp">True</span><span class="p">,</span> <span class="s">r&#39;t&#39;</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="s">&#39;i&#39;</span><span class="p">),</span> <span class="n">u</span><span class="p">(</span><span class="s">&#39;g&#39;</span><span class="p">),</span> <span class="bp">None</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">test</span><span class="o">.</span><span class="n">ascii</span><span class="p">()</span><span class="o">.</span><span class="n">oneach</span><span class="p">()</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[&#39;[1]&#39;, &#39;True&#39;, &#39;t&#39;, &#39;i&#39;, &#39;g&#39;, &#39;None&#39;, &#39;(1,)&#39;]</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.back">
<tt class="descname">back</tt><big>(</big><big>)</big><a class="headerlink" href="#knife.active.repeatknife.back" title="Permalink to this definition"></a></dt>
<dd><p>Switch back to <tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a> that piped its incoming
things through this <tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.baseline">
<tt class="descname">baseline</tt><big>(</big><big>)</big><a class="headerlink" href="#knife.active.repeatknife.baseline" title="Permalink to this definition"></a></dt>
<dd><p>Restore incoming things back to the baseline <a class="reference internal" href="#knife.active.repeatknife.snapshot" title="knife.active.repeatknife.snapshot"><tt class="xref py py-meth docutils literal"><span class="pre">snapshot</span></tt></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">knife</span> <span class="kn">import</span> <span class="n">__</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span> <span class="o">=</span> <span class="n">__</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">prepend</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[1, 2, 3, 4, 5, 6, 1, 2, 3]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span><span class="o">.</span><span class="n">snapshot</span><span class="p">()</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[1, 2, 3, 4, 5, 6, 1, 2, 3, 1, 2]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span><span class="o">.</span><span class="n">baseline</span><span class="p">()</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[1, 2, 3, 4, 5, 6, 1, 2, 3]</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.bytes">
<tt class="descname">bytes</tt><big>(</big><em>encoding='utf_8'</em>, <em>errors='strict'</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.bytes" title="Permalink to this definition"></a></dt>
<dd><p><a class="reference external" href="http://docs.python.org/2.7/library/stdtypes.html#str.encode" title="(in Python v2.7)"><tt class="xref py py-meth docutils literal"><span class="pre">encode</span></tt></a> outgoing things as <a class="reference external" href="http://docs.python.org/py3k/library/functions.html#bytes">bytes</a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>encoding</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; character <a class="reference external" href="http://docs.python.org/library/codecs.html#standard-encodings">encoding</a></li>
<li><strong>errors</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; <p><a class="reference external" href="http://docs.python.org/library/codecs.html#codec-base-classes">error handling</a> for encoding</p>
</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></p>
</td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">test</span> <span class="o">=</span> <span class="n">__</span><span class="p">([</span><span class="mi">1</span><span class="p">],</span> <span class="bp">True</span><span class="p">,</span> <span class="s">r&#39;t&#39;</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="s">&#39;i&#39;</span><span class="p">),</span> <span class="n">u</span><span class="p">(</span><span class="s">&#39;g&#39;</span><span class="p">),</span> <span class="bp">None</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">test</span><span class="o">.</span><span class="n">bytes</span><span class="p">()</span><span class="o">.</span><span class="n">oneach</span><span class="p">()</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[&#39;[1]&#39;, &#39;True&#39;, &#39;t&#39;, &#39;i&#39;, &#39;g&#39;, &#39;None&#39;, &#39;(1,)&#39;]</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.clear">
<tt class="descname">clear</tt><big>(</big><big>)</big><a class="headerlink" href="#knife.active.repeatknife.clear" title="Permalink to this definition"></a></dt>
<dd><p>Clear everything.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.combinate">
<tt class="descname">combinate</tt><big>(</big><em>n</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.combinate" title="Permalink to this definition"></a></dt>
<dd><p>Discover <a class="reference external" href="https://en.wikipedia.org/wiki/Combination">combinations</a>
for every <cite>n</cite> incoming things.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>n</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) &#8211; number of incoming things to derive combinations from</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-obj docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">knife</span> <span class="kn">import</span> <span class="n">__</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">__</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">60</span><span class="p">)</span><span class="o">.</span><span class="n">combinate</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>
<span class="go">[(40, 50), (40, 60), (50, 60)]</span>
</pre></div>
</div>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference external" href="http://docs.python.org/2.7/library/itertools.html#itertools.combinations" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">itertools.combinations</span></tt></a></dt>
<dd>function in Python standard library</dd>
</dl>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.copy">
<tt class="descname">copy</tt><big>(</big><big>)</big><a class="headerlink" href="#knife.active.repeatknife.copy" title="Permalink to this definition"></a></dt>
<dd><p>Duplicate each incoming thing.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-obj docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">__</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]],</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="p">[</span><span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">]]])</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>
<span class="go">[[1, [2, 3]], [4, [5, 6]]]</span>
</pre></div>
</div>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference external" href="http://docs.python.org/2.7/library/copy.html#copy.deepcopy" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">copy.deepcopy</span></tt></a></dt>
<dd>function in Python standard library</dd>
</dl>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.get">
<tt class="descname">get</tt><big>(</big><big>)</big><a class="headerlink" href="#knife.active.repeatknife.get" title="Permalink to this definition"></a></dt>
<dd><p>Return outgoing things wrapped with <a class="reference internal" href="#knife.active.repeatknife.wrap" title="knife.active.repeatknife.wrap"><tt class="xref py py-meth docutils literal"><span class="pre">wrap</span></tt></a>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">With only one outgoing thing, only that one outgoing thing is
returned. With multiple outgoing things, they are returned wrapped
with the wrapper assigned with <a class="reference internal" href="#knife.active.repeatknife.wrap" title="knife.active.repeatknife.wrap"><tt class="xref py py-meth docutils literal"><span class="pre">wrap</span></tt></a> (default wrapper is
<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">list</span></tt></a>).</p>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.oneach">
<tt class="descname">oneach</tt><big>(</big><big>)</big><a class="headerlink" href="#knife.active.repeatknife.oneach" title="Permalink to this definition"></a></dt>
<dd><p>Toggle whether each outgoing thing should be individually wrapped with
the wrapper assigned with <a class="reference internal" href="#knife.active.repeatknife.wrap" title="knife.active.repeatknife.wrap"><tt class="xref py py-meth docutils literal"><span class="pre">wrap</span></tt></a> (default wrapper is <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">list</span></tt></a>
) or whether all outgoing things should be wrapped all at once.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a> default behavior is to wrap all outgoing
things all at once. <tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a>s reset back to this
behavior <strong>after</strong> <a class="reference internal" href="#knife.active.repeatknife.get" title="knife.active.repeatknife.get"><tt class="xref py py-meth docutils literal"><span class="pre">get</span></tt></a> or <a class="reference internal" href="#knife.active.repeatknife.peek" title="knife.active.repeatknife.peek"><tt class="xref py py-meth docutils literal"><span class="pre">peek</span></tt></a> is called.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.original">
<tt class="descname">original</tt><big>(</big><big>)</big><a class="headerlink" href="#knife.active.repeatknife.original" title="Permalink to this definition"></a></dt>
<dd><p>Restore incoming things back to the original snapshot.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">THe original snapshot of incoming things is taken following the first
<tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-method" title="(in Python v2.7)"><em class="xref std std-term">method</em></a> call but before the second <tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt>
<a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-method" title="(in Python v2.7)"><em class="xref std std-term">method</em></a> call (if there is a second <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-method" title="(in Python v2.7)"><em class="xref std std-term">method</em></a> call)</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span> <span class="o">=</span> <span class="n">__</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">prepend</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[1, 2, 3, 4, 5, 6, 1, 2, 3]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span><span class="o">.</span><span class="n">original</span><span class="p">()</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[1, 2, 3]</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.params">
<tt class="descname">params</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.params" title="Permalink to this definition"></a></dt>
<dd><p>Assign <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-positional-argument" title="(in Python v2.7)"><em class="xref std std-term">positional argument</em></a>s and <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-keyword-argument" title="(in Python v2.7)"><em class="xref std std-term">keyword argument</em></a>s
to be used globally.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.pattern">
<tt class="descname">pattern</tt><big>(</big><em>pattern</em>, <em>type='parse'</em>, <em>flags=0</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.pattern" title="Permalink to this definition"></a></dt>
<dd><p>Compile search <cite>pattern</cite> for use as <a class="reference internal" href="#knife.active.repeatknife.worker" title="knife.active.repeatknife.worker"><tt class="xref py py-meth docutils literal"><span class="pre">worker</span></tt></a>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Global <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-positional-argument" title="(in Python v2.7)"><em class="xref std std-term">positional argument</em></a>s and <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-keyword-argument" title="(in Python v2.7)"><em class="xref std std-term">keyword argument</em></a>s
assigned with <a class="reference internal" href="#knife.active.repeatknife.params" title="knife.active.repeatknife.params"><tt class="xref py py-meth docutils literal"><span class="pre">params</span></tt></a> are reset whenever a new <cite>pattern</cite> is
compiled.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>pattern</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; search pattern</li>
<li><strong>type</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; engine to compile <cite>pattern</cite> with. Valid options
are <a class="reference external" href="http://pypi.python.org/pypi/parse/">&#8216;parse&#8217;</a>, <a class="reference external" href="http://docs.python.org/library/re.html">&#8216;re&#8217;</a>, or <a class="reference external" href="http://docs.python.org/library/fnmatch.html">&#8216;glob&#8217;</a></li>
<li><strong>flags</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) &#8211; regular expression <a class="reference external" href="http://docs.python.org/library/re.html#re.DEBUG">flags</a></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></p>
</td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="c"># using parse expression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">test</span> <span class="o">=</span> <span class="n">__</span><span class="p">(</span><span class="s">&#39;first test&#39;</span><span class="p">,</span> <span class="s">&#39;second test&#39;</span><span class="p">,</span> <span class="s">&#39;third test&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">test</span><span class="o">.</span><span class="n">pattern</span><span class="p">(</span><span class="s">&#39;first {}&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">filter</span><span class="p">()</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>
<span class="go">&#39;first test&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c"># using glob pattern</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">test</span><span class="o">.</span><span class="n">original</span><span class="p">()</span><span class="o">.</span><span class="n">pattern</span><span class="p">(</span><span class="s">&#39;second*&#39;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&#39;glob&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">filter</span><span class="p">()</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>
<span class="go">&#39;second test&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c"># using regular expression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">test</span><span class="o">.</span><span class="n">original</span><span class="p">()</span><span class="o">.</span><span class="n">pattern</span><span class="p">(</span><span class="s">&#39;third .&#39;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&#39;regex&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">filter</span><span class="p">()</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>
<span class="go">&#39;third test&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.peek">
<tt class="descname">peek</tt><big>(</big><big>)</big><a class="headerlink" href="#knife.active.repeatknife.peek" title="Permalink to this definition"></a></dt>
<dd><p>Preview current incoming things wrapped with <a class="reference internal" href="#knife.active.repeatknife.wrap" title="knife.active.repeatknife.wrap"><tt class="xref py py-meth docutils literal"><span class="pre">wrap</span></tt></a>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">With only one outgoing thing, only that one thing is returned. With
multiple outgoing things, everything is returned wrapped with the
wrapper assigned with <a class="reference internal" href="#knife.active.repeatknife.wrap" title="knife.active.repeatknife.wrap"><tt class="xref py py-meth docutils literal"><span class="pre">wrap</span></tt></a> (default wrapper is <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">list</span></tt></a>).</p>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.permutate">
<tt class="descname">permutate</tt><big>(</big><em>n</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.permutate" title="Permalink to this definition"></a></dt>
<dd><p>Discover <a class="reference external" href="https://en.wikipedia.org/wiki/Permutation">permutations</a>
for every <cite>n</cite> incoming things.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>n</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) &#8211; number of incoming things to derive permutations from</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-obj docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">__</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">60</span><span class="p">)</span><span class="o">.</span><span class="n">permutate</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>
<span class="go">[(40, 50), (40, 60), (50, 40), (50, 60), (60, 40), (60, 50)]</span>
</pre></div>
</div>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference external" href="http://docs.python.org/2.7/library/itertools.html#itertools.permutations" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">itertools.permutations</span></tt></a></dt>
<dd>function in Python standard library</dd>
</dl>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.pipe">
<tt class="descname">pipe</tt><big>(</big><em>knife</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.pipe" title="Permalink to this definition"></a></dt>
<dd><p>Pipe incoming things from some other <tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a>
through this <tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>knife</strong> &#8211; another <tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.prepend">
<tt class="descname">prepend</tt><big>(</big><em>*things</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.prepend" title="Permalink to this definition"></a></dt>
<dd><p>Insert <cite>things</cite> <strong>before</strong> other incoming things.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>things</strong> &#8211; incoming things</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">__</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span><span class="o">.</span><span class="n">prepend</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[1, 2, 3, 4, 5, 6, 3, 4, 5]</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.repeat">
<tt class="descname">repeat</tt><big>(</big><em>n=None</em>, <em>call=False</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.repeat" title="Permalink to this definition"></a></dt>
<dd><p>Repeat incoming things <cite>n</cite> times or invoke <a class="reference internal" href="#knife.active.repeatknife.worker" title="knife.active.repeatknife.worker"><tt class="xref py py-meth docutils literal"><span class="pre">worker</span></tt></a> <cite>n</cite> times.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>n</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) &#8211; number of times to repeat</li>
<li><strong>call</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) &#8211; repeat results of invoking <a class="reference internal" href="#knife.active.repeatknife.worker" title="knife.active.repeatknife.worker"><tt class="xref py py-meth docutils literal"><span class="pre">worker</span></tt></a></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><tt class="xref py py-obj docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></p>
</td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="c"># repeat iterable</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">__</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">60</span><span class="p">)</span><span class="o">.</span><span class="n">repeat</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>
<span class="go">[(40, 50, 60), (40, 50, 60), (40, 50, 60)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">test</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">):</span>
<span class="gp">... </span>   <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c"># with worker</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">__</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">60</span><span class="p">)</span><span class="o">.</span><span class="n">worker</span><span class="p">(</span><span class="n">test</span><span class="p">)</span><span class="o">.</span><span class="n">repeat</span><span class="p">(</span><span class="n">n</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">call</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>
<span class="go">[[40, 50, 60], [40, 50, 60], [40, 50, 60]]</span>
</pre></div>
</div>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference external" href="http://docs.python.org/2.7/library/itertools.html#itertools.repeat" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">itertools.repeat</span></tt></a></dt>
<dd>function in Python standard library</dd>
<dt><a class="reference external" href="http://documentcloud.github.com/underscore/#times">times</a></dt>
<dd>function in Underscore.js</dd>
<dt><a class="reference external" href="http://vti.github.com/underscore-perl/#times">times</a></dt>
<dd>function in Underscore.perl</dd>
<dt><a class="reference external" href="http://brianhaveri.github.com/Underscore.php/#times">times</a></dt>
<dd>function in Underscore.php</dd>
</dl>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.snapshot">
<tt class="descname">snapshot</tt><big>(</big><big>)</big><a class="headerlink" href="#knife.active.repeatknife.snapshot" title="Permalink to this definition"></a></dt>
<dd><p>Take a baseline snapshot of current incoming things.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.undo">
<tt class="descname">undo</tt><big>(</big><em>snapshot=0</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.undo" title="Permalink to this definition"></a></dt>
<dd><p>Revert incoming things to a previous snapshot.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">A snapshot of current incoming things is taken when a <tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt>
<a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-method" title="(in Python v2.7)"><em class="xref std std-term">method</em></a> is called but before the main body of the method
executes.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>snapshot</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) &#8211; number of steps ago <tt class="docutils literal"><span class="pre">1</span></tt>, <tt class="docutils literal"><span class="pre">2</span></tt>, <tt class="docutils literal"><span class="pre">3</span></tt>, etc.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span> <span class="o">=</span> <span class="n">__</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">prepend</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[1, 2, 3, 4, 5, 6, 1, 2, 3]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c"># undo back one step</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">undo</span><span class="p">()</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[1, 2, 3, 4, 5, 6, 1, 2, 3]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c"># undo back one step</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">undo</span><span class="p">()</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[1, 2, 3, 4, 5, 6, 1, 2, 3, 1]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c"># undo back 2 steps</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">undone</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">undo</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[1, 2, 3, 4, 5, 6, 1, 2, 3, 1]</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.unicode">
<tt class="descname">unicode</tt><big>(</big><em>encoding='utf_8'</em>, <em>errors='strict'</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.unicode" title="Permalink to this definition"></a></dt>
<dd><p><a class="reference internal" href="#knife.active.repeatknife.unicode" title="knife.active.repeatknife.unicode"><tt class="xref py py-func docutils literal"><span class="pre">unicode</span></tt></a> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">str</span></tt></a> under Python 3) <a class="reference external" href="http://docs.python.org/2.7/library/stdtypes.html#str.decode" title="(in Python v2.7)"><tt class="xref py py-meth docutils literal"><span class="pre">decode</span></tt></a>
outgoing things.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>encoding</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; <p>Unicode <a class="reference external" href="http://docs.python.org/library/codecs.html#standard-encodings">encoding</a></p>
</li>
<li><strong>errors</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; <p><a class="reference external" href="http://docs.python.org/library/codecs.html#codec-base-classes">error handling</a> for decoding</p>
</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></p>
</td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">test</span> <span class="o">=</span> <span class="n">__</span><span class="p">([</span><span class="mi">1</span><span class="p">],</span> <span class="bp">True</span><span class="p">,</span> <span class="s">r&#39;t&#39;</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="s">&#39;i&#39;</span><span class="p">),</span> <span class="n">u</span><span class="p">(</span><span class="s">&#39;g&#39;</span><span class="p">),</span> <span class="bp">None</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">test</span><span class="o">.</span><span class="n">unicode</span><span class="p">()</span><span class="o">.</span><span class="n">oneach</span><span class="p">()</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">[u&#39;[1]&#39;, u&#39;True&#39;, u&#39;t&#39;, u&#39;i&#39;, u&#39;g&#39;, u&#39;None&#39;, u&#39;(1,)&#39;]</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.worker">
<tt class="descname">worker</tt><big>(</big><em>worker</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.worker" title="Permalink to this definition"></a></dt>
<dd><p>Assign <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#callable" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">callable</span></tt></a> used to work on incoming things.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Global <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-positional-argument" title="(in Python v2.7)"><em class="xref std std-term">positional argument</em></a>s and <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-keyword-argument" title="(in Python v2.7)"><em class="xref std std-term">keyword argument</em></a>s
assigned with <a class="reference internal" href="#knife.active.repeatknife.params" title="knife.active.repeatknife.params"><tt class="xref py py-meth docutils literal"><span class="pre">params</span></tt></a> are reset whenever a new <cite>worker</cite> is
assigned.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>worker</strong> &#8211; a <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#callable" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">callable</span></tt></a></td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="knife.active.repeatknife.wrap">
<tt class="descname">wrap</tt><big>(</big><em>wrapper</em><big>)</big><a class="headerlink" href="#knife.active.repeatknife.wrap" title="Permalink to this definition"></a></dt>
<dd><p>Assign <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a>, <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-type" title="(in Python v2.7)"><em class="xref std std-term">type</em></a>, or <a class="reference external" href="http://docs.python.org/2.7/reference/compound_stmts.html#class" title="(in Python v2.7)"><tt class="xref std std-keyword docutils literal"><span class="pre">class</span></tt></a> used to wrap
outgoing things.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">A <tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a> resets back to its default wrapper
(<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">list</span></tt></a>) after <a class="reference internal" href="#knife.active.repeatknife.get" title="knife.active.repeatknife.get"><tt class="xref py py-meth docutils literal"><span class="pre">get</span></tt></a> or <a class="reference internal" href="#knife.active.repeatknife.peek" title="knife.active.repeatknife.peek"><tt class="xref py py-meth docutils literal"><span class="pre">peek</span></tt></a> is called.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>wrapper</strong> &#8211; an <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a>, <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#type" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">type</span></tt></a>, or <a class="reference external" href="http://docs.python.org/2.7/reference/compound_stmts.html#class" title="(in Python v2.7)"><tt class="xref std std-keyword docutils literal"><span class="pre">class</span></tt></a></td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-mod docutils literal"><span class="pre">knife</span></tt> <a class="reference external" href="http://docs.python.org/2.7/glossary.html#term-object" title="(in Python v2.7)"><em class="xref std std-term">object</em></a></td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">__</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="nb">tuple</span><span class="p">)</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span>
<span class="go">(1, 2, 3, 4, 5, 6)</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

</div>


      </div>
      <div class="bottomnav">
      
        <p>
        «&#160;&#160;<a href="areduceknife.html"><tt class="docutils literal docutils literal docutils literal"><span class="pre">knife.active.reduceknife</span></tt> &#8212; Actively evaluated reducing knife</a>
        &#160;&#160;::&#160;&#160;
        <a class="uplink" href="index.html">Contents</a>
        &#160;&#160;::&#160;&#160;
        <a href="asliceknife.html"><tt class="docutils literal"><span class="pre">knife.active.sliceknife</span></tt> &#8212; Actively evaluated slicing knife</a>&#160;&#160;»
        </p>

      </div>

    <div class="footer">
        &copy; Copyright 2012, L. C. Rees.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.