[PATCH 1 of 6 v3] tests: remove #! from primes.py in test-highlight.t

Augie Fackler raf at durin42.com
Tue Jun 20 10:10:36 EDT 2017


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1497962696 14400
#      Tue Jun 20 08:44:56 2017 -0400
# Node ID c2e465d9fb3b3c784207c5df126295f59d432dc6
# Parent  b08431e1b0627e5d0e75de75266223b46d70dd2f
tests: remove #! from primes.py in test-highlight.t

It's about to be a source of trouble, but removing it changes a ton of
test lines, so doing this change as a standalone commit.

diff --git a/tests/test-highlight.t b/tests/test-highlight.t
--- a/tests/test-highlight.t
+++ b/tests/test-highlight.t
@@ -20,8 +20,6 @@
 create random Python file to exercise Pygments
 
   $ cat <<EOF > primes.py
-  > #!/usr/bin/env python
-  > 
   > """Fun with generators. Corresponding Haskell implementation:
   > 
   > primes = 2 : sieve [3, 5..]
@@ -76,7 +74,7 @@ hgweb filerevision, html
   <script type="text/javascript" src="/static/mercurial.js"></script>
   
   <link rel="stylesheet" href="/highlightcss" type="text/css" />
-  <title>test: 06824edf55d0 primes.py</title>
+  <title>test: 1af356141006 primes.py</title>
   </head>
   <body>
   
@@ -114,7 +112,7 @@ hgweb filerevision, html
   <div class="main">
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
-   view primes.py @ 0:<a href="/rev/06824edf55d0">06824edf55d0</a>
+   view primes.py @ 0:<a href="/rev/1af356141006">1af356141006</a>
    <span class="tag">tip</span> 
   </h3>
   
@@ -151,39 +149,37 @@ hgweb filerevision, html
   <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
   <div class="sourcefirst"> line source</div>
   <pre class="sourcelines stripes4 wrap bottomline" data-logurl="/log/tip/primes.py" data-ishead="1">
-  <span id="l1"><span class="c">#!/usr/bin/env python</span></span><a href="#l1"></a>
+  <span id="l1"><span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></span><a href="#l1"></a>
   <span id="l2"></span><a href="#l2"></a>
-  <span id="l3"><span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></span><a href="#l3"></a>
-  <span id="l4"></span><a href="#l4"></a>
-  <span id="l5"><span class="sd">primes = 2 : sieve [3, 5..]</span></span><a href="#l5"></a>
-  <span id="l6"><span class="sd">    where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></span><a href="#l6"></a>
-  <span id="l7"><span class="sd">"""</span></span><a href="#l7"></a>
+  <span id="l3"><span class="sd">primes = 2 : sieve [3, 5..]</span></span><a href="#l3"></a>
+  <span id="l4"><span class="sd">    where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></span><a href="#l4"></a>
+  <span id="l5"><span class="sd">"""</span></span><a href="#l5"></a>
+  <span id="l6"></span><a href="#l6"></a>
+  <span id="l7"><span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></span><a href="#l7"></a>
   <span id="l8"></span><a href="#l8"></a>
-  <span id="l9"><span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></span><a href="#l9"></a>
-  <span id="l10"></span><a href="#l10"></a>
-  <span id="l11"><span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></span><a href="#l11"></a>
-  <span id="l12">    <span class="sd">"""Generate all primes."""</span></span><a href="#l12"></a>
-  <span id="l13">    <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l13"></a>
-  <span id="l14">        <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></span><a href="#l14"></a>
-  <span id="l15">        <span class="c"># It is important to yield *here* in order to stop the</span></span><a href="#l15"></a>
-  <span id="l16">        <span class="c"># infinite recursion.</span></span><a href="#l16"></a>
-  <span id="l17">        <span class="kn">yield</span> <span class="n">p</span></span><a href="#l17"></a>
-  <span id="l18">        <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></span><a href="#l18"></a>
-  <span id="l19">        <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l19"></a>
-  <span id="l20">            <span class="kn">yield</span> <span class="n">n</span></span><a href="#l20"></a>
-  <span id="l21"></span><a href="#l21"></a>
-  <span id="l22">    <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></span><a href="#l22"></a>
-  <span id="l23">    <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</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">odds</span><span class="p">)))</span></span><a href="#l23"></a>
-  <span id="l24"></span><a href="#l24"></a>
-  <span id="l25"><span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></span><a href="#l25"></a>
-  <span id="l26">    <span class="kn">import</span> <span class="nn">sys</span></span><a href="#l26"></a>
-  <span id="l27">    <span class="kn">try</span><span class="p">:</span></span><a href="#l27"></a>
-  <span id="l28">        <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></span><a href="#l28"></a>
-  <span id="l29">    <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></span><a href="#l29"></a>
-  <span id="l30">        <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></span><a href="#l30"></a>
-  <span id="l31">    <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></span><a href="#l31"></a>
-  <span id="l32">    <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></span><a href="#l32"></a>
-  <span id="l33"></span><a href="#l33"></a></pre>
+  <span id="l9"><span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></span><a href="#l9"></a>
+  <span id="l10">    <span class="sd">"""Generate all primes."""</span></span><a href="#l10"></a>
+  <span id="l11">    <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l11"></a>
+  <span id="l12">        <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></span><a href="#l12"></a>
+  <span id="l13">        <span class="c"># It is important to yield *here* in order to stop the</span></span><a href="#l13"></a>
+  <span id="l14">        <span class="c"># infinite recursion.</span></span><a href="#l14"></a>
+  <span id="l15">        <span class="kn">yield</span> <span class="n">p</span></span><a href="#l15"></a>
+  <span id="l16">        <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></span><a href="#l16"></a>
+  <span id="l17">        <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l17"></a>
+  <span id="l18">            <span class="kn">yield</span> <span class="n">n</span></span><a href="#l18"></a>
+  <span id="l19"></span><a href="#l19"></a>
+  <span id="l20">    <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></span><a href="#l20"></a>
+  <span id="l21">    <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</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">odds</span><span class="p">)))</span></span><a href="#l21"></a>
+  <span id="l22"></span><a href="#l22"></a>
+  <span id="l23"><span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></span><a href="#l23"></a>
+  <span id="l24">    <span class="kn">import</span> <span class="nn">sys</span></span><a href="#l24"></a>
+  <span id="l25">    <span class="kn">try</span><span class="p">:</span></span><a href="#l25"></a>
+  <span id="l26">        <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></span><a href="#l26"></a>
+  <span id="l27">    <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></span><a href="#l27"></a>
+  <span id="l28">        <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></span><a href="#l28"></a>
+  <span id="l29">    <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></span><a href="#l29"></a>
+  <span id="l30">    <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></span><a href="#l30"></a>
+  <span id="l31"></span><a href="#l31"></a></pre>
   </div>
   
   <script type="text/javascript" src="/static/followlines.js"></script>
@@ -250,7 +246,7 @@ hgweb fileannotate, html
   <div class="main">
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
-   annotate primes.py @ 0:<a href="/rev/06824edf55d0">06824edf55d0</a>
+   annotate primes.py @ 0:<a href="/rev/1af356141006">1af356141006</a>
    <span class="tag">tip</span> 
   </h3>
   
@@ -295,36 +291,36 @@ hgweb fileannotate, html
     
   <tr id="l1" class="thisrev">
   <td class="annotate parity0">
-  <a href="/annotate/06824edf55d0/primes.py#l1">
+  <a href="/annotate/1af356141006/primes.py#l1">
   0
   </a>
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l1">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l1">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l1">     1</a> <span class="c">#!/usr/bin/env python</span></td>
+  <td class="source"><a href="#l1">     1</a> <span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></td>
   </tr>
   <tr id="l2" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l2">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l2">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l2">     2</a> </td>
@@ -334,99 +330,99 @@ hgweb fileannotate, html
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l3">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l3">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l3">     3</a> <span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></td>
+  <td class="source"><a href="#l3">     3</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
   </tr>
   <tr id="l4" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l4">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l4">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l4">     4</a> </td>
+  <td class="source"><a href="#l4">     4</a> <span class="sd">    where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></td>
   </tr>
   <tr id="l5" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l5">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l5">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l5">     5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
+  <td class="source"><a href="#l5">     5</a> <span class="sd">"""</span></td>
   </tr>
   <tr id="l6" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l6">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l6">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l6">     6</a> <span class="sd">    where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></td>
+  <td class="source"><a href="#l6">     6</a> </td>
   </tr>
   <tr id="l7" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l7">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l7">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l7">     7</a> <span class="sd">"""</span></td>
+  <td class="source"><a href="#l7">     7</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
   </tr>
   <tr id="l8" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l8">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l8">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l8">     8</a> </td>
@@ -436,425 +432,391 @@ hgweb fileannotate, html
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l9">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l9">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l9">     9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
+  <td class="source"><a href="#l9">     9</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
   </tr>
   <tr id="l10" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l10">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l10">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l10">    10</a> </td>
+  <td class="source"><a href="#l10">    10</a>     <span class="sd">"""Generate all primes."""</span></td>
   </tr>
   <tr id="l11" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l11">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l11">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l11">    11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
+  <td class="source"><a href="#l11">    11</a>     <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
   </tr>
   <tr id="l12" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l12">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l12">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l12">    12</a>     <span class="sd">"""Generate all primes."""</span></td>
+  <td class="source"><a href="#l12">    12</a>         <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
   </tr>
   <tr id="l13" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l13">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l13">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l13">    13</a>     <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
+  <td class="source"><a href="#l13">    13</a>         <span class="c"># It is important to yield *here* in order to stop the</span></td>
   </tr>
   <tr id="l14" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l14">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l14">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l14">    14</a>         <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
+  <td class="source"><a href="#l14">    14</a>         <span class="c"># infinite recursion.</span></td>
   </tr>
   <tr id="l15" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l15">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l15">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l15">    15</a>         <span class="c"># It is important to yield *here* in order to stop the</span></td>
+  <td class="source"><a href="#l15">    15</a>         <span class="kn">yield</span> <span class="n">p</span></td>
   </tr>
   <tr id="l16" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l16">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l16">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l16">    16</a>         <span class="c"># infinite recursion.</span></td>
+  <td class="source"><a href="#l16">    16</a>         <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
   </tr>
   <tr id="l17" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l17">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l17">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l17">    17</a>         <span class="kn">yield</span> <span class="n">p</span></td>
+  <td class="source"><a href="#l17">    17</a>         <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
   </tr>
   <tr id="l18" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l18">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l18">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l18">    18</a>         <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
+  <td class="source"><a href="#l18">    18</a>             <span class="kn">yield</span> <span class="n">n</span></td>
   </tr>
   <tr id="l19" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l19">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l19">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l19">    19</a>         <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
+  <td class="source"><a href="#l19">    19</a> </td>
   </tr>
   <tr id="l20" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l20">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l20">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l20">    20</a>             <span class="kn">yield</span> <span class="n">n</span></td>
+  <td class="source"><a href="#l20">    20</a>     <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
   </tr>
   <tr id="l21" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l21">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l21">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l21">    21</a> </td>
+  <td class="source"><a href="#l21">    21</a>     <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</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">odds</span><span class="p">)))</span></td>
   </tr>
   <tr id="l22" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l22">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l22">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l22">    22</a>     <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
+  <td class="source"><a href="#l22">    22</a> </td>
   </tr>
   <tr id="l23" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l23">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l23">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l23">    23</a>     <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</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">odds</span><span class="p">)))</span></td>
+  <td class="source"><a href="#l23">    23</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></td>
   </tr>
   <tr id="l24" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l24">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l24">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l24">    24</a> </td>
+  <td class="source"><a href="#l24">    24</a>     <span class="kn">import</span> <span class="nn">sys</span></td>
   </tr>
   <tr id="l25" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l25">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l25">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l25">    25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></td>
+  <td class="source"><a href="#l25">    25</a>     <span class="kn">try</span><span class="p">:</span></td>
   </tr>
   <tr id="l26" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l26">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l26">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l26">    26</a>     <span class="kn">import</span> <span class="nn">sys</span></td>
+  <td class="source"><a href="#l26">    26</a>         <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></td>
   </tr>
   <tr id="l27" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l27">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l27">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l27">    27</a>     <span class="kn">try</span><span class="p">:</span></td>
+  <td class="source"><a href="#l27">    27</a>     <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
   </tr>
   <tr id="l28" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l28">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l28">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l28">    28</a>         <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></td>
+  <td class="source"><a href="#l28">    28</a>         <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></td>
   </tr>
   <tr id="l29" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l29">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l29">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l29">    29</a>     <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
+  <td class="source"><a href="#l29">    29</a>     <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
   </tr>
   <tr id="l30" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l30">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l30">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l30">    30</a>         <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></td>
+  <td class="source"><a href="#l30">    30</a>     <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
   </tr>
   <tr id="l31" class="thisrev">
   <td class="annotate parity0">
   
   <div class="annotate-info">
   <div>
-  <a href="/annotate/06824edf55d0/primes.py#l31">
-  06824edf55d0</a>
-  a
-  </div>
-  <div><em>test</em></div>
-  <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
-  </div>
-  </td>
-  <td class="source"><a href="#l31">    31</a>     <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
-  </tr>
-  <tr id="l32" class="thisrev">
-  <td class="annotate parity0">
-  
-  <div class="annotate-info">
-  <div>
-  <a href="/annotate/06824edf55d0/primes.py#l32">
-  06824edf55d0</a>
+  <a href="/annotate/1af356141006/primes.py#l31">
+  1af356141006</a>
   a
   </div>
   <div><em>test</em></div>
   <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
+  <a href="/diff/1af356141006/primes.py">diff</a>
+  <a href="/rev/1af356141006">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l32">    32</a>     <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
-  </tr>
-  <tr id="l33" class="thisrev">
-  <td class="annotate parity0">
-  
-  <div class="annotate-info">
-  <div>
-  <a href="/annotate/06824edf55d0/primes.py#l33">
-  06824edf55d0</a>
-  a
-  </div>
-  <div><em>test</em></div>
-  <div>parents: </div>
-  <a href="/diff/06824edf55d0/primes.py">diff</a>
-  <a href="/rev/06824edf55d0">changeset</a>
-  </div>
-  </td>
-  <td class="source"><a href="#l33">    33</a> </td>
+  <td class="source"><a href="#l31">    31</a> </td>
   </tr>
   </tbody>
   </table>
@@ -948,7 +910,7 @@ hg serve again
 test that fileset in highlightfiles works and primes.py is not highlighted
 
   $ get-with-headers.py localhost:$HGPORT 'file/tip/primes.py' | grep 'id="l11"'
-  <span id="l11">def primes():</span><a href="#l11"></a>
+  <span id="l11">    def sieve(ns):</span><a href="#l11"></a>
 
 errors encountered
 



More information about the Mercurial-devel mailing list