diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-12-05 16:29:33 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-12-05 16:29:33 -0500 |
commit | 8603e0485333af6704e0cd0770f565fc2d716569 (patch) | |
tree | 0e31e623a5f27c2b2af98bd54c27b6fdab46ab1d /doc/sample_html | |
parent | bbfd0597107e1e7d4034c21af1cefb3e2c758314 (diff) | |
download | python-coveragepy-8603e0485333af6704e0cd0770f565fc2d716569.tar.gz |
Last touches for 3.2 final.
Diffstat (limited to 'doc/sample_html')
-rw-r--r-- | doc/sample_html/README.txt | 4 | ||||
-rw-r--r-- | doc/sample_html/_ned_py_path.html | 1711 | ||||
-rw-r--r-- | doc/sample_html/cogapp_cogapp.html | 1881 | ||||
-rw-r--r-- | doc/sample_html/cogapp_makefiles.html | 165 | ||||
-rw-r--r-- | doc/sample_html/cogapp_test_cogapp.html | 4333 | ||||
-rw-r--r-- | doc/sample_html/cogapp_whiteutils.html | 217 | ||||
-rw-r--r-- | doc/sample_html/coverage_html.js | 64 | ||||
-rw-r--r-- | doc/sample_html/index.html | 204 | ||||
-rw-r--r-- | doc/sample_html/jquery.tablesorter.min.js | 2 | ||||
-rw-r--r-- | doc/sample_html/style.css | 88 |
10 files changed, 4419 insertions, 4250 deletions
diff --git a/doc/sample_html/README.txt b/doc/sample_html/README.txt index c1e4982..2890fb9 100644 --- a/doc/sample_html/README.txt +++ b/doc/sample_html/README.txt @@ -1,5 +1,5 @@ This directory was made with::
cd C:\ned\cog\trunk
- coverage -e -x cogapp\test_cogapp.py CogTestsInMemory
- coverage -b -i -d htmlcov
+ coverage run --branch cogapp\test_cogapp.py CogTestsInMemory
+ coverage html -i -d htmlcov
diff --git a/doc/sample_html/_ned_py_path.html b/doc/sample_html/_ned_py_path.html index 78637ee..0a60bbe 100644 --- a/doc/sample_html/_ned_py_path.html +++ b/doc/sample_html/_ned_py_path.html @@ -1,19 +1,21 @@ -<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
+<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Coverage for c:\ned\py\path</title>
<link rel='stylesheet' href='style.css' type='text/css'>
-<script src='jquery-1.3.2.min.js'></script>
-<script>
+<script type='text/javascript' src='jquery-1.3.2.min.js'></script>
+<script type='text/javascript'>
function toggle_lines(btn, cls) {
var btn = $(btn);
- if (btn.hasClass("hide")) {
- $("#source ."+cls).removeClass("hide");
- btn.removeClass("hide");
+ var hide = "hide_"+cls;
+ if (btn.hasClass(hide)) {
+ $("#source ."+cls).removeClass(hide);
+ btn.removeClass(hide);
}
else {
- $("#source ."+cls).addClass("hide");
- btn.addClass("hide");
+ $("#source ."+cls).addClass(hide);
+ btn.addClass(hide);
}
}
</script>
@@ -22,13 +24,16 @@ function toggle_lines(btn, cls) { <div id='header'>
<div class='content'>
<h1>Coverage for <b>c:\ned\py\path</b> :
- <span class='pc_cov'>40%</span>
+ <span class='pc_cov'>35%</span>
</h1>
<h2 class='stats'>
286 statements
- <span class='run hide' onclick='toggle_lines(this, "run")'>114 run</span>
+ <span class='run hide_run' onclick='toggle_lines(this, "run")'>114 run</span>
<span class='exc' onclick='toggle_lines(this, "exc")'>0 excluded</span>
<span class='mis' onclick='toggle_lines(this, "mis")'>172 missing</span>
+
+ <span class='par run hide_run' onclick='toggle_lines(this, "par")'>22 partial</span>
+
</h2>
</div>
</div>
@@ -68,34 +73,34 @@ function toggle_lines(btn, cls) { <p class='pln'>29</p>
<p class='pln'>30</p>
<p class='pln'>31</p>
-<p class='stm run hide'>32</p>
+<p class='stm run hide_run'>32</p>
<p class='pln'>33</p>
-<p class='stm run hide'>34</p>
+<p class='stm run hide_run'>34</p>
<p class='pln'>35</p>
-<p class='stm run hide'>36</p>
-<p class='stm run hide'>37</p>
+<p class='stm run hide_run'>36</p>
+<p class='stm run hide_run'>37</p>
<p class='pln'>38</p>
<p class='pln'>39</p>
-<p class='stm run hide'>40</p>
-<p class='stm run hide'>41</p>
-<p class='stm run hide'>42</p>
-<p class='stm run hide'>43</p>
+<p class='stm run hide_run'>40</p>
+<p class='stm run hide_run'>41</p>
+<p class='stm par run hide_run'>42</p>
+<p class='stm run hide_run'>43</p>
<p class='stm mis'>44</p>
<p class='stm mis'>45</p>
<p class='pln'>46</p>
<p class='pln'>47</p>
-<p class='stm run hide'>48</p>
-<p class='stm run hide'>49</p>
+<p class='stm run hide_run'>48</p>
+<p class='stm run hide_run'>49</p>
<p class='stm mis'>50</p>
<p class='stm mis'>51</p>
<p class='pln'>52</p>
<p class='pln'>53</p>
-<p class='stm run hide'>54</p>
-<p class='stm run hide'>55</p>
-<p class='stm run hide'>56</p>
+<p class='stm run hide_run'>54</p>
+<p class='stm par run hide_run'>55</p>
+<p class='stm run hide_run'>56</p>
<p class='pln'>57</p>
<p class='pln'>58</p>
-<p class='stm run hide'>59</p>
+<p class='stm run hide_run'>59</p>
<p class='pln'>60</p>
<p class='pln'>61</p>
<p class='pln'>62</p>
@@ -104,18 +109,18 @@ function toggle_lines(btn, cls) { <p class='pln'>65</p>
<p class='pln'>66</p>
<p class='pln'>67</p>
-<p class='stm run hide'>68</p>
+<p class='stm run hide_run'>68</p>
<p class='stm mis'>69</p>
<p class='pln'>70</p>
<p class='pln'>71</p>
-<p class='stm run hide'>72</p>
+<p class='stm run hide_run'>72</p>
<p class='stm mis'>73</p>
<p class='pln'>74</p>
-<p class='stm run hide'>75</p>
+<p class='stm run hide_run'>75</p>
<p class='stm mis'>76</p>
<p class='pln'>77</p>
<p class='pln'>78</p>
-<p class='stm run hide'>79</p>
+<p class='stm run hide_run'>79</p>
<p class='pln'>80</p>
<p class='pln'>81</p>
<p class='pln'>82</p>
@@ -124,26 +129,26 @@ function toggle_lines(btn, cls) { <p class='stm mis'>85</p>
<p class='pln'>86</p>
<p class='pln'>87</p>
-<p class='stm run hide'>88</p>
+<p class='stm run hide_run'>88</p>
<p class='pln'>89</p>
-<p class='stm run hide'>90</p>
+<p class='stm run hide_run'>90</p>
<p class='pln'>91</p>
<p class='stm mis'>92</p>
-<p class='stm run hide'>93</p>
+<p class='stm run hide_run'>93</p>
<p class='pln'>94</p>
<p class='pln'>95</p>
<p class='pln'>96</p>
<p class='pln'>97</p>
-<p class='stm run hide'>98</p>
-<p class='stm run hide'>99</p>
-<p class='stm run hide'>100</p>
-<p class='stm run hide'>101</p>
-<p class='stm run hide'>102</p>
-<p class='stm run hide'>103</p>
-<p class='stm run hide'>104</p>
-<p class='stm run hide'>105</p>
+<p class='stm par run hide_run'>98</p>
+<p class='stm par run hide_run'>99</p>
+<p class='stm par run hide_run'>100</p>
+<p class='stm par run hide_run'>101</p>
+<p class='stm par run hide_run'>102</p>
+<p class='stm par run hide_run'>103</p>
+<p class='stm par run hide_run'>104</p>
+<p class='stm run hide_run'>105</p>
<p class='pln'>106</p>
-<p class='stm run hide'>107</p>
+<p class='stm run hide_run'>107</p>
<p class='pln'>108</p>
<p class='pln'>109</p>
<p class='pln'>110</p>
@@ -152,33 +157,33 @@ function toggle_lines(btn, cls) { <p class='pln'>113</p>
<p class='stm mis'>114</p>
<p class='pln'>115</p>
-<p class='stm run hide'>116</p>
+<p class='stm run hide_run'>116</p>
<p class='stm mis'>117</p>
<p class='stm mis'>118</p>
<p class='pln'>119</p>
-<p class='stm run hide'>120</p>
+<p class='stm run hide_run'>120</p>
<p class='stm mis'>121</p>
<p class='stm mis'>122</p>
<p class='pln'>123</p>
-<p class='stm run hide'>124</p>
+<p class='stm run hide_run'>124</p>
<p class='stm mis'>125</p>
<p class='stm mis'>126</p>
<p class='pln'>127</p>
-<p class='stm run hide'>128</p>
+<p class='stm run hide_run'>128</p>
<p class='pln'>129</p>
<p class='pln'>130</p>
<p class='pln'>131</p>
<p class='pln'>132</p>
<p class='pln'>133</p>
<p class='pln'>134</p>
-<p class='stm run hide'>135</p>
+<p class='stm run hide_run'>135</p>
<p class='pln'>136</p>
<p class='pln'>137</p>
<p class='pln'>138</p>
<p class='pln'>139</p>
<p class='pln'>140</p>
<p class='pln'>141</p>
-<p class='stm run hide'>142</p>
+<p class='stm run hide_run'>142</p>
<p class='pln'>143</p>
<p class='pln'>144</p>
<p class='pln'>145</p>
@@ -186,22 +191,22 @@ function toggle_lines(btn, cls) { <p class='pln'>147</p>
<p class='pln'>148</p>
<p class='pln'>149</p>
-<p class='stm run hide'>150</p>
+<p class='stm run hide_run'>150</p>
<p class='pln'>151</p>
<p class='pln'>152</p>
<p class='pln'>153</p>
-<p class='stm run hide'>154</p>
+<p class='stm run hide_run'>154</p>
<p class='pln'>155</p>
<p class='pln'>156</p>
<p class='pln'>157</p>
<p class='pln'>158</p>
<p class='pln'>159</p>
-<p class='stm run hide'>160</p>
+<p class='stm run hide_run'>160</p>
<p class='pln'>161</p>
<p class='stm mis'>162</p>
<p class='stm mis'>163</p>
<p class='pln'>164</p>
-<p class='stm run hide'>165</p>
+<p class='stm run hide_run'>165</p>
<p class='pln'>166</p>
<p class='pln'>167</p>
<p class='pln'>168</p>
@@ -211,7 +216,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>172</p>
<p class='stm mis'>173</p>
<p class='pln'>174</p>
-<p class='stm run hide'>175</p>
+<p class='stm run hide_run'>175</p>
<p class='pln'>176</p>
<p class='pln'>177</p>
<p class='pln'>178</p>
@@ -228,7 +233,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>189</p>
<p class='stm mis'>190</p>
<p class='pln'>191</p>
-<p class='stm run hide'>192</p>
+<p class='stm run hide_run'>192</p>
<p class='pln'>193</p>
<p class='pln'>194</p>
<p class='pln'>195</p>
@@ -236,28 +241,28 @@ function toggle_lines(btn, cls) { <p class='pln'>197</p>
<p class='stm mis'>198</p>
<p class='pln'>199</p>
-<p class='stm run hide'>200</p>
-<p class='stm run hide'>201</p>
+<p class='stm par run hide_run'>200</p>
+<p class='stm run hide_run'>201</p>
<p class='stm mis'>202</p>
<p class='stm mis'>203</p>
<p class='pln'>204</p>
-<p class='stm run hide'>205</p>
+<p class='stm run hide_run'>205</p>
<p class='stm mis'>206</p>
<p class='stm mis'>207</p>
<p class='pln'>208</p>
-<p class='stm run hide'>209</p>
+<p class='stm run hide_run'>209</p>
<p class='pln'>210</p>
<p class='pln'>211</p>
<p class='pln'>212</p>
<p class='pln'>213</p>
-<p class='stm run hide'>214</p>
+<p class='stm run hide_run'>214</p>
<p class='pln'>215</p>
<p class='pln'>216</p>
<p class='pln'>217</p>
<p class='pln'>218</p>
<p class='stm mis'>219</p>
<p class='pln'>220</p>
-<p class='stm run hide'>221</p>
+<p class='stm run hide_run'>221</p>
<p class='pln'>222</p>
<p class='pln'>223</p>
<p class='pln'>224</p>
@@ -279,14 +284,14 @@ function toggle_lines(btn, cls) { <p class='stm mis'>240</p>
<p class='stm mis'>241</p>
<p class='pln'>242</p>
-<p class='stm run hide'>243</p>
+<p class='stm run hide_run'>243</p>
<p class='pln'>244</p>
<p class='pln'>245</p>
<p class='pln'>246</p>
<p class='stm mis'>247</p>
<p class='stm mis'>248</p>
<p class='pln'>249</p>
-<p class='stm run hide'>250</p>
+<p class='stm run hide_run'>250</p>
<p class='pln'>251</p>
<p class='pln'>252</p>
<p class='pln'>253</p>
@@ -326,7 +331,7 @@ function toggle_lines(btn, cls) { <p class='pln'>287</p>
<p class='pln'>288</p>
<p class='pln'>289</p>
-<p class='stm run hide'>290</p>
+<p class='stm run hide_run'>290</p>
<p class='pln'>291</p>
<p class='pln'>292</p>
<p class='pln'>293</p>
@@ -342,7 +347,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>303</p>
<p class='stm mis'>304</p>
<p class='pln'>305</p>
-<p class='stm run hide'>306</p>
+<p class='stm run hide_run'>306</p>
<p class='pln'>307</p>
<p class='pln'>308</p>
<p class='pln'>309</p>
@@ -355,7 +360,7 @@ function toggle_lines(btn, cls) { <p class='pln'>316</p>
<p class='stm mis'>317</p>
<p class='pln'>318</p>
-<p class='stm run hide'>319</p>
+<p class='stm run hide_run'>319</p>
<p class='pln'>320</p>
<p class='pln'>321</p>
<p class='pln'>322</p>
@@ -368,7 +373,7 @@ function toggle_lines(btn, cls) { <p class='pln'>329</p>
<p class='stm mis'>330</p>
<p class='pln'>331</p>
-<p class='stm run hide'>332</p>
+<p class='stm run hide_run'>332</p>
<p class='pln'>333</p>
<p class='pln'>334</p>
<p class='pln'>335</p>
@@ -385,7 +390,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>346</p>
<p class='stm mis'>347</p>
<p class='pln'>348</p>
-<p class='stm run hide'>349</p>
+<p class='stm run hide_run'>349</p>
<p class='pln'>350</p>
<p class='pln'>351</p>
<p class='pln'>352</p>
@@ -399,7 +404,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>360</p>
<p class='stm mis'>361</p>
<p class='pln'>362</p>
-<p class='stm run hide'>363</p>
+<p class='stm run hide_run'>363</p>
<p class='pln'>364</p>
<p class='pln'>365</p>
<p class='pln'>366</p>
@@ -415,7 +420,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>376</p>
<p class='stm mis'>377</p>
<p class='pln'>378</p>
-<p class='stm run hide'>379</p>
+<p class='stm run hide_run'>379</p>
<p class='pln'>380</p>
<p class='pln'>381</p>
<p class='pln'>382</p>
@@ -423,7 +428,7 @@ function toggle_lines(btn, cls) { <p class='pln'>384</p>
<p class='stm mis'>385</p>
<p class='pln'>386</p>
-<p class='stm run hide'>387</p>
+<p class='stm run hide_run'>387</p>
<p class='pln'>388</p>
<p class='pln'>389</p>
<p class='pln'>390</p>
@@ -436,11 +441,11 @@ function toggle_lines(btn, cls) { <p class='pln'>397</p>
<p class='pln'>398</p>
<p class='pln'>399</p>
-<p class='stm run hide'>400</p>
+<p class='stm run hide_run'>400</p>
<p class='pln'>401</p>
<p class='stm mis'>402</p>
<p class='pln'>403</p>
-<p class='stm run hide'>404</p>
+<p class='stm run hide_run'>404</p>
<p class='pln'>405</p>
<p class='stm mis'>406</p>
<p class='stm mis'>407</p>
@@ -448,7 +453,7 @@ function toggle_lines(btn, cls) { <p class='pln'>409</p>
<p class='stm mis'>410</p>
<p class='pln'>411</p>
-<p class='stm run hide'>412</p>
+<p class='stm run hide_run'>412</p>
<p class='pln'>413</p>
<p class='pln'>414</p>
<p class='pln'>415</p>
@@ -464,7 +469,7 @@ function toggle_lines(btn, cls) { <p class='pln'>425</p>
<p class='stm mis'>426</p>
<p class='pln'>427</p>
-<p class='stm run hide'>428</p>
+<p class='stm run hide_run'>428</p>
<p class='pln'>429</p>
<p class='pln'>430</p>
<p class='pln'>431</p>
@@ -497,7 +502,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>458</p>
<p class='stm mis'>459</p>
<p class='pln'>460</p>
-<p class='stm run hide'>461</p>
+<p class='stm run hide_run'>461</p>
<p class='pln'>462</p>
<p class='pln'>463</p>
<p class='pln'>464</p>
@@ -548,7 +553,7 @@ function toggle_lines(btn, cls) { <p class='pln'>509</p>
<p class='stm mis'>510</p>
<p class='pln'>511</p>
-<p class='stm run hide'>512</p>
+<p class='stm run hide_run'>512</p>
<p class='pln'>513</p>
<p class='pln'>514</p>
<p class='pln'>515</p>
@@ -574,7 +579,7 @@ function toggle_lines(btn, cls) { <p class='pln'>535</p>
<p class='stm mis'>536</p>
<p class='pln'>537</p>
-<p class='stm run hide'>538</p>
+<p class='stm run hide_run'>538</p>
<p class='pln'>539</p>
<p class='pln'>540</p>
<p class='pln'>541</p>
@@ -602,101 +607,101 @@ function toggle_lines(btn, cls) { <p class='pln'>563</p>
<p class='pln'>564</p>
<p class='pln'>565</p>
-<p class='stm run hide'>566</p>
-<p class='stm run hide'>567</p>
-<p class='stm run hide'>568</p>
-<p class='stm run hide'>569</p>
-<p class='stm run hide'>570</p>
-<p class='stm run hide'>571</p>
+<p class='stm run hide_run'>566</p>
+<p class='stm run hide_run'>567</p>
+<p class='stm run hide_run'>568</p>
+<p class='stm run hide_run'>569</p>
+<p class='stm run hide_run'>570</p>
+<p class='stm run hide_run'>571</p>
<p class='pln'>572</p>
-<p class='stm run hide'>573</p>
+<p class='stm par run hide_run'>573</p>
<p class='stm mis'>574</p>
<p class='pln'>575</p>
-<p class='stm run hide'>576</p>
-<p class='stm run hide'>577</p>
+<p class='stm run hide_run'>576</p>
+<p class='stm run hide_run'>577</p>
<p class='pln'>578</p>
<p class='pln'>579</p>
<p class='pln'>580</p>
-<p class='stm run hide'>581</p>
-<p class='stm run hide'>582</p>
+<p class='stm run hide_run'>581</p>
+<p class='stm run hide_run'>582</p>
<p class='pln'>583</p>
<p class='pln'>584</p>
<p class='pln'>585</p>
-<p class='stm run hide'>586</p>
-<p class='stm run hide'>587</p>
-<p class='stm run hide'>588</p>
+<p class='stm par run hide_run'>586</p>
+<p class='stm run hide_run'>587</p>
+<p class='stm run hide_run'>588</p>
<p class='pln'>589</p>
<p class='pln'>590</p>
<p class='pln'>591</p>
-<p class='stm run hide'>592</p>
-<p class='stm run hide'>593</p>
+<p class='stm run hide_run'>592</p>
+<p class='stm run hide_run'>593</p>
<p class='pln'>594</p>
<p class='pln'>595</p>
<p class='pln'>596</p>
-<p class='stm run hide'>597</p>
-<p class='stm run hide'>598</p>
+<p class='stm par run hide_run'>597</p>
+<p class='stm run hide_run'>598</p>
<p class='pln'>599</p>
<p class='pln'>600</p>
<p class='pln'>601</p>
<p class='pln'>602</p>
<p class='stm mis'>603</p>
<p class='pln'>604</p>
-<p class='stm run hide'>605</p>
+<p class='stm run hide_run'>605</p>
<p class='pln'>606</p>
<p class='stm mis'>607</p>
<p class='pln'>608</p>
-<p class='stm run hide'>609</p>
+<p class='stm run hide_run'>609</p>
<p class='pln'>610</p>
<p class='stm mis'>611</p>
<p class='pln'>612</p>
-<p class='stm run hide'>613</p>
+<p class='stm par run hide_run'>613</p>
<p class='stm mis'>614</p>
<p class='pln'>615</p>
<p class='stm mis'>616</p>
<p class='pln'>617</p>
-<p class='stm run hide'>618</p>
+<p class='stm par run hide_run'>618</p>
<p class='stm mis'>619</p>
<p class='stm mis'>620</p>
<p class='pln'>621</p>
<p class='pln'>622</p>
<p class='pln'>623</p>
<p class='pln'>624</p>
-<p class='stm run hide'>625</p>
+<p class='stm run hide_run'>625</p>
<p class='pln'>626</p>
<p class='stm mis'>627</p>
<p class='pln'>628</p>
-<p class='stm run hide'>629</p>
+<p class='stm run hide_run'>629</p>
<p class='stm mis'>630</p>
<p class='pln'>631</p>
-<p class='stm run hide'>632</p>
+<p class='stm par run hide_run'>632</p>
<p class='stm mis'>633</p>
<p class='stm mis'>634</p>
<p class='pln'>635</p>
-<p class='stm run hide'>636</p>
+<p class='stm run hide_run'>636</p>
<p class='stm mis'>637</p>
<p class='pln'>638</p>
-<p class='stm run hide'>639</p>
+<p class='stm run hide_run'>639</p>
<p class='stm mis'>640</p>
<p class='pln'>641</p>
<p class='pln'>642</p>
<p class='pln'>643</p>
<p class='pln'>644</p>
-<p class='stm run hide'>645</p>
+<p class='stm run hide_run'>645</p>
<p class='stm mis'>646</p>
<p class='pln'>647</p>
-<p class='stm run hide'>648</p>
+<p class='stm run hide_run'>648</p>
<p class='stm mis'>649</p>
<p class='pln'>650</p>
-<p class='stm run hide'>651</p>
+<p class='stm run hide_run'>651</p>
<p class='stm mis'>652</p>
<p class='pln'>653</p>
-<p class='stm run hide'>654</p>
+<p class='stm run hide_run'>654</p>
<p class='stm mis'>655</p>
<p class='pln'>656</p>
<p class='pln'>657</p>
<p class='pln'>658</p>
<p class='pln'>659</p>
-<p class='stm run hide'>660</p>
+<p class='stm run hide_run'>660</p>
<p class='pln'>661</p>
<p class='pln'>662</p>
<p class='pln'>663</p>
@@ -704,26 +709,26 @@ function toggle_lines(btn, cls) { <p class='stm mis'>665</p>
<p class='stm mis'>666</p>
<p class='pln'>667</p>
-<p class='stm run hide'>668</p>
+<p class='stm run hide_run'>668</p>
<p class='stm mis'>669</p>
<p class='pln'>670</p>
-<p class='stm run hide'>671</p>
+<p class='stm run hide_run'>671</p>
<p class='stm mis'>672</p>
<p class='pln'>673</p>
<p class='pln'>674</p>
<p class='pln'>675</p>
<p class='pln'>676</p>
-<p class='stm run hide'>677</p>
+<p class='stm par run hide_run'>677</p>
<p class='stm mis'>678</p>
<p class='pln'>679</p>
<p class='stm mis'>680</p>
<p class='pln'>681</p>
-<p class='stm run hide'>682</p>
+<p class='stm par run hide_run'>682</p>
<p class='stm mis'>683</p>
<p class='pln'>684</p>
<p class='stm mis'>685</p>
<p class='pln'>686</p>
-<p class='stm run hide'>687</p>
+<p class='stm par run hide_run'>687</p>
<p class='stm mis'>688</p>
<p class='pln'>689</p>
<p class='pln'>690</p>
@@ -745,759 +750,759 @@ function toggle_lines(btn, cls) { <p class='pln'>706</p>
<p class='pln'>707</p>
<p class='pln'>708</p>
-<p class='stm run hide'>709</p>
-<p class='stm run hide'>710</p>
-<p class='stm run hide'>711</p>
-<p class='stm run hide'>712</p>
-<p class='stm run hide'>713</p>
-<p class='stm run hide'>714</p>
-<p class='stm run hide'>715</p>
-<p class='stm run hide'>716</p>
-<p class='stm run hide'>717</p>
+<p class='stm run hide_run'>709</p>
+<p class='stm run hide_run'>710</p>
+<p class='stm run hide_run'>711</p>
+<p class='stm run hide_run'>712</p>
+<p class='stm run hide_run'>713</p>
+<p class='stm run hide_run'>714</p>
+<p class='stm par run hide_run'>715</p>
+<p class='stm run hide_run'>716</p>
+<p class='stm run hide_run'>717</p>
<p class='pln'>718</p>
<p class='pln'>719</p>
<p class='pln'>720</p>
<p class='pln'>721</p>
-<p class='stm run hide'>722</p>
+<p class='stm par run hide_run'>722</p>
<p class='stm mis'>723</p>
<p class='stm mis'>724</p>
<p class='pln'>725</p>
-<p class='stm run hide'>726</p>
-<p class='stm run hide'>727</p>
+<p class='stm par run hide_run'>726</p>
+<p class='stm run hide_run'>727</p>
<p class='stm mis'>728</p>
<p class='pln'>729</p>
</td>
<td class='text' valign='top'>
-<p class='pln'><span class='str'>""" path.py - An object representing a path to a file or directory.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'>Example:</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'>from path import path</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>d = path('/home/guido/bin')</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>for f in d.files('*.py'):</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> f.chmod(0755)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'>This module requires Python 2.2 or later.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'>URL: http://www.jorendorff.com/articles/python/path</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>Author: Jason Orendorff <jason@jorendorff.com> (and others - see the url!)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>Date: 29 Feb 2004</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>"""</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='com'># TODO</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># - Bug in write_text(). It doesn't support Universal newline mode.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># - Better error message in listdir() when self isn't a</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># directory. (On Windows, the error message really sucks.)</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># - Make sure everything has a good docstring.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># - Add methods for regex find and replace.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># - guess_content_type() method?</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># - Perhaps support arguments to touch().</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># - Could add split() and join() methods that generate warnings.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># - Note: __add__() technically has a bug, I think, where</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># it doesn't play nice with other types that implement</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># __radd__(). Test this.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>from</span> <span class='nam'>__future__</span> <span class='key'>import</span> <span class='nam'>generators</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>import</span> <span class='nam'>sys</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>,</span> <span class='nam'>fnmatch</span><span class='op'>,</span> <span class='nam'>glob</span><span class='op'>,</span> <span class='nam'>shutil</span><span class='op'>,</span> <span class='nam'>codecs</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='nam'>__version__</span> <span class='op'>=</span> <span class='str'>'2.0.2'</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='nam'>__all__</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'path'</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Pre-2.3 support. Are unicode filenames supported?</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='nam'>_base</span> <span class='op'>=</span> <span class='nam'>str</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>supports_unicode_filenames</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>_base</span> <span class='op'>=</span> <span class='nam'>unicode</span><span class="strut"> </span></p>
-<p class='stm mis'><span class='key'>except</span> <span class='nam'>AttributeError</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>pass</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Pre-2.3 workaround for basestring.</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>basestring</span><span class="strut"> </span></p>
-<p class='stm mis'><span class='key'>except</span> <span class='nam'>NameError</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>basestring</span> <span class='op'>=</span> <span class='op'>(</span><span class='nam'>str</span><span class='op'>,</span> <span class='nam'>unicode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Universal newline support</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='nam'>_textmode</span> <span class='op'>=</span> <span class='str'>'r'</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>file</span><span class='op'>,</span> <span class='str'>'newlines'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>_textmode</span> <span class='op'>=</span> <span class='str'>'U'</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Represents a filesystem path.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> For documentation on individual methods, consult their</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> counterparts in os.path.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># --- Special Python methods.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>__repr__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='str'>'path(%s)'</span> <span class='op'>%</span> <span class='nam'>_base</span><span class='op'>.</span><span class='nam'>__repr__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Adding a path and a string yields a path.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>__add__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>more</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span> <span class='op'>+</span> <span class='nam'>more</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>__radd__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>other</span> <span class='op'>+</span> <span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># The / operator joins paths.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>__div__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>rel</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" fp.__div__(rel) == fp / rel == fp.joinpath(rel)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Join two path components, adding a separator character if</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> needed.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>rel</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Make the / operator work even when true division is enabled.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>__truediv__</span> <span class='op'>=</span> <span class='nam'>__div__</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Return the current working directory as a path object. """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>getcwd</span> <span class='op'>=</span> <span class='nam'>staticmethod</span><span class='op'>(</span><span class='nam'>getcwd</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># --- Operations on path strings.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>abspath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>normpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>realpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>realpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>expanduser</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>expanduser</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>expandvars</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>expandvars</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>dirname</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>dirname</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>basename</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>basename</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>expand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Clean up a filename by calling expandvars(),</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> expanduser(), and normpath() on it.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is commonly everything needed to clean up a filename</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> read from a configuration file, for example.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>expandvars</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>expanduser</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>normpath</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>_get_namebase</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>base</span><span class='op'>,</span> <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>name</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>base</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>_get_ext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>,</span> <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>ext</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>_get_drive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>drive</span><span class='op'>,</span> <span class='nam'>r</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitdrive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>drive</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>parent</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>dirname</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" This path's parent directory, as a new path object.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> For example, path('/usr/local/lib/libpython.so').parent == path('/usr/local/lib')</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>name</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>basename</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" The name of this file or directory without the full path.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> For example, path('/usr/local/lib/libpython.so').name == 'libpython.so'</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>namebase</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>_get_namebase</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" The same as path.name, but with one file extension stripped off.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> For example, path('/home/guido/python.tar.gz').name == 'python.tar.gz',</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> but path('/home/guido/python.tar.gz').namebase == 'python.tar'</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>_get_ext</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" The file extension, for example '.py'. """</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>drive</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>_get_drive</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" The drive specifier, for example 'C:'.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is always empty on systems that don't use drive specifiers.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>splitpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" p.splitpath() -> Return (p.parent, p.name). """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>parent</span><span class='op'>,</span> <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>parent</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>child</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>splitdrive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" p.splitdrive() -> Return (p.drive, <the rest of p>).</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Split the drive specifier from this path. If there is</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> no drive specifier, p.drive is empty, so the return value</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> is simply (path(''), p). This is always the case on Unix.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>drive</span><span class='op'>,</span> <span class='nam'>rel</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitdrive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>drive</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>rel</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" p.splitext() -> Return (p.stripext(), p.ext).</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Split the filename extension from this path and return</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> the two parts. Either part may be empty.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> The extension is everything from '.' to the end of the</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> last path segment. This has the property that if</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> (a, b) == p.splitext(), then a + b == p.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Cast to plain string using _base because Python 2.2</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># implementations of os.path.splitext use "for c in path:..."</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># which means something different when applied to a path</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># object.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>filename</span><span class='op'>,</span> <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>filename</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>ext</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>stripext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" p.stripext() -> Remove one file extension from the path.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> For example, path('/home/guido/python.tar.gz').stripext()</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> returns path('/home/guido/python.tar').</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='op'>)</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>,</span> <span class='str'>'splitunc'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>splitunc</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>unc</span><span class='op'>,</span> <span class='nam'>rest</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitunc</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>unc</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>rest</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>_get_uncshare</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>unc</span><span class='op'>,</span> <span class='nam'>r</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitunc</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>unc</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>uncshare</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>_get_uncshare</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" The UNC mount point for this path.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is empty for paths on local drives. """</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>joinpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Join two or more path components, adding a separator</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> character (os.sep) if needed. Returns a new path</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> object.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>splitall</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Return a list of the path components in this path.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> The first item in the list will be a path. Its value will be</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> either os.curdir, os.pardir, empty, or the root directory of</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> this path (for example, '/' or 'C:\\'). The other items in</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> the list will be strings.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> path.path.joinpath(*result) will yield the original path.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>parts</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>loc</span> <span class='op'>=</span> <span class='nam'>self</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>while</span> <span class='nam'>loc</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>curdir</span> <span class='key'>and</span> <span class='nam'>loc</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>pardir</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>prev</span> <span class='op'>=</span> <span class='nam'>loc</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>loc</span><span class='op'>,</span> <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>prev</span><span class='op'>.</span><span class='nam'>splitpath</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>loc</span> <span class='op'>==</span> <span class='nam'>prev</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>break</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>parts</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>child</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>parts</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>loc</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>parts</span><span class='op'>.</span><span class='nam'>reverse</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>parts</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>relpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Return this path as a relative path,</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> based from the current working directory.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>cwd</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>cwd</span><span class='op'>.</span><span class='nam'>relpathto</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>relpathto</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Return a relative path from self to dest.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> If there is no relative path from self to dest, for example if</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> they reside on different drives in Windows, then this returns</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> dest.abspath().</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>origin</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>dest</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>dest</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>orig_list</span> <span class='op'>=</span> <span class='nam'>origin</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>splitall</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Don't normcase dest! We want to preserve the case.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>dest_list</span> <span class='op'>=</span> <span class='nam'>dest</span><span class='op'>.</span><span class='nam'>splitall</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>orig_list</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>dest_list</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Can't get here from there.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>dest</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Find the location where the two paths start to differ.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>i</span> <span class='op'>=</span> <span class='num'>0</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>start_seg</span><span class='op'>,</span> <span class='nam'>dest_seg</span> <span class='key'>in</span> <span class='nam'>zip</span><span class='op'>(</span><span class='nam'>orig_list</span><span class='op'>,</span> <span class='nam'>dest_list</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>start_seg</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>dest_seg</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>break</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>i</span> <span class='op'>+=</span> <span class='num'>1</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Now i is the point where the two paths diverge.</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Need a certain number of "os.pardir"s to work up</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># from the origin to the point of divergence.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>segments</span> <span class='op'>=</span> <span class='op'>[</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>pardir</span><span class='op'>]</span> <span class='op'>*</span> <span class='op'>(</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>orig_list</span><span class='op'>)</span> <span class='op'>-</span> <span class='nam'>i</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Need to add the diverging part of dest_list.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>segments</span> <span class='op'>+=</span> <span class='nam'>dest_list</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>:</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>segments</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># If they happen to be identical, use os.curdir.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>curdir</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='op'>*</span><span class='nam'>segments</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># --- Listing, searching, walking, and matching</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" D.listdir() -> List of items in this directory.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Use D.files() or D.dirs() instead if you want a listing</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> of just files or just subdirectories.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> The elements of the list are path objects.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> With the optional 'pattern' argument, this only lists</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> items whose names match the given pattern.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>names</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='key'>not</span> <span class='nam'>None</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>names</span> <span class='op'>=</span> <span class='nam'>fnmatch</span><span class='op'>.</span><span class='nam'>filter</span><span class='op'>(</span><span class='nam'>names</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='op'>[</span><span class='nam'>self</span> <span class='op'>/</span> <span class='nam'>child</span> <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>names</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>dirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" D.dirs() -> List of this directory's subdirectories.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> The elements of the list are path objects.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This does not walk recursively into subdirectories</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> (but see path.walkdirs).</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> With the optional 'pattern' argument, this only lists</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> directories whose names match the given pattern. For</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> example, d.dirs('build-*').</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='op'>[</span><span class='nam'>p</span> <span class='key'>for</span> <span class='nam'>p</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span> <span class='key'>if</span> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>isdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>files</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" D.files() -> List of the files in this directory.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> The elements of the list are path objects.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This does not walk into subdirectories (see path.walkfiles).</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> With the optional 'pattern' argument, this only lists files</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> whose names match the given pattern. For example,</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> d.files('*.pyc').</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='op'>[</span><span class='nam'>p</span> <span class='key'>for</span> <span class='nam'>p</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span> <span class='key'>if</span> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>isfile</span><span class='op'>(</span><span class='op'>)</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>walk</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" D.walk() -> iterator over files and subdirs, recursively.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> The iterator yields path objects naming each child item of</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> this directory and its descendants. This requires that</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> D.isdir().</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This performs a depth-first traversal of the directory tree.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Each directory is returned just before all its children.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>or</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>child</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>isdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>item</span> <span class='key'>in</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>walk</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>item</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>walkdirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" D.walkdirs() -> iterator over subdirs, recursively.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> With the optional 'pattern' argument, this yields only</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> directories whose names match the given pattern. For</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> example, mydir.walkdirs('*test') yields only directories</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> with names ending in 'test'.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>dirs</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>or</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>child</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>subsubdir</span> <span class='key'>in</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>walkdirs</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>subsubdir</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>walkfiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" D.walkfiles() -> iterator over files in D, recursively.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> The optional argument, pattern, limits the results to files</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> with names that match the pattern. For example,</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> mydir.walkfiles('*.tmp') yields only files with the .tmp</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> extension.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>isfile</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>or</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>child</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>isdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>f</span> <span class='key'>in</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>walkfiles</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>f</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Return True if self.name matches the given pattern.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> pattern - A filename pattern with wildcards,</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for example '*.py'.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>fnmatch</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>name</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>glob</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Return a list of path objects that match the pattern.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> pattern - a path relative to this directory, with wildcards.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> For example, path('/users').glob('*/bin/*') returns a list</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> of all the files users have in their bin directories.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>map</span><span class='op'>(</span><span class='nam'>path</span><span class='op'>,</span> <span class='nam'>glob</span><span class='op'>.</span><span class='nam'>glob</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span> <span class='op'>/</span> <span class='nam'>pattern</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># --- Reading or writing an entire file at once.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>=</span><span class='str'>'r'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Open this file. Return a file object. """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>file</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>bytes</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Open this file, read all bytes, return them as a string. """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='str'>'rb'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>write_bytes</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>bytes</span><span class='op'>,</span> <span class='nam'>append</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Open this file and write the given bytes to it.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Default behavior is to overwrite any existing file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Call this with write_bytes(bytes, append=True) to append instead.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>append</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'ab'</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'wb'</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>mode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>bytes</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>text</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>'strict'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Open this file, read it in, return the content as a string.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This uses 'U' mode in Python 2.3 and later, so '\r\n' and '\r'</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> are automatically translated to '\n'.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Optional arguments:</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> encoding - The Unicode encoding (or character set) of</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> the file. If present, the content of the file is</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> decoded and returned as a unicode object; otherwise</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> it is returned as an 8-bit str.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> errors - How to handle Unicode errors; see help(str.decode)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for the options. Default is 'strict'.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># 8-bit</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>_textmode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Unicode</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>codecs</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='str'>'r'</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># (Note - Can't use 'U' mode here, since codecs.open</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># doesn't support 'U' mode, even in Python 2.3.)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>t</span> <span class='op'>=</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>t</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>u'\r\n'</span><span class='op'>,</span> <span class='str'>u'\n'</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>u'\r'</span><span class='op'>,</span> <span class='str'>u'\n'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>write_text</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>text</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>'strict'</span><span class='op'>,</span> <span class='nam'>append</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Write the given text to this file.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> The default behavior is to overwrite any existing file;</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> to append instead, use the 'append=True' keyword argument.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> There are two differences between path.write_text() and</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> path.write_bytes(): Unicode handling and newline handling.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --- Unicode</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> If 'text' isn't Unicode, this essentially just does</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> open(self, 'w').write(text). The 'encoding' and 'errors'</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> arguments are ignored.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> If 'text' is Unicode, it is first converted to bytes using the</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> specified 'encoding' (or the default encoding if 'encoding'</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> isn't specified). The 'errors' argument applies only to this</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> conversion.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --- Newlines</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> write_text() converts from programmer-friendly newlines</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> (always '\n') to platform-specific newlines (see os.linesep;</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> on Windows, for example, the end-of-line marker is '\r\n').</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This applies to Unicode text the same as to 8-bit text.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Because of this conversion, the text should only contain plain</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> newlines ('\n'), just like the return value of path.text().</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> If the text contains the characters '\r\n', it may be written</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> as '\r\r\n' or '\r\r' depending on your platform. (This is</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> exactly the same as when you open a file for writing with</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> fopen(filename, "w") in C or file(filename, 'w') in Python.)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>text</span><span class='op'>,</span> <span class='nam'>unicode</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>text</span> <span class='op'>=</span> <span class='nam'>text</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>u'\n'</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>encoding</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>getdefaultencoding</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>bytes</span> <span class='op'>=</span> <span class='nam'>text</span><span class='op'>.</span><span class='nam'>encode</span><span class='op'>(</span><span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>write_bytes</span><span class='op'>(</span><span class='nam'>bytes</span><span class='op'>,</span> <span class='nam'>append</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>append</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'a'</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'w'</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>mode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>text</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>lines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>'strict'</span><span class='op'>,</span> <span class='nam'>retain</span><span class='op'>=</span><span class='nam'>True</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Open this file, read all lines, return them in a list.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Optional arguments:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> encoding - The Unicode encoding (or character set) of</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> the file. The default is None, meaning the content</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> of the file is read as 8-bit characters and returned</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> as a list of (non-Unicode) str objects.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> errors - How to handle Unicode errors; see help(str.decode)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for the options. Default is 'strict'</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> retain - If true, retain newline characters; but all newline</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> character combinations ('\r', '\n', '\r\n') are</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> translated to '\n'. If false, newline characters are</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> stripped off. Default is True.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This uses 'U' mode in Python 2.3 and later.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>and</span> <span class='nam'>retain</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>_textmode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>readlines</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>text</span><span class='op'>(</span><span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>splitlines</span><span class='op'>(</span><span class='nam'>retain</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>write_lines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>lines</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>'strict'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>linesep</span><span class='op'>=</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Overwrite this file with the given lines of text.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> lines - A list of strings.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> encoding - A Unicode encoding to use. This applies only if</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> 'lines' contains any Unicode strings.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> errors - How to handle errors in Unicode encoding. This</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> also applies only to Unicode strings.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> linesep - A character sequence that will be added at the</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> end of every line that doesn't already have it.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='str'>'wb'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>line</span> <span class='key'>in</span> <span class='nam'>lines</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>line</span><span class='op'>.</span><span class='nam'>endswith</span><span class='op'>(</span><span class='nam'>linesep</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>line</span> <span class='op'>+=</span> <span class='nam'>linesep</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>line</span><span class='op'>,</span> <span class='nam'>unicode</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>encoding</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>getdefaultencoding</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>line</span> <span class='op'>=</span> <span class='nam'>line</span><span class='op'>.</span><span class='nam'>encode</span><span class='op'>(</span><span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='nam'>errors</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>line</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># --- Methods for querying the filesystem.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>exists</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>exists</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>isabs</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>isabs</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>isdir</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>isdir</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>isfile</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>isfile</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>islink</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>islink</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>ismount</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>ismount</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>,</span> <span class='str'>'samefile'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>samefile</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>samefile</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>getatime</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getatime</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>atime</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>getatime</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Last access time of the file. """</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>getmtime</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getmtime</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>mtime</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>getmtime</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Last-modified time of the file. """</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>,</span> <span class='str'>'getctime'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>getctime</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getctime</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>ctime</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>getctime</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Creation time of the file. """</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>getsize</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getsize</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>size</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>getsize</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Size of the file, in bytes. """</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'access'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Return true if current user has access to this path.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> mode - One of the constants os.F_OK, os.R_OK, os.W_OK, os.X_OK</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>stat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Perform a stat() system call on this path. """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>stat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>lstat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Like path.stat(), but do not follow symbolic links. """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>lstat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'statvfs'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>def</span> <span class='nam'>statvfs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Perform a statvfs() system call on this path. """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>statvfs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'pathconf'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>def</span> <span class='nam'>pathconf</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>name</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>pathconf</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>name</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># --- Modifying operations on files and directories</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>utime</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>times</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Set the access and modified times of this file. """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>utime</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>times</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'chown'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>def</span> <span class='nam'>chown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>uid</span><span class='op'>,</span> <span class='nam'>gid</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>uid</span><span class='op'>,</span> <span class='nam'>gid</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>rename</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>rename</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>renames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>renames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># --- Create/delete operations on directories</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>mkdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>=</span><span class='num'>0777</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>mkdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>makedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>=</span><span class='num'>0777</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>makedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>rmdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>rmdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>removedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>removedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># --- Modifying operations on files</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>touch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Set the access/modified times of this file to the current time.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Create the file if it does not exist.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>fd</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>O_WRONLY</span> <span class='op'>|</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>O_CREAT</span><span class='op'>,</span> <span class='num'>0666</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='nam'>fd</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>utime</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>remove</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>remove</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>unlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>unlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># --- Links</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'link'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>def</span> <span class='nam'>link</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newpath</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Create a hard link at 'newpath', pointing to this file. """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>link</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newpath</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'symlink'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>def</span> <span class='nam'>symlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newlink</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Create a symbolic link at 'newlink', pointing here. """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>symlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newlink</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'readlink'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>def</span> <span class='nam'>readlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Return the path to which this symbolic link points.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> The result may be an absolute or a relative path.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>readlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>def</span> <span class='nam'>readlinkabs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Return the path to which this symbolic link points.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> The result is always an absolute path.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>readlink</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>isabs</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>p</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>parent</span> <span class='op'>/</span> <span class='nam'>p</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># --- High-level functions from shutil</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>copyfile</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copyfile</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>copymode</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copymode</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>copystat</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copystat</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>copy</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copy</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>copy2</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copy2</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>copytree</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copytree</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>shutil</span><span class='op'>,</span> <span class='str'>'move'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>move</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>move</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>rmtree</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>rmtree</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># --- Special stuff from os</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'chroot'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>def</span> <span class='nam'>chroot</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chroot</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'startfile'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>startfile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>startfile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
+<p class='pln'><span class='str'>""" path.py - An object representing a path to a file or directory.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'>Example:</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'>from path import path</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>d = path('/home/guido/bin')</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>for f in d.files('*.py'):</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> f.chmod(0755)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'>This module requires Python 2.2 or later.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'>URL: http://www.jorendorff.com/articles/python/path</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>Author: Jason Orendorff <jason@jorendorff.com> (and others - see the url!)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>Date: 29 Feb 2004</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>"""</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='com'># TODO</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># - Bug in write_text(). It doesn't support Universal newline mode.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># - Better error message in listdir() when self isn't a</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># directory. (On Windows, the error message really sucks.)</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># - Make sure everything has a good docstring.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># - Add methods for regex find and replace.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># - guess_content_type() method?</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># - Perhaps support arguments to touch().</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># - Could add split() and join() methods that generate warnings.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># - Note: __add__() technically has a bug, I think, where</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># it doesn't play nice with other types that implement</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># __radd__(). Test this.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>from</span> <span class='nam'>__future__</span> <span class='key'>import</span> <span class='nam'>generators</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>sys</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>,</span> <span class='nam'>fnmatch</span><span class='op'>,</span> <span class='nam'>glob</span><span class='op'>,</span> <span class='nam'>shutil</span><span class='op'>,</span> <span class='nam'>codecs</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='nam'>__version__</span> <span class='op'>=</span> <span class='str'>'2.0.2'</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='nam'>__all__</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'path'</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Pre-2.3 support. Are unicode filenames supported?</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='nam'>_base</span> <span class='op'>=</span> <span class='nam'>str</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>48</span> <span class='key'>if</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>supports_unicode_filenames</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>_base</span> <span class='op'>=</span> <span class='nam'>unicode</span><span class='strut'> </span></p>
+<p class='stm mis'><span class='key'>except</span> <span class='nam'>AttributeError</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>pass</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Pre-2.3 workaround for basestring.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>basestring</span><span class='strut'> </span></p>
+<p class='stm mis'><span class='key'>except</span> <span class='nam'>NameError</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>basestring</span> <span class='op'>=</span> <span class='op'>(</span><span class='nam'>str</span><span class='op'>,</span> <span class='nam'>unicode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Universal newline support</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='nam'>_textmode</span> <span class='op'>=</span> <span class='str'>'r'</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>59</span><span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>file</span><span class='op'>,</span> <span class='str'>'newlines'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>_textmode</span> <span class='op'>=</span> <span class='str'>'U'</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Represents a filesystem path.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> For documentation on individual methods, consult their</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> counterparts in os.path.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># --- Special Python methods.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>__repr__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='str'>'path(%s)'</span> <span class='op'>%</span> <span class='nam'>_base</span><span class='op'>.</span><span class='nam'>__repr__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Adding a path and a string yields a path.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>__add__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>more</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span> <span class='op'>+</span> <span class='nam'>more</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>__radd__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>other</span> <span class='op'>+</span> <span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># The / operator joins paths.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>__div__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>rel</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" fp.__div__(rel) == fp / rel == fp.joinpath(rel)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Join two path components, adding a separator character if</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> needed.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>rel</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Make the / operator work even when true division is enabled.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>__truediv__</span> <span class='op'>=</span> <span class='nam'>__div__</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Return the current working directory as a path object. """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>getcwd</span> <span class='op'>=</span> <span class='nam'>staticmethod</span><span class='op'>(</span><span class='nam'>getcwd</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># --- Operations on path strings.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>exit</span> <span class='key'>def</span> <span class='nam'>abspath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>exit</span> <span class='key'>def</span> <span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>exit</span> <span class='key'>def</span> <span class='nam'>normpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>exit</span> <span class='key'>def</span> <span class='nam'>realpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>realpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>exit</span> <span class='key'>def</span> <span class='nam'>expanduser</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>expanduser</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>exit</span> <span class='key'>def</span> <span class='nam'>expandvars</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>expandvars</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>exit</span> <span class='key'>def</span> <span class='nam'>dirname</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>dirname</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>basename</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>basename</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>expand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Clean up a filename by calling expandvars(),</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> expanduser(), and normpath() on it.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is commonly everything needed to clean up a filename</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> read from a configuration file, for example.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>expandvars</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>expanduser</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>normpath</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>_get_namebase</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>base</span><span class='op'>,</span> <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>name</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>base</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>_get_ext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>,</span> <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>ext</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>_get_drive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>drive</span><span class='op'>,</span> <span class='nam'>r</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitdrive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>drive</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>parent</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>dirname</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" This path's parent directory, as a new path object.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> For example, path('/usr/local/lib/libpython.so').parent == path('/usr/local/lib')</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>name</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>basename</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" The name of this file or directory without the full path.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> For example, path('/usr/local/lib/libpython.so').name == 'libpython.so'</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>namebase</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>_get_namebase</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" The same as path.name, but with one file extension stripped off.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> For example, path('/home/guido/python.tar.gz').name == 'python.tar.gz',</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> but path('/home/guido/python.tar.gz').namebase == 'python.tar'</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>_get_ext</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" The file extension, for example '.py'. """</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>drive</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>_get_drive</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" The drive specifier, for example 'C:'.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is always empty on systems that don't use drive specifiers.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>splitpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" p.splitpath() -> Return (p.parent, p.name). """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>parent</span><span class='op'>,</span> <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>parent</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>child</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>splitdrive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" p.splitdrive() -> Return (p.drive, <the rest of p>).</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Split the drive specifier from this path. If there is</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> no drive specifier, p.drive is empty, so the return value</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> is simply (path(''), p). This is always the case on Unix.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>drive</span><span class='op'>,</span> <span class='nam'>rel</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitdrive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>drive</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>rel</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" p.splitext() -> Return (p.stripext(), p.ext).</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Split the filename extension from this path and return</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> the two parts. Either part may be empty.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> The extension is everything from '.' to the end of the</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> last path segment. This has the property that if</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> (a, b) == p.splitext(), then a + b == p.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Cast to plain string using _base because Python 2.2</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># implementations of os.path.splitext use "for c in path:..."</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># which means something different when applied to a path</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># object.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>filename</span><span class='op'>,</span> <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>filename</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>ext</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>stripext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" p.stripext() -> Remove one file extension from the path.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> For example, path('/home/guido/python.tar.gz').stripext()</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> returns path('/home/guido/python.tar').</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='op'>)</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>214</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>,</span> <span class='str'>'splitunc'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>splitunc</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>unc</span><span class='op'>,</span> <span class='nam'>rest</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitunc</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>unc</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>rest</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>_get_uncshare</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>unc</span><span class='op'>,</span> <span class='nam'>r</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitunc</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>unc</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>uncshare</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>_get_uncshare</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" The UNC mount point for this path.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is empty for paths on local drives. """</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>joinpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Join two or more path components, adding a separator</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> character (os.sep) if needed. Returns a new path</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> object.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>splitall</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Return a list of the path components in this path.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> The first item in the list will be a path. Its value will be</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> either os.curdir, os.pardir, empty, or the root directory of</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> this path (for example, '/' or 'C:\\'). The other items in</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> the list will be strings.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> path.path.joinpath(*result) will yield the original path.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>parts</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>loc</span> <span class='op'>=</span> <span class='nam'>self</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>while</span> <span class='nam'>loc</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>curdir</span> <span class='key'>and</span> <span class='nam'>loc</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>pardir</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>prev</span> <span class='op'>=</span> <span class='nam'>loc</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>loc</span><span class='op'>,</span> <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>prev</span><span class='op'>.</span><span class='nam'>splitpath</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>loc</span> <span class='op'>==</span> <span class='nam'>prev</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>break</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>parts</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>child</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>parts</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>loc</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>parts</span><span class='op'>.</span><span class='nam'>reverse</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>parts</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>relpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Return this path as a relative path,</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> based from the current working directory.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>cwd</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>cwd</span><span class='op'>.</span><span class='nam'>relpathto</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>relpathto</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Return a relative path from self to dest.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> If there is no relative path from self to dest, for example if</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> they reside on different drives in Windows, then this returns</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> dest.abspath().</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>origin</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>dest</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>dest</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>orig_list</span> <span class='op'>=</span> <span class='nam'>origin</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>splitall</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Don't normcase dest! We want to preserve the case.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>dest_list</span> <span class='op'>=</span> <span class='nam'>dest</span><span class='op'>.</span><span class='nam'>splitall</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>orig_list</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>dest_list</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Can't get here from there.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>dest</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Find the location where the two paths start to differ.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>i</span> <span class='op'>=</span> <span class='num'>0</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>start_seg</span><span class='op'>,</span> <span class='nam'>dest_seg</span> <span class='key'>in</span> <span class='nam'>zip</span><span class='op'>(</span><span class='nam'>orig_list</span><span class='op'>,</span> <span class='nam'>dest_list</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>start_seg</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>dest_seg</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>break</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>i</span> <span class='op'>+=</span> <span class='num'>1</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Now i is the point where the two paths diverge.</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Need a certain number of "os.pardir"s to work up</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># from the origin to the point of divergence.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>segments</span> <span class='op'>=</span> <span class='op'>[</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>pardir</span><span class='op'>]</span> <span class='op'>*</span> <span class='op'>(</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>orig_list</span><span class='op'>)</span> <span class='op'>-</span> <span class='nam'>i</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Need to add the diverging part of dest_list.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>segments</span> <span class='op'>+=</span> <span class='nam'>dest_list</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>:</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>segments</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># If they happen to be identical, use os.curdir.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>curdir</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='op'>*</span><span class='nam'>segments</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># --- Listing, searching, walking, and matching</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" D.listdir() -> List of items in this directory.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Use D.files() or D.dirs() instead if you want a listing</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> of just files or just subdirectories.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> The elements of the list are path objects.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> With the optional 'pattern' argument, this only lists</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> items whose names match the given pattern.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>names</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='key'>not</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>names</span> <span class='op'>=</span> <span class='nam'>fnmatch</span><span class='op'>.</span><span class='nam'>filter</span><span class='op'>(</span><span class='nam'>names</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='op'>[</span><span class='nam'>self</span> <span class='op'>/</span> <span class='nam'>child</span> <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>names</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>dirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" D.dirs() -> List of this directory's subdirectories.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> The elements of the list are path objects.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This does not walk recursively into subdirectories</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> (but see path.walkdirs).</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> With the optional 'pattern' argument, this only lists</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> directories whose names match the given pattern. For</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> example, d.dirs('build-*').</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='op'>[</span><span class='nam'>p</span> <span class='key'>for</span> <span class='nam'>p</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span> <span class='key'>if</span> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>isdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>files</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" D.files() -> List of the files in this directory.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> The elements of the list are path objects.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This does not walk into subdirectories (see path.walkfiles).</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> With the optional 'pattern' argument, this only lists files</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> whose names match the given pattern. For example,</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> d.files('*.pyc').</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='op'>[</span><span class='nam'>p</span> <span class='key'>for</span> <span class='nam'>p</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span> <span class='key'>if</span> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>isfile</span><span class='op'>(</span><span class='op'>)</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>walk</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" D.walk() -> iterator over files and subdirs, recursively.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> The iterator yields path objects naming each child item of</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> this directory and its descendants. This requires that</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> D.isdir().</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This performs a depth-first traversal of the directory tree.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Each directory is returned just before all its children.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>or</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>child</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>isdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>item</span> <span class='key'>in</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>walk</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>item</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>walkdirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" D.walkdirs() -> iterator over subdirs, recursively.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> With the optional 'pattern' argument, this yields only</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> directories whose names match the given pattern. For</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> example, mydir.walkdirs('*test') yields only directories</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> with names ending in 'test'.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>dirs</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>or</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>child</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>subsubdir</span> <span class='key'>in</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>walkdirs</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>subsubdir</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>walkfiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" D.walkfiles() -> iterator over files in D, recursively.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> The optional argument, pattern, limits the results to files</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> with names that match the pattern. For example,</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> mydir.walkfiles('*.tmp') yields only files with the .tmp</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> extension.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>isfile</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>or</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>child</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>isdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>f</span> <span class='key'>in</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>walkfiles</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>yield</span> <span class='nam'>f</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Return True if self.name matches the given pattern.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> pattern - A filename pattern with wildcards,</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for example '*.py'.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>fnmatch</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>name</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>glob</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Return a list of path objects that match the pattern.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> pattern - a path relative to this directory, with wildcards.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> For example, path('/users').glob('*/bin/*') returns a list</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> of all the files users have in their bin directories.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>map</span><span class='op'>(</span><span class='nam'>path</span><span class='op'>,</span> <span class='nam'>glob</span><span class='op'>.</span><span class='nam'>glob</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span> <span class='op'>/</span> <span class='nam'>pattern</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># --- Reading or writing an entire file at once.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>=</span><span class='str'>'r'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Open this file. Return a file object. """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>file</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>bytes</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Open this file, read all bytes, return them as a string. """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='str'>'rb'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>write_bytes</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>bytes</span><span class='op'>,</span> <span class='nam'>append</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Open this file and write the given bytes to it.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Default behavior is to overwrite any existing file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Call this with write_bytes(bytes, append=True) to append instead.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>append</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'ab'</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'wb'</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>mode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>bytes</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>text</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>'strict'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Open this file, read it in, return the content as a string.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This uses 'U' mode in Python 2.3 and later, so '\r\n' and '\r'</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> are automatically translated to '\n'.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Optional arguments:</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> encoding - The Unicode encoding (or character set) of</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> the file. If present, the content of the file is</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> decoded and returned as a unicode object; otherwise</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> it is returned as an 8-bit str.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> errors - How to handle Unicode errors; see help(str.decode)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for the options. Default is 'strict'.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># 8-bit</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>_textmode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Unicode</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>codecs</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='str'>'r'</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># (Note - Can't use 'U' mode here, since codecs.open</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># doesn't support 'U' mode, even in Python 2.3.)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>t</span> <span class='op'>=</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>t</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>u'\r\n'</span><span class='op'>,</span> <span class='str'>u'\n'</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>u'\r'</span><span class='op'>,</span> <span class='str'>u'\n'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>write_text</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>text</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>'strict'</span><span class='op'>,</span> <span class='nam'>append</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Write the given text to this file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> The default behavior is to overwrite any existing file;</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> to append instead, use the 'append=True' keyword argument.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> There are two differences between path.write_text() and</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> path.write_bytes(): Unicode handling and newline handling.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --- Unicode</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> If 'text' isn't Unicode, this essentially just does</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> open(self, 'w').write(text). The 'encoding' and 'errors'</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> arguments are ignored.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> If 'text' is Unicode, it is first converted to bytes using the</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> specified 'encoding' (or the default encoding if 'encoding'</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> isn't specified). The 'errors' argument applies only to this</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> conversion.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --- Newlines</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> write_text() converts from programmer-friendly newlines</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> (always '\n') to platform-specific newlines (see os.linesep;</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> on Windows, for example, the end-of-line marker is '\r\n').</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This applies to Unicode text the same as to 8-bit text.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Because of this conversion, the text should only contain plain</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> newlines ('\n'), just like the return value of path.text().</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> If the text contains the characters '\r\n', it may be written</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> as '\r\r\n' or '\r\r' depending on your platform. (This is</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> exactly the same as when you open a file for writing with</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> fopen(filename, "w") in C or file(filename, 'w') in Python.)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>text</span><span class='op'>,</span> <span class='nam'>unicode</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>text</span> <span class='op'>=</span> <span class='nam'>text</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>u'\n'</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>encoding</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>getdefaultencoding</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>bytes</span> <span class='op'>=</span> <span class='nam'>text</span><span class='op'>.</span><span class='nam'>encode</span><span class='op'>(</span><span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>write_bytes</span><span class='op'>(</span><span class='nam'>bytes</span><span class='op'>,</span> <span class='nam'>append</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>append</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'a'</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'w'</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>mode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>text</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>lines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>'strict'</span><span class='op'>,</span> <span class='nam'>retain</span><span class='op'>=</span><span class='nam'>True</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Open this file, read all lines, return them in a list.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Optional arguments:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> encoding - The Unicode encoding (or character set) of</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> the file. The default is None, meaning the content</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> of the file is read as 8-bit characters and returned</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> as a list of (non-Unicode) str objects.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> errors - How to handle Unicode errors; see help(str.decode)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for the options. Default is 'strict'</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> retain - If true, retain newline characters; but all newline</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> character combinations ('\r', '\n', '\r\n') are</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> translated to '\n'. If false, newline characters are</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> stripped off. Default is True.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This uses 'U' mode in Python 2.3 and later.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>and</span> <span class='nam'>retain</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>_textmode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>readlines</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>text</span><span class='op'>(</span><span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>splitlines</span><span class='op'>(</span><span class='nam'>retain</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>write_lines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>lines</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>'strict'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>linesep</span><span class='op'>=</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Overwrite this file with the given lines of text.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> lines - A list of strings.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> encoding - A Unicode encoding to use. This applies only if</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> 'lines' contains any Unicode strings.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> errors - How to handle errors in Unicode encoding. This</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> also applies only to Unicode strings.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> linesep - A character sequence that will be added at the</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> end of every line that doesn't already have it.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='str'>'wb'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>line</span> <span class='key'>in</span> <span class='nam'>lines</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>line</span><span class='op'>.</span><span class='nam'>endswith</span><span class='op'>(</span><span class='nam'>linesep</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>line</span> <span class='op'>+=</span> <span class='nam'>linesep</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>line</span><span class='op'>,</span> <span class='nam'>unicode</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>encoding</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>getdefaultencoding</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>line</span> <span class='op'>=</span> <span class='nam'>line</span><span class='op'>.</span><span class='nam'>encode</span><span class='op'>(</span><span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='nam'>errors</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>line</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># --- Methods for querying the filesystem.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>exists</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>exists</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>isabs</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>isabs</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>isdir</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>isdir</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>isfile</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>isfile</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>islink</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>islink</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>ismount</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>ismount</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>574</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>,</span> <span class='str'>'samefile'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>samefile</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>samefile</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>getatime</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getatime</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>atime</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>getatime</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Last access time of the file. """</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>getmtime</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getmtime</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>mtime</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>getmtime</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Last-modified time of the file. """</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>592</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>,</span> <span class='str'>'getctime'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>getctime</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getctime</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>ctime</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>getctime</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Creation time of the file. """</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>getsize</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getsize</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>size</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>getsize</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Size of the file, in bytes. """</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>605</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'access'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Return true if current user has access to this path.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> mode - One of the constants os.F_OK, os.R_OK, os.W_OK, os.X_OK</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>stat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Perform a stat() system call on this path. """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>stat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>lstat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Like path.stat(), but do not follow symbolic links. """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>lstat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>614</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'statvfs'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>def</span> <span class='nam'>statvfs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Perform a statvfs() system call on this path. """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>statvfs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>619</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'pathconf'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>def</span> <span class='nam'>pathconf</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>name</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>pathconf</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>name</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># --- Modifying operations on files and directories</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>utime</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>times</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Set the access and modified times of this file. """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>utime</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>times</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>633</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'chown'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>def</span> <span class='nam'>chown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>uid</span><span class='op'>,</span> <span class='nam'>gid</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>uid</span><span class='op'>,</span> <span class='nam'>gid</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>rename</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>rename</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>renames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>renames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># --- Create/delete operations on directories</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>mkdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>=</span><span class='num'>0777</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>mkdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>makedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>=</span><span class='num'>0777</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>makedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>rmdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>rmdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>removedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>removedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># --- Modifying operations on files</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>touch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Set the access/modified times of this file to the current time.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Create the file if it does not exist.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>fd</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>O_WRONLY</span> <span class='op'>|</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>O_CREAT</span><span class='op'>,</span> <span class='num'>0666</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='nam'>fd</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>utime</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>remove</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>remove</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>unlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>unlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># --- Links</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>678</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'link'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>def</span> <span class='nam'>link</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newpath</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Create a hard link at 'newpath', pointing to this file. """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>link</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newpath</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>683</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'symlink'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>def</span> <span class='nam'>symlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newlink</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Create a symbolic link at 'newlink', pointing here. """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>symlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newlink</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>688</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'readlink'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>def</span> <span class='nam'>readlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Return the path to which this symbolic link points.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> The result may be an absolute or a relative path.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>readlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>def</span> <span class='nam'>readlinkabs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Return the path to which this symbolic link points.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> The result is always an absolute path.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>readlink</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>isabs</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>p</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>parent</span> <span class='op'>/</span> <span class='nam'>p</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># --- High-level functions from shutil</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>copyfile</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copyfile</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>copymode</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copymode</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>copystat</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copystat</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>copy</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copy</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>copy2</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copy2</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>copytree</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copytree</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>717</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>shutil</span><span class='op'>,</span> <span class='str'>'move'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>move</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>move</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>rmtree</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>rmtree</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># --- Special stuff from os</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>723</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'chroot'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>def</span> <span class='nam'>chroot</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chroot</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>exit</span> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>'startfile'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>startfile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>startfile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
</td>
</tr>
diff --git a/doc/sample_html/cogapp_cogapp.html b/doc/sample_html/cogapp_cogapp.html index 555756f..df5b434 100644 --- a/doc/sample_html/cogapp_cogapp.html +++ b/doc/sample_html/cogapp_cogapp.html @@ -1,19 +1,21 @@ -<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
+<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Coverage for cogapp\cogapp</title>
<link rel='stylesheet' href='style.css' type='text/css'>
-<script src='jquery-1.3.2.min.js'></script>
-<script>
+<script type='text/javascript' src='jquery-1.3.2.min.js'></script>
+<script type='text/javascript'>
function toggle_lines(btn, cls) {
var btn = $(btn);
- if (btn.hasClass("hide")) {
- $("#source ."+cls).removeClass("hide");
- btn.removeClass("hide");
+ var hide = "hide_"+cls;
+ if (btn.hasClass(hide)) {
+ $("#source ."+cls).removeClass(hide);
+ btn.removeClass(hide);
}
else {
- $("#source ."+cls).addClass("hide");
- btn.addClass("hide");
+ $("#source ."+cls).addClass(hide);
+ btn.addClass(hide);
}
}
</script>
@@ -22,13 +24,16 @@ function toggle_lines(btn, cls) { <div id='header'>
<div class='content'>
<h1>Coverage for <b>cogapp\cogapp</b> :
- <span class='pc_cov'>57%</span>
+ <span class='pc_cov'>51%</span>
</h1>
<h2 class='stats'>
387 statements
- <span class='run hide' onclick='toggle_lines(this, "run")'>219 run</span>
+ <span class='run hide_run' onclick='toggle_lines(this, "run")'>219 run</span>
<span class='exc' onclick='toggle_lines(this, "exc")'>3 excluded</span>
<span class='mis' onclick='toggle_lines(this, "mis")'>168 missing</span>
+
+ <span class='par run hide_run' onclick='toggle_lines(this, "par")'>26 partial</span>
+
</h2>
</div>
</div>
@@ -43,22 +48,22 @@ function toggle_lines(btn, cls) { <p class='pln'>4</p>
<p class='pln'>5</p>
<p class='pln'>6</p>
-<p class='stm run hide'>7</p>
-<p class='stm run hide'>8</p>
+<p class='stm run hide_run'>7</p>
+<p class='stm run hide_run'>8</p>
<p class='pln'>9</p>
<p class='pln'>10</p>
-<p class='stm run hide'>11</p>
-<p class='stm run hide'>12</p>
-<p class='stm run hide'>13</p>
+<p class='stm run hide_run'>11</p>
+<p class='stm run hide_run'>12</p>
+<p class='stm run hide_run'>13</p>
<p class='stm mis'>14</p>
<p class='stm mis'>15</p>
<p class='stm mis'>16</p>
<p class='pln'>17</p>
-<p class='stm run hide'>18</p>
+<p class='stm run hide_run'>18</p>
<p class='pln'>19</p>
-<p class='stm run hide'>20</p>
+<p class='stm run hide_run'>20</p>
<p class='pln'>21</p>
-<p class='stm run hide'>22</p>
+<p class='stm run hide_run'>22</p>
<p class='pln'>23</p>
<p class='pln'>24</p>
<p class='pln'>25</p>
@@ -86,127 +91,127 @@ function toggle_lines(btn, cls) { <p class='pln'>47</p>
<p class='pln'>48</p>
<p class='pln'>49</p>
-<p class='stm run hide'>50</p>
+<p class='stm run hide_run'>50</p>
<p class='pln'>51</p>
-<p class='stm run hide'>52</p>
+<p class='stm run hide_run'>52</p>
<p class='pln'>53</p>
<p class='pln'>54</p>
-<p class='stm run hide'>55</p>
-<p class='stm run hide'>56</p>
-<p class='stm run hide'>57</p>
+<p class='stm run hide_run'>55</p>
+<p class='stm par run hide_run'>56</p>
+<p class='stm run hide_run'>57</p>
<p class='pln'>58</p>
<p class='stm mis'>59</p>
<p class='pln'>60</p>
-<p class='stm run hide'>61</p>
+<p class='stm run hide_run'>61</p>
<p class='pln'>62</p>
<p class='pln'>63</p>
<p class='exc'>64</p>
<p class='pln'>65</p>
-<p class='stm run hide'>66</p>
+<p class='stm run hide_run'>66</p>
<p class='pln'>67</p>
<p class='pln'>68</p>
<p class='exc'>69</p>
<p class='pln'>70</p>
-<p class='stm run hide'>71</p>
+<p class='stm run hide_run'>71</p>
<p class='pln'>72</p>
<p class='pln'>73</p>
<p class='exc'>74</p>
<p class='pln'>75</p>
-<p class='stm run hide'>76</p>
+<p class='stm run hide_run'>76</p>
<p class='pln'>77</p>
<p class='pln'>78</p>
-<p class='stm run hide'>79</p>
-<p class='stm run hide'>80</p>
-<p class='stm run hide'>81</p>
+<p class='stm run hide_run'>79</p>
+<p class='stm run hide_run'>80</p>
+<p class='stm run hide_run'>81</p>
<p class='pln'>82</p>
-<p class='stm run hide'>83</p>
+<p class='stm run hide_run'>83</p>
<p class='pln'>84</p>
<p class='pln'>85</p>
-<p class='stm run hide'>86</p>
-<p class='stm run hide'>87</p>
-<p class='stm run hide'>88</p>
+<p class='stm par run hide_run'>86</p>
+<p class='stm run hide_run'>87</p>
+<p class='stm par run hide_run'>88</p>
<p class='stm mis'>89</p>
<p class='pln'>90</p>
-<p class='stm run hide'>91</p>
+<p class='stm run hide_run'>91</p>
<p class='pln'>92</p>
<p class='pln'>93</p>
-<p class='stm run hide'>94</p>
-<p class='stm run hide'>95</p>
-<p class='stm run hide'>96</p>
-<p class='stm run hide'>97</p>
+<p class='stm run hide_run'>94</p>
+<p class='stm run hide_run'>95</p>
+<p class='stm run hide_run'>96</p>
+<p class='stm run hide_run'>97</p>
<p class='pln'>98</p>
-<p class='stm run hide'>99</p>
-<p class='stm run hide'>100</p>
+<p class='stm run hide_run'>99</p>
+<p class='stm run hide_run'>100</p>
<p class='pln'>101</p>
-<p class='stm run hide'>102</p>
-<p class='stm run hide'>103</p>
+<p class='stm run hide_run'>102</p>
+<p class='stm run hide_run'>103</p>
<p class='pln'>104</p>
-<p class='stm run hide'>105</p>
+<p class='stm run hide_run'>105</p>
<p class='pln'>106</p>
<p class='pln'>107</p>
<p class='pln'>108</p>
<p class='pln'>109</p>
<p class='pln'>110</p>
-<p class='stm run hide'>111</p>
-<p class='stm run hide'>112</p>
-<p class='stm run hide'>113</p>
-<p class='stm run hide'>114</p>
+<p class='stm run hide_run'>111</p>
+<p class='stm run hide_run'>112</p>
+<p class='stm run hide_run'>113</p>
+<p class='stm run hide_run'>114</p>
<p class='pln'>115</p>
-<p class='stm run hide'>116</p>
+<p class='stm run hide_run'>116</p>
<p class='pln'>117</p>
-<p class='stm run hide'>118</p>
+<p class='stm run hide_run'>118</p>
<p class='pln'>119</p>
-<p class='stm run hide'>120</p>
+<p class='stm run hide_run'>120</p>
<p class='pln'>121</p>
-<p class='stm run hide'>122</p>
-<p class='stm run hide'>123</p>
-<p class='stm run hide'>124</p>
+<p class='stm run hide_run'>122</p>
+<p class='stm run hide_run'>123</p>
+<p class='stm run hide_run'>124</p>
<p class='pln'>125</p>
<p class='pln'>126</p>
-<p class='stm run hide'>127</p>
-<p class='stm run hide'>128</p>
+<p class='stm run hide_run'>127</p>
+<p class='stm run hide_run'>128</p>
<p class='pln'>129</p>
<p class='pln'>130</p>
-<p class='stm run hide'>131</p>
-<p class='stm run hide'>132</p>
-<p class='stm run hide'>133</p>
-<p class='stm run hide'>134</p>
+<p class='stm run hide_run'>131</p>
+<p class='stm run hide_run'>132</p>
+<p class='stm run hide_run'>133</p>
+<p class='stm run hide_run'>134</p>
<p class='pln'>135</p>
-<p class='stm run hide'>136</p>
-<p class='stm run hide'>137</p>
+<p class='stm run hide_run'>136</p>
+<p class='stm run hide_run'>137</p>
<p class='pln'>138</p>
<p class='pln'>139</p>
<p class='pln'>140</p>
<p class='pln'>141</p>
-<p class='stm run hide'>142</p>
-<p class='stm run hide'>143</p>
+<p class='stm run hide_run'>142</p>
+<p class='stm run hide_run'>143</p>
<p class='pln'>144</p>
-<p class='stm run hide'>145</p>
+<p class='stm run hide_run'>145</p>
<p class='pln'>146</p>
-<p class='stm run hide'>147</p>
+<p class='stm run hide_run'>147</p>
<p class='stm mis'>148</p>
<p class='pln'>149</p>
-<p class='stm run hide'>150</p>
+<p class='stm run hide_run'>150</p>
<p class='pln'>151</p>
<p class='pln'>152</p>
-<p class='stm run hide'>153</p>
-<p class='stm run hide'>154</p>
-<p class='stm run hide'>155</p>
-<p class='stm run hide'>156</p>
-<p class='stm run hide'>157</p>
-<p class='stm run hide'>158</p>
-<p class='stm run hide'>159</p>
-<p class='stm run hide'>160</p>
-<p class='stm run hide'>161</p>
-<p class='stm run hide'>162</p>
+<p class='stm run hide_run'>153</p>
+<p class='stm run hide_run'>154</p>
+<p class='stm run hide_run'>155</p>
+<p class='stm run hide_run'>156</p>
+<p class='stm par run hide_run'>157</p>
+<p class='stm run hide_run'>158</p>
+<p class='stm run hide_run'>159</p>
+<p class='stm run hide_run'>160</p>
+<p class='stm run hide_run'>161</p>
+<p class='stm run hide_run'>162</p>
<p class='pln'>163</p>
-<p class='stm run hide'>164</p>
+<p class='stm run hide_run'>164</p>
<p class='pln'>165</p>
<p class='pln'>166</p>
-<p class='stm run hide'>167</p>
-<p class='stm run hide'>168</p>
+<p class='stm run hide_run'>167</p>
+<p class='stm run hide_run'>168</p>
<p class='pln'>169</p>
-<p class='stm run hide'>170</p>
+<p class='stm run hide_run'>170</p>
<p class='pln'>171</p>
<p class='pln'>172</p>
<p class='pln'>173</p>
@@ -215,60 +220,60 @@ function toggle_lines(btn, cls) { <p class='stm mis'>176</p>
<p class='pln'>177</p>
<p class='pln'>178</p>
-<p class='stm run hide'>179</p>
+<p class='stm run hide_run'>179</p>
<p class='pln'>180</p>
<p class='pln'>181</p>
-<p class='stm run hide'>182</p>
-<p class='stm run hide'>183</p>
-<p class='stm run hide'>184</p>
+<p class='stm run hide_run'>182</p>
+<p class='stm run hide_run'>183</p>
+<p class='stm run hide_run'>184</p>
<p class='pln'>185</p>
-<p class='stm run hide'>186</p>
-<p class='stm run hide'>187</p>
-<p class='stm run hide'>188</p>
-<p class='stm run hide'>189</p>
-<p class='stm run hide'>190</p>
+<p class='stm run hide_run'>186</p>
+<p class='stm run hide_run'>187</p>
+<p class='stm run hide_run'>188</p>
+<p class='stm run hide_run'>189</p>
+<p class='stm run hide_run'>190</p>
<p class='pln'>191</p>
-<p class='stm run hide'>192</p>
-<p class='stm run hide'>193</p>
+<p class='stm run hide_run'>192</p>
+<p class='stm run hide_run'>193</p>
<p class='pln'>194</p>
<p class='pln'>195</p>
-<p class='stm run hide'>196</p>
+<p class='stm run hide_run'>196</p>
<p class='pln'>197</p>
<p class='pln'>198</p>
-<p class='stm run hide'>199</p>
+<p class='stm run hide_run'>199</p>
<p class='pln'>200</p>
-<p class='stm run hide'>201</p>
-<p class='stm run hide'>202</p>
-<p class='stm run hide'>203</p>
-<p class='stm run hide'>204</p>
-<p class='stm run hide'>205</p>
-<p class='stm run hide'>206</p>
-<p class='stm run hide'>207</p>
-<p class='stm run hide'>208</p>
-<p class='stm run hide'>209</p>
-<p class='stm run hide'>210</p>
-<p class='stm run hide'>211</p>
-<p class='stm run hide'>212</p>
-<p class='stm run hide'>213</p>
-<p class='stm run hide'>214</p>
+<p class='stm run hide_run'>201</p>
+<p class='stm run hide_run'>202</p>
+<p class='stm run hide_run'>203</p>
+<p class='stm run hide_run'>204</p>
+<p class='stm run hide_run'>205</p>
+<p class='stm run hide_run'>206</p>
+<p class='stm run hide_run'>207</p>
+<p class='stm run hide_run'>208</p>
+<p class='stm run hide_run'>209</p>
+<p class='stm run hide_run'>210</p>
+<p class='stm run hide_run'>211</p>
+<p class='stm run hide_run'>212</p>
+<p class='stm run hide_run'>213</p>
+<p class='stm run hide_run'>214</p>
<p class='pln'>215</p>
-<p class='stm run hide'>216</p>
+<p class='stm run hide_run'>216</p>
<p class='pln'>217</p>
<p class='pln'>218</p>
<p class='stm mis'>219</p>
<p class='pln'>220</p>
-<p class='stm run hide'>221</p>
+<p class='stm run hide_run'>221</p>
<p class='pln'>222</p>
<p class='pln'>223</p>
<p class='stm mis'>224</p>
<p class='pln'>225</p>
-<p class='stm run hide'>226</p>
+<p class='stm run hide_run'>226</p>
<p class='pln'>227</p>
<p class='pln'>228</p>
<p class='stm mis'>229</p>
<p class='stm mis'>230</p>
<p class='pln'>231</p>
-<p class='stm run hide'>232</p>
+<p class='stm run hide_run'>232</p>
<p class='pln'>233</p>
<p class='stm mis'>234</p>
<p class='stm mis'>235</p>
@@ -311,7 +316,7 @@ function toggle_lines(btn, cls) { <p class='pln'>272</p>
<p class='stm mis'>273</p>
<p class='pln'>274</p>
-<p class='stm run hide'>275</p>
+<p class='stm run hide_run'>275</p>
<p class='pln'>276</p>
<p class='pln'>277</p>
<p class='stm mis'>278</p>
@@ -321,174 +326,174 @@ function toggle_lines(btn, cls) { <p class='stm mis'>282</p>
<p class='pln'>283</p>
<p class='pln'>284</p>
-<p class='stm run hide'>285</p>
+<p class='stm run hide_run'>285</p>
<p class='pln'>286</p>
<p class='pln'>287</p>
-<p class='stm run hide'>288</p>
-<p class='stm run hide'>289</p>
-<p class='stm run hide'>290</p>
-<p class='stm run hide'>291</p>
-<p class='stm run hide'>292</p>
-<p class='stm run hide'>293</p>
-<p class='stm run hide'>294</p>
+<p class='stm run hide_run'>288</p>
+<p class='stm run hide_run'>289</p>
+<p class='stm run hide_run'>290</p>
+<p class='stm run hide_run'>291</p>
+<p class='stm run hide_run'>292</p>
+<p class='stm run hide_run'>293</p>
+<p class='stm run hide_run'>294</p>
<p class='pln'>295</p>
-<p class='stm run hide'>296</p>
-<p class='stm run hide'>297</p>
+<p class='stm run hide_run'>296</p>
+<p class='stm run hide_run'>297</p>
<p class='pln'>298</p>
-<p class='stm run hide'>299</p>
+<p class='stm run hide_run'>299</p>
<p class='pln'>300</p>
-<p class='stm run hide'>301</p>
+<p class='stm run hide_run'>301</p>
<p class='stm mis'>302</p>
<p class='pln'>303</p>
-<p class='stm run hide'>304</p>
-<p class='stm run hide'>305</p>
+<p class='stm run hide_run'>304</p>
+<p class='stm run hide_run'>305</p>
<p class='pln'>306</p>
-<p class='stm run hide'>307</p>
-<p class='stm run hide'>308</p>
+<p class='stm run hide_run'>307</p>
+<p class='stm run hide_run'>308</p>
<p class='pln'>309</p>
<p class='pln'>310</p>
-<p class='stm run hide'>311</p>
-<p class='stm run hide'>312</p>
+<p class='stm run hide_run'>311</p>
+<p class='stm run hide_run'>312</p>
<p class='pln'>313</p>
-<p class='stm run hide'>314</p>
+<p class='stm run hide_run'>314</p>
<p class='pln'>315</p>
<p class='pln'>316</p>
<p class='pln'>317</p>
-<p class='stm run hide'>318</p>
-<p class='stm run hide'>319</p>
-<p class='stm run hide'>320</p>
+<p class='stm run hide_run'>318</p>
+<p class='stm run hide_run'>319</p>
+<p class='stm run hide_run'>320</p>
<p class='pln'>321</p>
-<p class='stm run hide'>322</p>
+<p class='stm run hide_run'>322</p>
<p class='pln'>323</p>
<p class='pln'>324</p>
<p class='pln'>325</p>
<p class='pln'>326</p>
-<p class='stm run hide'>327</p>
-<p class='stm run hide'>328</p>
-<p class='stm run hide'>329</p>
+<p class='stm run hide_run'>327</p>
+<p class='stm run hide_run'>328</p>
+<p class='stm run hide_run'>329</p>
<p class='pln'>330</p>
-<p class='stm run hide'>331</p>
+<p class='stm par run hide_run'>331</p>
<p class='pln'>332</p>
<p class='stm mis'>333</p>
<p class='stm mis'>334</p>
-<p class='stm run hide'>335</p>
+<p class='stm par run hide_run'>335</p>
<p class='pln'>336</p>
<p class='stm mis'>337</p>
<p class='stm mis'>338</p>
<p class='pln'>339</p>
-<p class='stm run hide'>340</p>
-<p class='stm run hide'>341</p>
+<p class='stm run hide_run'>340</p>
+<p class='stm run hide_run'>341</p>
<p class='pln'>342</p>
-<p class='stm run hide'>343</p>
+<p class='stm run hide_run'>343</p>
<p class='pln'>344</p>
-<p class='stm run hide'>345</p>
-<p class='stm run hide'>346</p>
+<p class='stm run hide_run'>345</p>
+<p class='stm run hide_run'>346</p>
<p class='pln'>347</p>
<p class='pln'>348</p>
-<p class='stm run hide'>349</p>
-<p class='stm run hide'>350</p>
+<p class='stm par run hide_run'>349</p>
+<p class='stm run hide_run'>350</p>
<p class='pln'>351</p>
<p class='pln'>352</p>
-<p class='stm run hide'>353</p>
+<p class='stm run hide_run'>353</p>
<p class='pln'>354</p>
<p class='pln'>355</p>
-<p class='stm run hide'>356</p>
-<p class='stm run hide'>357</p>
+<p class='stm run hide_run'>356</p>
+<p class='stm run hide_run'>357</p>
<p class='pln'>358</p>
-<p class='stm run hide'>359</p>
-<p class='stm run hide'>360</p>
+<p class='stm run hide_run'>359</p>
+<p class='stm par run hide_run'>360</p>
<p class='stm mis'>361</p>
<p class='pln'>362</p>
-<p class='stm run hide'>363</p>
+<p class='stm par run hide_run'>363</p>
<p class='stm mis'>364</p>
<p class='pln'>365</p>
-<p class='stm run hide'>366</p>
-<p class='stm run hide'>367</p>
-<p class='stm run hide'>368</p>
-<p class='stm run hide'>369</p>
-<p class='stm run hide'>370</p>
-<p class='stm run hide'>371</p>
+<p class='stm run hide_run'>366</p>
+<p class='stm run hide_run'>367</p>
+<p class='stm run hide_run'>368</p>
+<p class='stm run hide_run'>369</p>
+<p class='stm par run hide_run'>370</p>
+<p class='stm run hide_run'>371</p>
<p class='pln'>372</p>
<p class='pln'>373</p>
-<p class='stm run hide'>374</p>
-<p class='stm run hide'>375</p>
-<p class='stm run hide'>376</p>
-<p class='stm run hide'>377</p>
-<p class='stm run hide'>378</p>
+<p class='stm run hide_run'>374</p>
+<p class='stm run hide_run'>375</p>
+<p class='stm run hide_run'>376</p>
+<p class='stm run hide_run'>377</p>
+<p class='stm run hide_run'>378</p>
<p class='pln'>379</p>
<p class='pln'>380</p>
<p class='pln'>381</p>
-<p class='stm run hide'>382</p>
-<p class='stm run hide'>383</p>
-<p class='stm run hide'>384</p>
-<p class='stm run hide'>385</p>
-<p class='stm run hide'>386</p>
+<p class='stm run hide_run'>382</p>
+<p class='stm run hide_run'>383</p>
+<p class='stm run hide_run'>384</p>
+<p class='stm run hide_run'>385</p>
+<p class='stm run hide_run'>386</p>
<p class='pln'>387</p>
<p class='pln'>388</p>
-<p class='stm run hide'>389</p>
-<p class='stm run hide'>390</p>
+<p class='stm run hide_run'>389</p>
+<p class='stm run hide_run'>390</p>
<p class='pln'>391</p>
<p class='pln'>392</p>
-<p class='stm run hide'>393</p>
+<p class='stm run hide_run'>393</p>
<p class='pln'>394</p>
<p class='pln'>395</p>
-<p class='stm run hide'>396</p>
-<p class='stm run hide'>397</p>
+<p class='stm run hide_run'>396</p>
+<p class='stm par run hide_run'>397</p>
<p class='stm mis'>398</p>
<p class='pln'>399</p>
-<p class='stm run hide'>400</p>
+<p class='stm par run hide_run'>400</p>
<p class='stm mis'>401</p>
<p class='pln'>402</p>
-<p class='stm run hide'>403</p>
-<p class='stm run hide'>404</p>
-<p class='stm run hide'>405</p>
-<p class='stm run hide'>406</p>
-<p class='stm run hide'>407</p>
+<p class='stm par run hide_run'>403</p>
+<p class='stm run hide_run'>404</p>
+<p class='stm run hide_run'>405</p>
+<p class='stm run hide_run'>406</p>
+<p class='stm par run hide_run'>407</p>
<p class='stm mis'>408</p>
<p class='pln'>409</p>
<p class='pln'>410</p>
<p class='pln'>411</p>
-<p class='stm run hide'>412</p>
-<p class='stm run hide'>413</p>
-<p class='stm run hide'>414</p>
+<p class='stm par run hide_run'>412</p>
+<p class='stm run hide_run'>413</p>
+<p class='stm run hide_run'>414</p>
<p class='pln'>415</p>
-<p class='stm run hide'>416</p>
+<p class='stm run hide_run'>416</p>
<p class='pln'>417</p>
<p class='pln'>418</p>
<p class='pln'>419</p>
-<p class='stm run hide'>420</p>
-<p class='stm run hide'>421</p>
-<p class='stm run hide'>422</p>
+<p class='stm run hide_run'>420</p>
+<p class='stm run hide_run'>421</p>
+<p class='stm par run hide_run'>422</p>
<p class='stm mis'>423</p>
<p class='pln'>424</p>
-<p class='stm run hide'>425</p>
+<p class='stm par run hide_run'>425</p>
<p class='stm mis'>426</p>
<p class='pln'>427</p>
-<p class='stm run hide'>428</p>
-<p class='stm run hide'>429</p>
-<p class='stm run hide'>430</p>
+<p class='stm run hide_run'>428</p>
+<p class='stm run hide_run'>429</p>
+<p class='stm run hide_run'>430</p>
<p class='pln'>431</p>
-<p class='stm run hide'>432</p>
+<p class='stm par run hide_run'>432</p>
<p class='pln'>433</p>
<p class='stm mis'>434</p>
<p class='pln'>435</p>
<p class='pln'>436</p>
<p class='pln'>437</p>
<p class='pln'>438</p>
-<p class='stm run hide'>439</p>
-<p class='stm run hide'>440</p>
-<p class='stm run hide'>441</p>
-<p class='stm run hide'>442</p>
-<p class='stm run hide'>443</p>
-<p class='stm run hide'>444</p>
-<p class='stm run hide'>445</p>
-<p class='stm run hide'>446</p>
+<p class='stm run hide_run'>439</p>
+<p class='stm par run hide_run'>440</p>
+<p class='stm run hide_run'>441</p>
+<p class='stm run hide_run'>442</p>
+<p class='stm run hide_run'>443</p>
+<p class='stm run hide_run'>444</p>
+<p class='stm run hide_run'>445</p>
+<p class='stm run hide_run'>446</p>
<p class='pln'>447</p>
-<p class='stm run hide'>448</p>
+<p class='stm run hide_run'>448</p>
<p class='pln'>449</p>
<p class='pln'>450</p>
-<p class='stm run hide'>451</p>
-<p class='stm run hide'>452</p>
+<p class='stm run hide_run'>451</p>
+<p class='stm par run hide_run'>452</p>
<p class='stm mis'>453</p>
<p class='stm mis'>454</p>
<p class='stm mis'>455</p>
@@ -503,45 +508,45 @@ function toggle_lines(btn, cls) { <p class='pln'>464</p>
<p class='pln'>465</p>
<p class='pln'>466</p>
-<p class='stm run hide'>467</p>
+<p class='stm par run hide_run'>467</p>
<p class='stm mis'>468</p>
<p class='pln'>469</p>
-<p class='stm run hide'>470</p>
-<p class='stm run hide'>471</p>
-<p class='stm run hide'>472</p>
+<p class='stm par run hide_run'>470</p>
+<p class='stm run hide_run'>471</p>
+<p class='stm run hide_run'>472</p>
<p class='pln'>473</p>
-<p class='stm run hide'>474</p>
+<p class='stm par run hide_run'>474</p>
<p class='stm mis'>475</p>
<p class='pln'>476</p>
-<p class='stm run hide'>477</p>
+<p class='stm par run hide_run'>477</p>
<p class='stm mis'>478</p>
-<p class='stm run hide'>479</p>
+<p class='stm par run hide_run'>479</p>
<p class='stm mis'>480</p>
<p class='pln'>481</p>
<p class='pln'>482</p>
<p class='pln'>483</p>
-<p class='stm run hide'>484</p>
+<p class='stm run hide_run'>484</p>
<p class='pln'>485</p>
-<p class='stm run hide'>486</p>
+<p class='stm run hide_run'>486</p>
<p class='pln'>487</p>
<p class='pln'>488</p>
<p class='pln'>489</p>
-<p class='stm run hide'>490</p>
+<p class='stm par run hide_run'>490</p>
<p class='pln'>491</p>
<p class='stm mis'>492</p>
<p class='stm mis'>493</p>
-<p class='stm run hide'>494</p>
+<p class='stm run hide_run'>494</p>
<p class='pln'>495</p>
-<p class='stm run hide'>496</p>
+<p class='stm run hide_run'>496</p>
<p class='pln'>497</p>
<p class='pln'>498</p>
<p class='pln'>499</p>
-<p class='stm run hide'>500</p>
-<p class='stm run hide'>501</p>
-<p class='stm run hide'>502</p>
-<p class='stm run hide'>503</p>
+<p class='stm run hide_run'>500</p>
+<p class='stm run hide_run'>501</p>
+<p class='stm run hide_run'>502</p>
+<p class='stm run hide_run'>503</p>
<p class='pln'>504</p>
-<p class='stm run hide'>505</p>
+<p class='stm run hide_run'>505</p>
<p class='pln'>506</p>
<p class='pln'>507</p>
<p class='stm mis'>508</p>
@@ -559,20 +564,20 @@ function toggle_lines(btn, cls) { <p class='stm mis'>520</p>
<p class='stm mis'>521</p>
<p class='pln'>522</p>
-<p class='stm run hide'>523</p>
+<p class='stm run hide_run'>523</p>
<p class='stm mis'>524</p>
<p class='stm mis'>525</p>
<p class='pln'>526</p>
-<p class='stm run hide'>527</p>
+<p class='stm run hide_run'>527</p>
<p class='stm mis'>528</p>
<p class='stm mis'>529</p>
<p class='stm mis'>530</p>
<p class='pln'>531</p>
-<p class='stm run hide'>532</p>
+<p class='stm run hide_run'>532</p>
<p class='stm mis'>533</p>
<p class='stm mis'>534</p>
<p class='pln'>535</p>
-<p class='stm run hide'>536</p>
+<p class='stm run hide_run'>536</p>
<p class='pln'>537</p>
<p class='pln'>538</p>
<p class='pln'>539</p>
@@ -620,7 +625,7 @@ function toggle_lines(btn, cls) { <p class='pln'>581</p>
<p class='stm mis'>582</p>
<p class='pln'>583</p>
-<p class='stm run hide'>584</p>
+<p class='stm run hide_run'>584</p>
<p class='pln'>585</p>
<p class='pln'>586</p>
<p class='stm mis'>587</p>
@@ -637,7 +642,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>598</p>
<p class='stm mis'>599</p>
<p class='pln'>600</p>
-<p class='stm run hide'>601</p>
+<p class='stm run hide_run'>601</p>
<p class='pln'>602</p>
<p class='pln'>603</p>
<p class='stm mis'>604</p>
@@ -655,7 +660,7 @@ function toggle_lines(btn, cls) { <p class='pln'>616</p>
<p class='stm mis'>617</p>
<p class='pln'>618</p>
-<p class='stm run hide'>619</p>
+<p class='stm run hide_run'>619</p>
<p class='pln'>620</p>
<p class='pln'>621</p>
<p class='pln'>622</p>
@@ -680,7 +685,7 @@ function toggle_lines(btn, cls) { <p class='pln'>641</p>
<p class='stm mis'>642</p>
<p class='pln'>643</p>
-<p class='stm run hide'>644</p>
+<p class='stm run hide_run'>644</p>
<p class='pln'>645</p>
<p class='pln'>646</p>
<p class='pln'>647</p>
@@ -749,715 +754,715 @@ function toggle_lines(btn, cls) { </td>
<td class='text' valign='top'>
-<p class='pln'><span class='str'>""" Cog code generation tool.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> http://nedbatchelder.com/code/cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Copyright 2004-2009, Ned Batchelder.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>"""</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>import</span> <span class='nam'>copy</span><span class='op'>,</span> <span class='nam'>getopt</span><span class='op'>,</span> <span class='nam'>imp</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>,</span> <span class='nam'>re</span><span class='op'>,</span> <span class='nam'>shlex</span><span class='op'>,</span> <span class='nam'>string</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>,</span> <span class='nam'>traceback</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>from</span> <span class='nam'>cStringIO</span> <span class='key'>import</span> <span class='nam'>StringIO</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='com'># The recommended way to compute md5's changed in Python 2.5</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>import</span> <span class='nam'>hashlib</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>hash_factory</span> <span class='op'>=</span> <span class='nam'>hashlib</span><span class='op'>.</span><span class='nam'>md5</span><span class="strut"> </span></p>
-<p class='stm mis'><span class='key'>except</span> <span class='nam'>ImportError</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>import</span> <span class='nam'>md5</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>hash_factory</span> <span class='op'>=</span> <span class='nam'>md5</span><span class='op'>.</span><span class='nam'>new</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='nam'>__all__</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'Cog'</span><span class='op'>,</span> <span class='str'>'CogUsageError'</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='nam'>__version__</span> <span class='op'>=</span> <span class='str'>'2.2'</span> <span class='com'># History at the end of the file.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='nam'>usage</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>cog - generate code with inlined Python code.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'>cog [OPTIONS] [INFILE | @FILELIST] ...</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'>INFILE is the name of an input file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>FILELIST is the name of a text file containing file names or</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> other @FILELISTs.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'>OPTIONS:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -c Checksum the output to protect it against accidental change.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -d Delete the generator code from the output file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -D name=val Define a global string available to your generator code.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -e Warn if a file has no cog code in it.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -I PATH Add PATH to the list of directories for data files and modules.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -o OUTNAME Write the output to OUTNAME.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -r Replace the input file with the output.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -s STRING Suffix all generated output lines with STRING.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -U Write the output with Unix newlines (only LF line-endings).</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -w CMD Use CMD if the output file needs to be made writable.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> A %s in the CMD will be filled with the filename.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -x Excise all the generated output without running the generators.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -z The [[[end]]] marker can be omitted, and is assumed at eof.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -v Print the version of cog and exit.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -h Print this help.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>"""</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Other package modules</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>from</span> <span class='nam'>whiteutils</span> <span class='key'>import</span> <span class='op'>*</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='nam'>Exception</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Any exception raised by Cog.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>,</span> <span class='nam'>file</span><span class='op'>=</span><span class='str'>''</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='num'>0</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>file</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>Exception</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='str'>"%s(%d): %s"</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>file</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>Exception</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" An error in usage of command-line arguments in cog.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>pass</span> <span class='com'>#pragma: no cover</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogInternalError</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" An error in the coding of Cog. Should never happen.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>pass</span> <span class='com'>#pragma: no cover</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogGeneratedError</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" An error raised by a user's cog generator.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>pass</span> <span class='com'>#pragma: no cover</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>Redirectable</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" An object with its own stdout and stderr files.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>stdout</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>stderr</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>stdout</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Assign new files for standard out and/or standard error.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>stdout</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span> <span class='op'>=</span> <span class='nam'>stdout</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>stderr</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>stderr</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogGenerator</span><span class='op'>(</span><span class='nam'>Redirectable</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" A generator pulled from a source file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>Redirectable</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>parseMarker</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>parseLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='str'>'\n'</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>getCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Extract the executable Python code from the generator.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># If the markers and lines all have the same prefix</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># (end-of-line comment chars, for example),</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># then remove it from all the lines.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>prefIn</span> <span class='op'>=</span> <span class='nam'>commonPrefix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>+</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>prefIn</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>=</span> <span class='op'>[</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>prefIn</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span> <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span> <span class='op'>=</span> <span class='op'>[</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>prefIn</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span> <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span> <span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>evaluate</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>cog</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='str'>'cog generator'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># figure out the right whitespace prefix for the output</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>prefOut</span> <span class='op'>=</span> <span class='nam'>whitePrefix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>intext</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>intext</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='str'>''</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># In Python 2.2, the last line has to end in a newline.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>intext</span> <span class='op'>=</span> <span class='str'>"import cog\n"</span> <span class='op'>+</span> <span class='nam'>intext</span> <span class='op'>+</span> <span class='str'>"\n"</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>code</span> <span class='op'>=</span> <span class='nam'>compile</span><span class='op'>(</span><span class='nam'>intext</span><span class='op'>,</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>fname</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'exec'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Make sure the "cog" module has our state.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>msg</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>msg</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>out</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>out</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>outl</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outl</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>error</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>error</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='op'>=</span> <span class='str'>''</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>eval</span><span class='op'>(</span><span class='nam'>code</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># We need to make sure that the last line in the output</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># ends with a newline, or it will be joined to the</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># end-output line, ruining cog's idempotency.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span><span class='op'>[</span><span class='op'>-</span><span class='num'>1</span><span class='op'>]</span> <span class='op'>!=</span> <span class='str'>'\n'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='op'>+=</span> <span class='str'>'\n'</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span><span class='op'>,</span> <span class='nam'>prefOut</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>msg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>"Message: "</span><span class='op'>+</span><span class='nam'>s</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>out</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sOut</span><span class='op'>=</span><span class='str'>''</span><span class='op'>,</span> <span class='nam'>dedent</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>,</span> <span class='nam'>trimblanklines</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" The cog.out function.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>trimblanklines</span> <span class='key'>and</span> <span class='op'>(</span><span class='str'>'\n'</span> <span class='key'>in</span> <span class='nam'>sOut</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>lines</span> <span class='op'>=</span> <span class='nam'>sOut</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>'\n'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>lines</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>==</span> <span class='str'>''</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>del</span> <span class='nam'>lines</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>lines</span> <span class='key'>and</span> <span class='nam'>lines</span><span class='op'>[</span><span class='op'>-</span><span class='num'>1</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>==</span> <span class='str'>''</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>del</span> <span class='nam'>lines</span><span class='op'>[</span><span class='op'>-</span><span class='num'>1</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>sOut</span> <span class='op'>=</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>)</span><span class='op'>+</span><span class='str'>'\n'</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>dedent</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>sOut</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>sOut</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='op'>+=</span> <span class='nam'>sOut</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>outl</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sOut</span><span class='op'>=</span><span class='str'>''</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kw</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" The cog.outl function.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>out</span><span class='op'>(</span><span class='nam'>sOut</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kw</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>out</span><span class='op'>(</span><span class='str'>'\n'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>error</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='str'>'Error raised by cog generator.'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" The cog.error function.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Instead of raising standard python errors, cog generators can use</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> this function. It will display the error without a scary Python</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> traceback.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogGeneratedError</span><span class='op'>(</span><span class='nam'>msg</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>NumberedFileReader</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" A decorator for files that counts the readline()'s called.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>f</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>f</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>n</span> <span class='op'>=</span> <span class='num'>0</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>readline</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>f</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>l</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>n</span> <span class='op'>+=</span> <span class='num'>1</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='nam'>l</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>linenumber</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>n</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogOptions</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Options for a run of cog.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Defaults for argument values.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>args</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>includePath</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>defines</span> <span class='op'>=</span> <span class='op'>{</span><span class='op'>}</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bShowVersion</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span> <span class='op'>=</span> <span class='nam'>None</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNoGenerate</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputName</span> <span class='op'>=</span> <span class='nam'>None</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bWarnEmpty</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bHashOutput</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bDeleteCode</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bEofCanBeEnd</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sSuffix</span> <span class='op'>=</span> <span class='nam'>None</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNewlines</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>__cmp__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Comparison operator for tests to use.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__dict__</span><span class='op'>.</span><span class='nam'>__cmp__</span><span class='op'>(</span><span class='nam'>other</span><span class='op'>.</span><span class='nam'>__dict__</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>clone</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Make a clone of these options, for further refinement.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='nam'>copy</span><span class='op'>.</span><span class='nam'>deepcopy</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>dirs</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Add directories to the include path.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>dirs</span> <span class='op'>=</span> <span class='nam'>dirs</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>pathsep</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>includePath</span><span class='op'>.</span><span class='nam'>extend</span><span class='op'>(</span><span class='nam'>dirs</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>parseArgs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>argv</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Parse the command line arguments.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>opts</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>args</span> <span class='op'>=</span> <span class='nam'>getopt</span><span class='op'>.</span><span class='nam'>getopt</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>,</span> <span class='str'>'cdD:eI:o:rs:Uvw:xz'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>except</span> <span class='nam'>getopt</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='nam'>msg</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Handle the command line arguments.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>o</span><span class='op'>,</span> <span class='nam'>a</span> <span class='key'>in</span> <span class='nam'>opts</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-c'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bHashOutput</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-d'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bDeleteCode</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-D'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>a</span><span class='op'>.</span><span class='nam'>count</span><span class='op'>(</span><span class='str'>'='</span><span class='op'>)</span> <span class='op'><</span> <span class='num'>1</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>"-D takes a name=value argument"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>name</span><span class='op'>,</span> <span class='nam'>value</span> <span class='op'>=</span> <span class='nam'>a</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>'='</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>defines</span><span class='op'>[</span><span class='nam'>name</span><span class='op'>]</span> <span class='op'>=</span> <span class='nam'>value</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-e'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bWarnEmpty</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-I'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>a</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-o'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputName</span> <span class='op'>=</span> <span class='nam'>a</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-r'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-s'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sSuffix</span> <span class='op'>=</span> <span class='nam'>a</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-U'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNewlines</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-v'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bShowVersion</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-w'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span> <span class='op'>=</span> <span class='nam'>a</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-x'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNoGenerate</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-z'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bEofCanBeEnd</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Since getopt.getopt is given a list of possible flags,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># this is an internal error.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogInternalError</span><span class='op'>(</span><span class='str'>"Don't understand argument %s"</span> <span class='op'>%</span> <span class='nam'>o</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>validate</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Does nothing if everything is OK, raises CogError's if it's not.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>"Can't use -d with -r (or you would delete all your source!)"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>"Can't use -o with -r (they are opposites)"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>Cog</span><span class='op'>(</span><span class='nam'>Redirectable</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" The Cog engine.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>Redirectable</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span> <span class='op'>=</span> <span class='str'>'[[[cog'</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span> <span class='op'>=</span> <span class='str'>']]]'</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span> <span class='op'>=</span> <span class='str'>'[[[end]]]'</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>reEndOutput</span> <span class='op'>=</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>compile</span><span class='op'>(</span><span class='str'>r'\[\[\[end]]](?P<hashsect> *\(checksum: (?P<hash>[a-f0-9]+)\))'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndFormat</span> <span class='op'>=</span> <span class='str'>'[[[end]]] (checksum: %s)'</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span> <span class='op'>=</span> <span class='str'>'w'</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>installCogModule</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>showWarning</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>"Warning:"</span><span class='op'>,</span> <span class='nam'>msg</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span> <span class='key'>and</span> <span class='xx'>\</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>installCogModule</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Magic mumbo-jumbo so that imported Python modules</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> can say "import cog" and get our state.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span> <span class='op'>=</span> <span class='nam'>imp</span><span class='op'>.</span><span class='nam'>new_module</span><span class='op'>(</span><span class='str'>'cog'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>path</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='op'>[</span><span class='str'>'cog'</span><span class='op'>]</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>fIn</span><span class='op'>,</span> <span class='nam'>fOut</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Process an input file object to an output file object.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> fIn and fOut can be file objects, or file names.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>sFileIn</span> <span class='op'>=</span> <span class='nam'>fname</span> <span class='key'>or</span> <span class='str'>''</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>sFileOut</span> <span class='op'>=</span> <span class='nam'>fname</span> <span class='key'>or</span> <span class='str'>''</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>fInToClose</span> <span class='op'>=</span> <span class='nam'>fOutToClose</span> <span class='op'>=</span> <span class='nam'>None</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Convert filenames to files.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>fIn</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Open the input file.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>sFileIn</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>fIn</span> <span class='op'>=</span> <span class='nam'>fInToClose</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>fIn</span><span class='op'>,</span> <span class='str'>'r'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>fOut</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Open the output file.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>sFileOut</span> <span class='op'>=</span> <span class='nam'>fOut</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>fOut</span> <span class='op'>=</span> <span class='nam'>fOutToClose</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>fOut</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>fIn</span> <span class='op'>=</span> <span class='nam'>NumberedFileReader</span><span class='op'>(</span><span class='nam'>fIn</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>bSawCog</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>inFile</span> <span class='op'>=</span> <span class='nam'>sFileIn</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>outFile</span> <span class='op'>=</span> <span class='nam'>sFileOut</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># The globals dict we'll use for this file.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>globals</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>globals</span> <span class='op'>=</span> <span class='op'>{</span><span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># If there are any global defines, put them in the globals.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>globals</span><span class='op'>.</span><span class='nam'>update</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>defines</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># loop over generator chunks</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>while</span> <span class='nam'>l</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Find the next spec begin</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>while</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>l</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>break</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># l is the begin spec</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>gen</span> <span class='op'>=</span> <span class='nam'>CogGenerator</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stdout</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseMarker</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>firstLineNum</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>firstLineNum</span> <span class='op'>=</span> <span class='nam'>firstLineNum</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># If the spec begin is also a spec end, then process the single</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># line of code inside.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>beg</span> <span class='op'>=</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>end</span> <span class='op'>=</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>beg</span> <span class='op'>></span> <span class='nam'>end</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Cog code markers inverted"</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>firstLineNum</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>sCode</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>[</span><span class='nam'>beg</span><span class='op'>+</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>)</span><span class='op'>:</span><span class='nam'>end</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseLine</span><span class='op'>(</span><span class='nam'>sCode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Deal with an ordinary code block.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Get all the lines in the spec</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>while</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>l</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>"Cog block begun but never ended."</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>firstLineNum</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseMarker</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Eat all the lines in the output section. While reading past</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># them, compute the md5 hash of the old output.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>hasher</span> <span class='op'>=</span> <span class='nam'>hash_factory</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>while</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>update</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>curHash</span> <span class='op'>=</span> <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>hexdigest</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bEofCanBeEnd</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># We reached end of file before we found the end output line.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Missing '%s' before end of file."</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Write the output of the spec to be the new output if we're </span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># supposed to generate code.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>hasher</span> <span class='op'>=</span> <span class='nam'>hash_factory</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bNoGenerate</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>sFile</span> <span class='op'>=</span> <span class='str'>"%s+%d"</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>firstLineNum</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>sGen</span> <span class='op'>=</span> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>evaluate</span><span class='op'>(</span><span class='nam'>cog</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>=</span><span class='nam'>globals</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>sFile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>sGen</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>suffixLines</span><span class='op'>(</span><span class='nam'>sGen</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>update</span><span class='op'>(</span><span class='nam'>sGen</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>sGen</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>newHash</span> <span class='op'>=</span> <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>hexdigest</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>bSawCog</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Write the ending output line</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>hashMatch</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>reEndOutput</span><span class='op'>.</span><span class='nam'>search</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bHashOutput</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>hashMatch</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>oldHash</span> <span class='op'>=</span> <span class='nam'>hashMatch</span><span class='op'>.</span><span class='nam'>groupdict</span><span class='op'>(</span><span class='op'>)</span><span class='op'>[</span><span class='str'>'hash'</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>oldHash</span> <span class='op'>!=</span> <span class='nam'>curHash</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Create a new end line with the correct hash.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>endpieces</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>hashMatch</span><span class='op'>.</span><span class='nam'>group</span><span class='op'>(</span><span class='num'>0</span><span class='op'>)</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># There was no old hash, but we want a new hash.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>endpieces</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>l</span> <span class='op'>=</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndFormat</span> <span class='op'>%</span> <span class='nam'>newHash</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>endpieces</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># We don't want hashes output, so if there was one, get rid of</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># it.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>hashMatch</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>hashMatch</span><span class='op'>.</span><span class='nam'>groupdict</span><span class='op'>(</span><span class='op'>)</span><span class='op'>[</span><span class='str'>'hashsect'</span><span class='op'>]</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>bSawCog</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bWarnEmpty</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>showWarning</span><span class='op'>(</span><span class='str'>"no cog code found in %s"</span> <span class='op'>%</span> <span class='nam'>sFileIn</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>fInToClose</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>fInToClose</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>fOutToClose</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>fOutToClose</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># A regex for non-empty lines, used by suffixLines.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>reNonEmptyLines</span> <span class='op'>=</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>compile</span><span class='op'>(</span><span class='str'>"^\s*\S+.*$"</span><span class='op'>,</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>MULTILINE</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>suffixLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>text</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Add suffixes to the lines in text, if our options desire it.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> text is many lines, as a single string.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sSuffix</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Find all non-blank lines, and add the suffix to the end.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>repl</span> <span class='op'>=</span> <span class='str'>r"\g<0>"</span> <span class='op'>+</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sSuffix</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>'\\'</span><span class='op'>,</span> <span class='str'>'\\\\'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>text</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>reNonEmptyLines</span><span class='op'>.</span><span class='nam'>sub</span><span class='op'>(</span><span class='nam'>repl</span><span class='op'>,</span> <span class='nam'>text</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='nam'>text</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>processString</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sInput</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Process sInput as the text to cog.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Return the cogged output as a string.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>fOld</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>(</span><span class='nam'>sInput</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>fNew</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>fOld</span><span class='op'>,</span> <span class='nam'>fNew</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>fname</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='nam'>fNew</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>replaceFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>sNewText</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Replace file sOldPath with the contents sNewText</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Need to ensure we can write.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Use an external command to make the file writable.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>cmd</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>'%s'</span><span class='op'>,</span> <span class='nam'>sOldPath</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>popen</span><span class='op'>(</span><span class='nam'>cmd</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Couldn't make %s writable"</span> <span class='op'>%</span> <span class='nam'>sOldPath</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Can't write!</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Can't overwrite %s"</span> <span class='op'>%</span> <span class='nam'>sOldPath</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>sNewText</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>saveIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedInclude</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span><span class='op'>[</span><span class='op'>:</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedSysPath</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>[</span><span class='op'>:</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>restoreIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedInclude</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>path</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedSysPath</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>includePath</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>extend</span><span class='op'>(</span><span class='nam'>includePath</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>extend</span><span class='op'>(</span><span class='nam'>includePath</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>processOneFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFile</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Process one filename through cog.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>saveIncludePath</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Since we know where the input file came from,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># push its directory onto the include path.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='op'>[</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>dirname</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>)</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Set the file output mode based on whether we want \n or native</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># line endings.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span> <span class='op'>=</span> <span class='str'>'w'</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bNewlines</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span> <span class='op'>=</span> <span class='str'>'wb'</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># How we process the file depends on where the output is going.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>,</span> <span class='nam'>sFile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bReplace</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># We want to replace the cog file with the output,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># but only if they differ.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>"Cogging %s"</span> <span class='op'>%</span> <span class='nam'>sFile</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>bNeedNewline</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>fOldFile</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>sOldText</span> <span class='op'>=</span> <span class='nam'>fOldFile</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>fOldFile</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>sNewText</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>sOldText</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>sFile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>sOldText</span> <span class='op'>!=</span> <span class='nam'>sNewText</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>" (changed)"</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>bNeedNewline</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>replaceFile</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>,</span> <span class='nam'>sNewText</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># The try-finally block is so we can print a partial line</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># with the name of the file, and print (changed) on the</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># same line, but also make sure to break the line before</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># any traceback.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>bNeedNewline</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='nam'>sFile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>restoreIncludePath</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>processFileList</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFileList</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Process the files in a file list.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>flist</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sFileList</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>lines</span> <span class='op'>=</span> <span class='nam'>flist</span><span class='op'>.</span><span class='nam'>readlines</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>flist</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>lines</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Use shlex to parse the line like a shell.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>lex</span> <span class='op'>=</span> <span class='nam'>shlex</span><span class='op'>.</span><span class='nam'>shlex</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>,</span> <span class='nam'>posix</span><span class='op'>=</span><span class='nam'>True</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>lex</span><span class='op'>.</span><span class='nam'>whitespace_split</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>lex</span><span class='op'>.</span><span class='nam'>commenters</span> <span class='op'>=</span> <span class='str'>'#'</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># No escapes, so that backslash can be part of the path</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>lex</span><span class='op'>.</span><span class='nam'>escape</span> <span class='op'>=</span> <span class='str'>''</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>args</span> <span class='op'>=</span> <span class='nam'>list</span><span class='op'>(</span><span class='nam'>lex</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>args</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processArguments</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>processArguments</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>args</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Process one command-line.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>saved_options</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>clone</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>[</span><span class='num'>1</span><span class='op'>:</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>validate</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>args</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span> <span class='op'>==</span> <span class='str'>'@'</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>"Can't use -o with @file"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFileList</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>[</span><span class='num'>1</span><span class='op'>:</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processOneFile</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span> <span class='op'>=</span> <span class='nam'>saved_options</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>callableMain</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>argv</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" All of command-line cog, but in a callable form.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is used by main.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> argv is the equivalent of sys.argv.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>argv0</span> <span class='op'>=</span> <span class='nam'>argv</span><span class='op'>.</span><span class='nam'>pop</span><span class='op'>(</span><span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Provide help if asked for anywhere in the command line.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='str'>'-?'</span> <span class='key'>in</span> <span class='nam'>argv</span> <span class='key'>or</span> <span class='str'>'-h'</span> <span class='key'>in</span> <span class='nam'>argv</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='nam'>usage</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>validate</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bShowVersion</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>"Cog version %s"</span> <span class='op'>%</span> <span class='nam'>__version__</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>args</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>a</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>args</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processArguments</span><span class='op'>(</span><span class='op'>[</span><span class='nam'>a</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>"No files to process"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>main</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>argv</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Handle the command-line execution for cog.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='num'>0</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>except</span> <span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='nam'>err</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='str'>"(for help use -?)"</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='num'>2</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>except</span> <span class='nam'>CogGeneratedError</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='str'>"Error: %s"</span> <span class='op'>%</span> <span class='nam'>err</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='num'>3</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>except</span> <span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='nam'>err</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='num'>1</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>except</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>traceback</span><span class='op'>.</span><span class='nam'>print_exc</span><span class='op'>(</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='num'>1</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='com'># History:</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20040210: First public version.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20040220: Text preceding the start and end marker are removed from Python lines.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># -v option on the command line shows the version.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20040311: Make sure the last line of output is properly ended with a newline.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20040605: Fixed some blank line handling in cog.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Fixed problems with assigning to xml elements in handyxml.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20040621: Changed all line-ends to LF from CRLF.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20041002: Refactor some option handling to simplify unittesting the options.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20041118: cog.out and cog.outl have optional string arguments.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20041119: File names weren't being properly passed around for warnings, etc.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20041122: Added cog.firstLineNum: a property with the line number of the [[[cog line.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Added cog.inFile and cog.outFile: the names of the input and output file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20041218: Single-line cog generators, with start marker and end marker on</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># the same line.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20041230: Keep a single globals dict for all the code fragments in a single</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># file so they can share state.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050206: Added the -x switch to remove all generated output.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050218: Now code can be on the marker lines as well.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050219: Added -c switch to checksum the output so that edits can be</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># detected before they are obliterated.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050521: Added cog.error, contributed by Alexander Belchenko.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050720: Added code deletion and settable globals contributed by Blake Winton.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050724: Many tweaks to improve code coverage.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050726: Error messages are now printed with no traceback.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Code can no longer appear on the marker lines,</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># except for single-line style.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># -z allows omission of the [[[end]]] marker, and it will be assumed</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># at the end of the file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050729: Refactor option parsing into a separate class, in preparation for</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># future features.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050805: The cogmodule.path wasn't being properly maintained.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050808: Added the -D option to define a global value.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050810: The %s in the -w command is dealt with more robustly.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Added the -s option to suffix output lines with a marker.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20050817: Now @files can have arguments on each line to change the cog's</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># behavior for that line.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20051006: Version 2.0</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20080521: -U options lets you create Unix newlines on Windows. Thanks,</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Alexander Belchenko.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20080522: It's now ok to have -d with output to stdout, and now we validate</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># the args after each line of an @file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># 20090520: Use hashlib where it's available, to avoid a warning.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Use the builtin compile() instead of compiler, for Jython.</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Explicitly close files we opened, Jython likes this.</span><span class="strut"> </span></p>
+<p class='pln'><span class='str'>""" Cog code generation tool.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> http://nedbatchelder.com/code/cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Copyright 2004-2009, Ned Batchelder.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>"""</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>copy</span><span class='op'>,</span> <span class='nam'>getopt</span><span class='op'>,</span> <span class='nam'>imp</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>,</span> <span class='nam'>re</span><span class='op'>,</span> <span class='nam'>shlex</span><span class='op'>,</span> <span class='nam'>string</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>,</span> <span class='nam'>traceback</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>from</span> <span class='nam'>cStringIO</span> <span class='key'>import</span> <span class='nam'>StringIO</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='com'># The recommended way to compute md5's changed in Python 2.5</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>import</span> <span class='nam'>hashlib</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>hash_factory</span> <span class='op'>=</span> <span class='nam'>hashlib</span><span class='op'>.</span><span class='nam'>md5</span><span class='strut'> </span></p>
+<p class='stm mis'><span class='key'>except</span> <span class='nam'>ImportError</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>import</span> <span class='nam'>md5</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>hash_factory</span> <span class='op'>=</span> <span class='nam'>md5</span><span class='op'>.</span><span class='nam'>new</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='nam'>__all__</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'Cog'</span><span class='op'>,</span> <span class='str'>'CogUsageError'</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='nam'>__version__</span> <span class='op'>=</span> <span class='str'>'2.2'</span> <span class='com'># History at the end of the file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='nam'>usage</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>cog - generate code with inlined Python code.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'>cog [OPTIONS] [INFILE | @FILELIST] ...</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'>INFILE is the name of an input file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>FILELIST is the name of a text file containing file names or</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> other @FILELISTs.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'>OPTIONS:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -c Checksum the output to protect it against accidental change.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -d Delete the generator code from the output file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -D name=val Define a global string available to your generator code.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -e Warn if a file has no cog code in it.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -I PATH Add PATH to the list of directories for data files and modules.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -o OUTNAME Write the output to OUTNAME.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -r Replace the input file with the output.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -s STRING Suffix all generated output lines with STRING.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -U Write the output with Unix newlines (only LF line-endings).</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -w CMD Use CMD if the output file needs to be made writable.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> A %s in the CMD will be filled with the filename.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -x Excise all the generated output without running the generators.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -z The [[[end]]] marker can be omitted, and is assumed at eof.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -v Print the version of cog and exit.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -h Print this help.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>"""</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Other package modules</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>from</span> <span class='nam'>whiteutils</span> <span class='key'>import</span> <span class='op'>*</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='nam'>Exception</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Any exception raised by Cog.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>,</span> <span class='nam'>file</span><span class='op'>=</span><span class='str'>''</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='num'>0</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>59</span> <span class='key'>if</span> <span class='nam'>file</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>Exception</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='str'>"%s(%d): %s"</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>file</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>Exception</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" An error in usage of command-line arguments in cog.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>pass</span> <span class='com'>#pragma: no cover</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogInternalError</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" An error in the coding of Cog. Should never happen.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>pass</span> <span class='com'>#pragma: no cover</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogGeneratedError</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" An error raised by a user's cog generator.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>pass</span> <span class='com'>#pragma: no cover</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>Redirectable</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" An object with its own stdout and stderr files.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>stdout</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>stderr</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>stdout</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Assign new files for standard out and/or standard error.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>88</span> <span class='key'>if</span> <span class='nam'>stdout</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span> <span class='op'>=</span> <span class='nam'>stdout</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>89</span> <span class='key'>if</span> <span class='nam'>stderr</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>stderr</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogGenerator</span><span class='op'>(</span><span class='nam'>Redirectable</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" A generator pulled from a source file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>Redirectable</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>parseMarker</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>parseLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='str'>'\n'</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>getCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Extract the executable Python code from the generator.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># If the markers and lines all have the same prefix</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># (end-of-line comment chars, for example),</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># then remove it from all the lines.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>prefIn</span> <span class='op'>=</span> <span class='nam'>commonPrefix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>+</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>prefIn</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>=</span> <span class='op'>[</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>prefIn</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span> <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span> <span class='op'>=</span> <span class='op'>[</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>prefIn</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span> <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span> <span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>evaluate</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>cog</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='str'>'cog generator'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># figure out the right whitespace prefix for the output</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>prefOut</span> <span class='op'>=</span> <span class='nam'>whitePrefix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>intext</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>intext</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='str'>''</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># In Python 2.2, the last line has to end in a newline.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>intext</span> <span class='op'>=</span> <span class='str'>"import cog\n"</span> <span class='op'>+</span> <span class='nam'>intext</span> <span class='op'>+</span> <span class='str'>"\n"</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>code</span> <span class='op'>=</span> <span class='nam'>compile</span><span class='op'>(</span><span class='nam'>intext</span><span class='op'>,</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>fname</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'exec'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Make sure the "cog" module has our state.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>msg</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>msg</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>out</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>out</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>outl</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outl</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>error</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>error</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='op'>=</span> <span class='str'>''</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>eval</span><span class='op'>(</span><span class='nam'>code</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># We need to make sure that the last line in the output</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># ends with a newline, or it will be joined to the</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># end-output line, ruining cog's idempotency.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span><span class='op'>[</span><span class='op'>-</span><span class='num'>1</span><span class='op'>]</span> <span class='op'>!=</span> <span class='str'>'\n'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='op'>+=</span> <span class='str'>'\n'</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span><span class='op'>,</span> <span class='nam'>prefOut</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>msg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>"Message: "</span><span class='op'>+</span><span class='nam'>s</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>out</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sOut</span><span class='op'>=</span><span class='str'>''</span><span class='op'>,</span> <span class='nam'>dedent</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>,</span> <span class='nam'>trimblanklines</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" The cog.out function.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>trimblanklines</span> <span class='key'>and</span> <span class='op'>(</span><span class='str'>'\n'</span> <span class='key'>in</span> <span class='nam'>sOut</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>lines</span> <span class='op'>=</span> <span class='nam'>sOut</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>'\n'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>lines</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>==</span> <span class='str'>''</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>del</span> <span class='nam'>lines</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>159</span> <span class='key'>if</span> <span class='nam'>lines</span> <span class='key'>and</span> <span class='nam'>lines</span><span class='op'>[</span><span class='op'>-</span><span class='num'>1</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>==</span> <span class='str'>''</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>del</span> <span class='nam'>lines</span><span class='op'>[</span><span class='op'>-</span><span class='num'>1</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>sOut</span> <span class='op'>=</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>)</span><span class='op'>+</span><span class='str'>'\n'</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>dedent</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>sOut</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>sOut</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='op'>+=</span> <span class='nam'>sOut</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>outl</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sOut</span><span class='op'>=</span><span class='str'>''</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kw</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" The cog.outl function.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>out</span><span class='op'>(</span><span class='nam'>sOut</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kw</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>out</span><span class='op'>(</span><span class='str'>'\n'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>error</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='str'>'Error raised by cog generator.'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" The cog.error function.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Instead of raising standard python errors, cog generators can use</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> this function. It will display the error without a scary Python</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> traceback.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogGeneratedError</span><span class='op'>(</span><span class='nam'>msg</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>NumberedFileReader</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" A decorator for files that counts the readline()'s called.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>f</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>f</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>n</span> <span class='op'>=</span> <span class='num'>0</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>readline</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>f</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>l</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>n</span> <span class='op'>+=</span> <span class='num'>1</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='nam'>l</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>linenumber</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>n</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogOptions</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Options for a run of cog.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Defaults for argument values.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>args</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>includePath</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>defines</span> <span class='op'>=</span> <span class='op'>{</span><span class='op'>}</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bShowVersion</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span> <span class='op'>=</span> <span class='nam'>None</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNoGenerate</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputName</span> <span class='op'>=</span> <span class='nam'>None</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bWarnEmpty</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bHashOutput</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bDeleteCode</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bEofCanBeEnd</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sSuffix</span> <span class='op'>=</span> <span class='nam'>None</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNewlines</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>__cmp__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Comparison operator for tests to use.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__dict__</span><span class='op'>.</span><span class='nam'>__cmp__</span><span class='op'>(</span><span class='nam'>other</span><span class='op'>.</span><span class='nam'>__dict__</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>clone</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Make a clone of these options, for further refinement.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='nam'>copy</span><span class='op'>.</span><span class='nam'>deepcopy</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>dirs</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Add directories to the include path.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>dirs</span> <span class='op'>=</span> <span class='nam'>dirs</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>pathsep</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>includePath</span><span class='op'>.</span><span class='nam'>extend</span><span class='op'>(</span><span class='nam'>dirs</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>parseArgs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>argv</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Parse the command line arguments.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>opts</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>args</span> <span class='op'>=</span> <span class='nam'>getopt</span><span class='op'>.</span><span class='nam'>getopt</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>,</span> <span class='str'>'cdD:eI:o:rs:Uvw:xz'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>except</span> <span class='nam'>getopt</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='nam'>msg</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Handle the command line arguments.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>o</span><span class='op'>,</span> <span class='nam'>a</span> <span class='key'>in</span> <span class='nam'>opts</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-c'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bHashOutput</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-d'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bDeleteCode</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-D'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>a</span><span class='op'>.</span><span class='nam'>count</span><span class='op'>(</span><span class='str'>'='</span><span class='op'>)</span> <span class='op'><</span> <span class='num'>1</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>"-D takes a name=value argument"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>name</span><span class='op'>,</span> <span class='nam'>value</span> <span class='op'>=</span> <span class='nam'>a</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>'='</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>defines</span><span class='op'>[</span><span class='nam'>name</span><span class='op'>]</span> <span class='op'>=</span> <span class='nam'>value</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-e'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bWarnEmpty</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-I'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>a</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-o'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputName</span> <span class='op'>=</span> <span class='nam'>a</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-r'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-s'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sSuffix</span> <span class='op'>=</span> <span class='nam'>a</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-U'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNewlines</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-v'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bShowVersion</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-w'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span> <span class='op'>=</span> <span class='nam'>a</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-x'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNoGenerate</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>'-z'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bEofCanBeEnd</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Since getopt.getopt is given a list of possible flags,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># this is an internal error.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogInternalError</span><span class='op'>(</span><span class='str'>"Don't understand argument %s"</span> <span class='op'>%</span> <span class='nam'>o</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>validate</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Does nothing if everything is OK, raises CogError's if it's not.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>"Can't use -d with -r (or you would delete all your source!)"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>"Can't use -o with -r (they are opposites)"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>Cog</span><span class='op'>(</span><span class='nam'>Redirectable</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" The Cog engine.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>Redirectable</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span> <span class='op'>=</span> <span class='str'>'[[[cog'</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span> <span class='op'>=</span> <span class='str'>']]]'</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span> <span class='op'>=</span> <span class='str'>'[[[end]]]'</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>reEndOutput</span> <span class='op'>=</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>compile</span><span class='op'>(</span><span class='str'>r'\[\[\[end]]](?P<hashsect> *\(checksum: (?P<hash>[a-f0-9]+)\))'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndFormat</span> <span class='op'>=</span> <span class='str'>'[[[end]]] (checksum: %s)'</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span> <span class='op'>=</span> <span class='str'>'w'</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>installCogModule</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>showWarning</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>"Warning:"</span><span class='op'>,</span> <span class='nam'>msg</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span> <span class='key'>and</span> <span class='xx'>\</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>installCogModule</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Magic mumbo-jumbo so that imported Python modules</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> can say "import cog" and get our state.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span> <span class='op'>=</span> <span class='nam'>imp</span><span class='op'>.</span><span class='nam'>new_module</span><span class='op'>(</span><span class='str'>'cog'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>path</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='op'>[</span><span class='str'>'cog'</span><span class='op'>]</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>fIn</span><span class='op'>,</span> <span class='nam'>fOut</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Process an input file object to an output file object.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> fIn and fOut can be file objects, or file names.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>sFileIn</span> <span class='op'>=</span> <span class='nam'>fname</span> <span class='key'>or</span> <span class='str'>''</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>sFileOut</span> <span class='op'>=</span> <span class='nam'>fname</span> <span class='key'>or</span> <span class='str'>''</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>fInToClose</span> <span class='op'>=</span> <span class='nam'>fOutToClose</span> <span class='op'>=</span> <span class='nam'>None</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Convert filenames to files.</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>333</span> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>fIn</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Open the input file.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>sFileIn</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>fIn</span> <span class='op'>=</span> <span class='nam'>fInToClose</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>fIn</span><span class='op'>,</span> <span class='str'>'r'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>337</span> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>fOut</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Open the output file.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>sFileOut</span> <span class='op'>=</span> <span class='nam'>fOut</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>fOut</span> <span class='op'>=</span> <span class='nam'>fOutToClose</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>fOut</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>fIn</span> <span class='op'>=</span> <span class='nam'>NumberedFileReader</span><span class='op'>(</span><span class='nam'>fIn</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>bSawCog</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>inFile</span> <span class='op'>=</span> <span class='nam'>sFileIn</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>outFile</span> <span class='op'>=</span> <span class='nam'>sFileOut</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># The globals dict we'll use for this file.</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>353</span> <span class='key'>if</span> <span class='nam'>globals</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>globals</span> <span class='op'>=</span> <span class='op'>{</span><span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># If there are any global defines, put them in the globals.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>globals</span><span class='op'>.</span><span class='nam'>update</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>defines</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># loop over generator chunks</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>while</span> <span class='nam'>l</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Find the next spec begin</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>while</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>361</span> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>364</span> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>l</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>break</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>374</span> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># l is the begin spec</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>gen</span> <span class='op'>=</span> <span class='nam'>CogGenerator</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stdout</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseMarker</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>firstLineNum</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>firstLineNum</span> <span class='op'>=</span> <span class='nam'>firstLineNum</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># If the spec begin is also a spec end, then process the single</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># line of code inside.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>beg</span> <span class='op'>=</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>end</span> <span class='op'>=</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>beg</span> <span class='op'>></span> <span class='nam'>end</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Cog code markers inverted"</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>firstLineNum</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>sCode</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>[</span><span class='nam'>beg</span><span class='op'>+</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>)</span><span class='op'>:</span><span class='nam'>end</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseLine</span><span class='op'>(</span><span class='nam'>sCode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Deal with an ordinary code block.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Get all the lines in the spec</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>while</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>398</span> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>401</span> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>405</span> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>408</span> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>l</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>"Cog block begun but never ended."</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>firstLineNum</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>414</span> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseMarker</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Eat all the lines in the output section. While reading past</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># them, compute the md5 hash of the old output.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>hasher</span> <span class='op'>=</span> <span class='nam'>hash_factory</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>while</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>423</span> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>426</span> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Unexpected '%s'"</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>update</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>curHash</span> <span class='op'>=</span> <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>hexdigest</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>434</span> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bEofCanBeEnd</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># We reached end of file before we found the end output line.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Missing '%s' before end of file."</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Write the output of the spec to be the new output if we're </span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># supposed to generate code.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>hasher</span> <span class='op'>=</span> <span class='nam'>hash_factory</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>446</span> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bNoGenerate</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>sFile</span> <span class='op'>=</span> <span class='str'>"%s+%d"</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>firstLineNum</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>sGen</span> <span class='op'>=</span> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>evaluate</span><span class='op'>(</span><span class='nam'>cog</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>=</span><span class='nam'>globals</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>sFile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>sGen</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>suffixLines</span><span class='op'>(</span><span class='nam'>sGen</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>update</span><span class='op'>(</span><span class='nam'>sGen</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>sGen</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>newHash</span> <span class='op'>=</span> <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>hexdigest</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>bSawCog</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Write the ending output line</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>hashMatch</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>reEndOutput</span><span class='op'>.</span><span class='nam'>search</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>453</span> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bHashOutput</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>hashMatch</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>oldHash</span> <span class='op'>=</span> <span class='nam'>hashMatch</span><span class='op'>.</span><span class='nam'>groupdict</span><span class='op'>(</span><span class='op'>)</span><span class='op'>[</span><span class='str'>'hash'</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>oldHash</span> <span class='op'>!=</span> <span class='nam'>curHash</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Create a new end line with the correct hash.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>endpieces</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>hashMatch</span><span class='op'>.</span><span class='nam'>group</span><span class='op'>(</span><span class='num'>0</span><span class='op'>)</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># There was no old hash, but we want a new hash.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>endpieces</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>l</span> <span class='op'>=</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndFormat</span> <span class='op'>%</span> <span class='nam'>newHash</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>endpieces</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># We don't want hashes output, so if there was one, get rid of</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># it.</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>468</span> <span class='key'>if</span> <span class='nam'>hashMatch</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>hashMatch</span><span class='op'>.</span><span class='nam'>groupdict</span><span class='op'>(</span><span class='op'>)</span><span class='op'>[</span><span class='str'>'hashsect'</span><span class='op'>]</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>472</span> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>475</span> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>bSawCog</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bWarnEmpty</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>showWarning</span><span class='op'>(</span><span class='str'>"no cog code found in %s"</span> <span class='op'>%</span> <span class='nam'>sFileIn</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>478</span> <span class='key'>if</span> <span class='nam'>fInToClose</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>fInToClose</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>480</span> <span class='key'>if</span> <span class='nam'>fOutToClose</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>fOutToClose</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># A regex for non-empty lines, used by suffixLines.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>reNonEmptyLines</span> <span class='op'>=</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>compile</span><span class='op'>(</span><span class='str'>"^\s*\S+.*$"</span><span class='op'>,</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>MULTILINE</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>suffixLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>text</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Add suffixes to the lines in text, if our options desire it.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> text is many lines, as a single string.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>492</span> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sSuffix</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Find all non-blank lines, and add the suffix to the end.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>repl</span> <span class='op'>=</span> <span class='str'>r"\g<0>"</span> <span class='op'>+</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sSuffix</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>'\\'</span><span class='op'>,</span> <span class='str'>'\\\\'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>text</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>reNonEmptyLines</span><span class='op'>.</span><span class='nam'>sub</span><span class='op'>(</span><span class='nam'>repl</span><span class='op'>,</span> <span class='nam'>text</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='nam'>text</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>processString</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sInput</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Process sInput as the text to cog.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Return the cogged output as a string.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>fOld</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>(</span><span class='nam'>sInput</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>fNew</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>fOld</span><span class='op'>,</span> <span class='nam'>fNew</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>fname</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='nam'>fNew</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>replaceFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>sNewText</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Replace file sOldPath with the contents sNewText</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Need to ensure we can write.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Use an external command to make the file writable.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>cmd</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>'%s'</span><span class='op'>,</span> <span class='nam'>sOldPath</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>popen</span><span class='op'>(</span><span class='nam'>cmd</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Couldn't make %s writable"</span> <span class='op'>%</span> <span class='nam'>sOldPath</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Can't write!</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>"Can't overwrite %s"</span> <span class='op'>%</span> <span class='nam'>sOldPath</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>sNewText</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>saveIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedInclude</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span><span class='op'>[</span><span class='op'>:</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedSysPath</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>[</span><span class='op'>:</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>restoreIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedInclude</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>path</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedSysPath</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>includePath</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>extend</span><span class='op'>(</span><span class='nam'>includePath</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>extend</span><span class='op'>(</span><span class='nam'>includePath</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>processOneFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFile</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Process one filename through cog.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>saveIncludePath</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Since we know where the input file came from,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># push its directory onto the include path.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='op'>[</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>dirname</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>)</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Set the file output mode based on whether we want \n or native</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># line endings.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span> <span class='op'>=</span> <span class='str'>'w'</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bNewlines</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span> <span class='op'>=</span> <span class='str'>'wb'</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># How we process the file depends on where the output is going.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>,</span> <span class='nam'>sFile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>elif</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bReplace</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># We want to replace the cog file with the output,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># but only if they differ.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>"Cogging %s"</span> <span class='op'>%</span> <span class='nam'>sFile</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>bNeedNewline</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>fOldFile</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>sOldText</span> <span class='op'>=</span> <span class='nam'>fOldFile</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>fOldFile</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>sNewText</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>sOldText</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>sFile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>sOldText</span> <span class='op'>!=</span> <span class='nam'>sNewText</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>" (changed)"</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>bNeedNewline</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>replaceFile</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>,</span> <span class='nam'>sNewText</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># The try-finally block is so we can print a partial line</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># with the name of the file, and print (changed) on the</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># same line, but also make sure to break the line before</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># any traceback.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>bNeedNewline</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='nam'>sFile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>restoreIncludePath</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>processFileList</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFileList</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Process the files in a file list.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>flist</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sFileList</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>lines</span> <span class='op'>=</span> <span class='nam'>flist</span><span class='op'>.</span><span class='nam'>readlines</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>flist</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>lines</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Use shlex to parse the line like a shell.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>lex</span> <span class='op'>=</span> <span class='nam'>shlex</span><span class='op'>.</span><span class='nam'>shlex</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>,</span> <span class='nam'>posix</span><span class='op'>=</span><span class='nam'>True</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>lex</span><span class='op'>.</span><span class='nam'>whitespace_split</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>lex</span><span class='op'>.</span><span class='nam'>commenters</span> <span class='op'>=</span> <span class='str'>'#'</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># No escapes, so that backslash can be part of the path</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>lex</span><span class='op'>.</span><span class='nam'>escape</span> <span class='op'>=</span> <span class='str'>''</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>args</span> <span class='op'>=</span> <span class='nam'>list</span><span class='op'>(</span><span class='nam'>lex</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>args</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processArguments</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>processArguments</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>args</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Process one command-line.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>saved_options</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>clone</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>[</span><span class='num'>1</span><span class='op'>:</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>validate</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>args</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span> <span class='op'>==</span> <span class='str'>'@'</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>"Can't use -o with @file"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFileList</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>[</span><span class='num'>1</span><span class='op'>:</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processOneFile</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span> <span class='op'>=</span> <span class='nam'>saved_options</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>callableMain</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>argv</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" All of command-line cog, but in a callable form.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is used by main.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> argv is the equivalent of sys.argv.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>argv0</span> <span class='op'>=</span> <span class='nam'>argv</span><span class='op'>.</span><span class='nam'>pop</span><span class='op'>(</span><span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Provide help if asked for anywhere in the command line.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='str'>'-?'</span> <span class='key'>in</span> <span class='nam'>argv</span> <span class='key'>or</span> <span class='str'>'-h'</span> <span class='key'>in</span> <span class='nam'>argv</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='nam'>usage</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>validate</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bShowVersion</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>"Cog version %s"</span> <span class='op'>%</span> <span class='nam'>__version__</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>args</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>a</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>args</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processArguments</span><span class='op'>(</span><span class='op'>[</span><span class='nam'>a</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>"No files to process"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>main</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>argv</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Handle the command-line execution for cog.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='num'>0</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>except</span> <span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='nam'>err</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='str'>"(for help use -?)"</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='num'>2</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>except</span> <span class='nam'>CogGeneratedError</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='str'>"Error: %s"</span> <span class='op'>%</span> <span class='nam'>err</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='num'>3</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>except</span> <span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>print</span> <span class='op'>>></span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='nam'>err</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='num'>1</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>except</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>traceback</span><span class='op'>.</span><span class='nam'>print_exc</span><span class='op'>(</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='num'>1</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='com'># History:</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20040210: First public version.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20040220: Text preceding the start and end marker are removed from Python lines.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># -v option on the command line shows the version.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20040311: Make sure the last line of output is properly ended with a newline.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20040605: Fixed some blank line handling in cog.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Fixed problems with assigning to xml elements in handyxml.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20040621: Changed all line-ends to LF from CRLF.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20041002: Refactor some option handling to simplify unittesting the options.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20041118: cog.out and cog.outl have optional string arguments.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20041119: File names weren't being properly passed around for warnings, etc.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20041122: Added cog.firstLineNum: a property with the line number of the [[[cog line.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Added cog.inFile and cog.outFile: the names of the input and output file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20041218: Single-line cog generators, with start marker and end marker on</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># the same line.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20041230: Keep a single globals dict for all the code fragments in a single</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># file so they can share state.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050206: Added the -x switch to remove all generated output.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050218: Now code can be on the marker lines as well.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050219: Added -c switch to checksum the output so that edits can be</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># detected before they are obliterated.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050521: Added cog.error, contributed by Alexander Belchenko.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050720: Added code deletion and settable globals contributed by Blake Winton.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050724: Many tweaks to improve code coverage.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050726: Error messages are now printed with no traceback.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Code can no longer appear on the marker lines,</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># except for single-line style.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># -z allows omission of the [[[end]]] marker, and it will be assumed</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># at the end of the file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050729: Refactor option parsing into a separate class, in preparation for</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># future features.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050805: The cogmodule.path wasn't being properly maintained.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050808: Added the -D option to define a global value.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050810: The %s in the -w command is dealt with more robustly.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Added the -s option to suffix output lines with a marker.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20050817: Now @files can have arguments on each line to change the cog's</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># behavior for that line.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20051006: Version 2.0</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20080521: -U options lets you create Unix newlines on Windows. Thanks,</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Alexander Belchenko.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20080522: It's now ok to have -d with output to stdout, and now we validate</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># the args after each line of an @file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># 20090520: Use hashlib where it's available, to avoid a warning.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Use the builtin compile() instead of compiler, for Jython.</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Explicitly close files we opened, Jython likes this.</span><span class='strut'> </span></p>
</td>
</tr>
diff --git a/doc/sample_html/cogapp_makefiles.html b/doc/sample_html/cogapp_makefiles.html index 4d50521..8dfb26b 100644 --- a/doc/sample_html/cogapp_makefiles.html +++ b/doc/sample_html/cogapp_makefiles.html @@ -1,19 +1,21 @@ -<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
+<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Coverage for cogapp\makefiles</title>
<link rel='stylesheet' href='style.css' type='text/css'>
-<script src='jquery-1.3.2.min.js'></script>
-<script>
+<script type='text/javascript' src='jquery-1.3.2.min.js'></script>
+<script type='text/javascript'>
function toggle_lines(btn, cls) {
var btn = $(btn);
- if (btn.hasClass("hide")) {
- $("#source ."+cls).removeClass("hide");
- btn.removeClass("hide");
+ var hide = "hide_"+cls;
+ if (btn.hasClass(hide)) {
+ $("#source ."+cls).removeClass(hide);
+ btn.removeClass(hide);
}
else {
- $("#source ."+cls).addClass("hide");
- btn.addClass("hide");
+ $("#source ."+cls).addClass(hide);
+ btn.addClass(hide);
}
}
</script>
@@ -22,13 +24,16 @@ function toggle_lines(btn, cls) { <div id='header'>
<div class='content'>
<h1>Coverage for <b>cogapp\makefiles</b> :
- <span class='pc_cov'>21%</span>
+ <span class='pc_cov'>13%</span>
</h1>
<h2 class='stats'>
29 statements
- <span class='run hide' onclick='toggle_lines(this, "run")'>6 run</span>
+ <span class='run hide_run' onclick='toggle_lines(this, "run")'>6 run</span>
<span class='exc' onclick='toggle_lines(this, "exc")'>3 excluded</span>
<span class='mis' onclick='toggle_lines(this, "mis")'>23 missing</span>
+
+ <span class='par run hide_run' onclick='toggle_lines(this, "par")'>0 partial</span>
+
</h2>
</div>
</div>
@@ -43,13 +48,13 @@ function toggle_lines(btn, cls) { <p class='pln'>4</p>
<p class='pln'>5</p>
<p class='pln'>6</p>
-<p class='stm run hide'>7</p>
-<p class='stm run hide'>8</p>
+<p class='stm run hide_run'>7</p>
+<p class='stm run hide_run'>8</p>
<p class='pln'>9</p>
-<p class='stm run hide'>10</p>
-<p class='stm run hide'>11</p>
+<p class='stm run hide_run'>10</p>
+<p class='stm run hide_run'>11</p>
<p class='pln'>12</p>
-<p class='stm run hide'>13</p>
+<p class='stm run hide_run'>13</p>
<p class='pln'>14</p>
<p class='pln'>15</p>
<p class='stm mis'>16</p>
@@ -69,7 +74,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>30</p>
<p class='stm mis'>31</p>
<p class='pln'>32</p>
-<p class='stm run hide'>33</p>
+<p class='stm run hide_run'>33</p>
<p class='pln'>34</p>
<p class='pln'>35</p>
<p class='pln'>36</p>
@@ -104,70 +109,70 @@ function toggle_lines(btn, cls) { </td>
<td class='text' valign='top'>
-<p class='pln'><span class='str'>""" Dictionary-to-filetree functions, to create test files for testing.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> http://nedbatchelder.com/code/cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Copyright 2004-2009, Ned Batchelder.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>"""</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>import</span> <span class='nam'>path</span> <span class='com'># Non-standard, from http://www.jorendorff.com/articles/python/path</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>from</span> <span class='nam'>whiteutils</span> <span class='key'>import</span> <span class='nam'>reindentBlock</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='nam'>__version__</span> <span class='op'>=</span> <span class='str'>'1.0.20040126'</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='nam'>__all__</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'makeFiles'</span><span class='op'>,</span> <span class='str'>'removeFiles'</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>def</span> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>,</span> <span class='nam'>basedir</span><span class='op'>=</span><span class='str'>'.'</span><span class='op'>,</span> <span class='nam'>raw</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Create files from the dictionary d, in the directory named by dirpath.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>dirpath</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>(</span><span class='nam'>basedir</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>name</span><span class='op'>,</span> <span class='nam'>contents</span> <span class='key'>in</span> <span class='nam'>d</span><span class='op'>.</span><span class='nam'>items</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>dirpath</span> <span class='op'>/</span> <span class='nam'>name</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'w'</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>raw</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'wb'</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>child</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>raw</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>contents</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>exists</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>mkdir</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>child</span><span class='op'>,</span> <span class='nam'>raw</span><span class='op'>=</span><span class='nam'>raw</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>def</span> <span class='nam'>removeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>,</span> <span class='nam'>basedir</span><span class='op'>=</span><span class='str'>'.'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Remove the files created by makeFiles.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Directories are removed if they are empty.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>dirpath</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>(</span><span class='nam'>basedir</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>name</span><span class='op'>,</span> <span class='nam'>contents</span> <span class='key'>in</span> <span class='nam'>d</span><span class='op'>.</span><span class='nam'>items</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>dirpath</span> <span class='op'>/</span> <span class='nam'>name</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>remove</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>removeFiles</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>child</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>files</span><span class='op'>(</span><span class='op'>)</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>dirs</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>rmdir</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='exc'><span class='key'>if</span> <span class='nam'>__name__</span> <span class='op'>==</span> <span class='str'>'__main__'</span><span class='op'>:</span> <span class='com'>#pragma: no cover</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Try it a little.</span><span class="strut"> </span></p>
-<p class='exc'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test_makefiles'</span><span class='op'>:</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'hey.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is hey.txt.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> It's very simple.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'subdir'</span><span class='op'>:</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'fooey'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> # Fooey</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Kablooey</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Ew.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='exc'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
+<p class='pln'><span class='str'>""" Dictionary-to-filetree functions, to create test files for testing.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> http://nedbatchelder.com/code/cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Copyright 2004-2009, Ned Batchelder.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>"""</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>path</span> <span class='com'># Non-standard, from http://www.jorendorff.com/articles/python/path</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>from</span> <span class='nam'>whiteutils</span> <span class='key'>import</span> <span class='nam'>reindentBlock</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='nam'>__version__</span> <span class='op'>=</span> <span class='str'>'1.0.20040126'</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='nam'>__all__</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'makeFiles'</span><span class='op'>,</span> <span class='str'>'removeFiles'</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>,</span> <span class='nam'>basedir</span><span class='op'>=</span><span class='str'>'.'</span><span class='op'>,</span> <span class='nam'>raw</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Create files from the dictionary d, in the directory named by dirpath.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>dirpath</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>(</span><span class='nam'>basedir</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>name</span><span class='op'>,</span> <span class='nam'>contents</span> <span class='key'>in</span> <span class='nam'>d</span><span class='op'>.</span><span class='nam'>items</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>dirpath</span> <span class='op'>/</span> <span class='nam'>name</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'w'</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>raw</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>'wb'</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>child</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>raw</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>contents</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>exists</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>mkdir</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>child</span><span class='op'>,</span> <span class='nam'>raw</span><span class='op'>=</span><span class='nam'>raw</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>removeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>,</span> <span class='nam'>basedir</span><span class='op'>=</span><span class='str'>'.'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Remove the files created by makeFiles.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Directories are removed if they are empty.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>dirpath</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>(</span><span class='nam'>basedir</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>name</span><span class='op'>,</span> <span class='nam'>contents</span> <span class='key'>in</span> <span class='nam'>d</span><span class='op'>.</span><span class='nam'>items</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>dirpath</span> <span class='op'>/</span> <span class='nam'>name</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>remove</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>removeFiles</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>child</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>files</span><span class='op'>(</span><span class='op'>)</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>dirs</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>rmdir</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='exc'><span class='key'>if</span> <span class='nam'>__name__</span> <span class='op'>==</span> <span class='str'>'__main__'</span><span class='op'>:</span> <span class='com'>#pragma: no cover</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Try it a little.</span><span class='strut'> </span></p>
+<p class='exc'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test_makefiles'</span><span class='op'>:</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'hey.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is hey.txt.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> It's very simple.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'subdir'</span><span class='op'>:</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'fooey'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> # Fooey</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Kablooey</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Ew.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='exc'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
</td>
</tr>
diff --git a/doc/sample_html/cogapp_test_cogapp.html b/doc/sample_html/cogapp_test_cogapp.html index 23355ae..2efc88e 100644 --- a/doc/sample_html/cogapp_test_cogapp.html +++ b/doc/sample_html/cogapp_test_cogapp.html @@ -1,19 +1,21 @@ -<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
+<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Coverage for cogapp\test_cogapp</title>
<link rel='stylesheet' href='style.css' type='text/css'>
-<script src='jquery-1.3.2.min.js'></script>
-<script>
+<script type='text/javascript' src='jquery-1.3.2.min.js'></script>
+<script type='text/javascript'>
function toggle_lines(btn, cls) {
var btn = $(btn);
- if (btn.hasClass("hide")) {
- $("#source ."+cls).removeClass("hide");
- btn.removeClass("hide");
+ var hide = "hide_"+cls;
+ if (btn.hasClass(hide)) {
+ $("#source ."+cls).removeClass(hide);
+ btn.removeClass(hide);
}
else {
- $("#source ."+cls).addClass("hide");
- btn.addClass("hide");
+ $("#source ."+cls).addClass(hide);
+ btn.addClass(hide);
}
}
</script>
@@ -26,9 +28,12 @@ function toggle_lines(btn, cls) { </h1>
<h2 class='stats'>
587 statements
- <span class='run hide' onclick='toggle_lines(this, "run")'>195 run</span>
+ <span class='run hide_run' onclick='toggle_lines(this, "run")'>195 run</span>
<span class='exc' onclick='toggle_lines(this, "exc")'>17 excluded</span>
<span class='mis' onclick='toggle_lines(this, "mis")'>392 missing</span>
+
+ <span class='par run hide_run' onclick='toggle_lines(this, "par")'>0 partial</span>
+
</h2>
</div>
</div>
@@ -43,32 +48,32 @@ function toggle_lines(btn, cls) { <p class='pln'>4</p>
<p class='pln'>5</p>
<p class='pln'>6</p>
-<p class='stm run hide'>7</p>
-<p class='stm run hide'>8</p>
-<p class='stm run hide'>9</p>
-<p class='stm run hide'>10</p>
-<p class='stm run hide'>11</p>
-<p class='stm run hide'>12</p>
-<p class='stm run hide'>13</p>
-<p class='stm run hide'>14</p>
+<p class='stm run hide_run'>7</p>
+<p class='stm run hide_run'>8</p>
+<p class='stm run hide_run'>9</p>
+<p class='stm run hide_run'>10</p>
+<p class='stm run hide_run'>11</p>
+<p class='stm run hide_run'>12</p>
+<p class='stm run hide_run'>13</p>
+<p class='stm run hide_run'>14</p>
<p class='pln'>15</p>
-<p class='stm run hide'>16</p>
+<p class='stm run hide_run'>16</p>
<p class='pln'>17</p>
<p class='pln'>18</p>
-<p class='stm run hide'>19</p>
+<p class='stm run hide_run'>19</p>
<p class='pln'>20</p>
<p class='pln'>21</p>
<p class='pln'>22</p>
-<p class='stm run hide'>23</p>
-<p class='stm run hide'>24</p>
-<p class='stm run hide'>25</p>
-<p class='stm run hide'>26</p>
-<p class='stm run hide'>27</p>
+<p class='stm run hide_run'>23</p>
+<p class='stm run hide_run'>24</p>
+<p class='stm run hide_run'>25</p>
+<p class='stm run hide_run'>26</p>
+<p class='stm run hide_run'>27</p>
<p class='pln'>28</p>
<p class='exc'>29</p>
-<p class='stm run hide'>30</p>
+<p class='stm run hide_run'>30</p>
<p class='pln'>31</p>
-<p class='stm run hide'>32</p>
+<p class='stm run hide_run'>32</p>
<p class='exc'>33</p>
<p class='pln'>34</p>
<p class='exc'>35</p>
@@ -79,12 +84,12 @@ function toggle_lines(btn, cls) { <p class='exc'>40</p>
<p class='exc'>41</p>
<p class='pln'>42</p>
-<p class='stm run hide'>43</p>
+<p class='stm run hide_run'>43</p>
<p class='pln'>44</p>
<p class='pln'>45</p>
<p class='pln'>46</p>
-<p class='stm run hide'>47</p>
-<p class='stm run hide'>48</p>
+<p class='stm run hide_run'>47</p>
+<p class='stm run hide_run'>48</p>
<p class='pln'>49</p>
<p class='pln'>50</p>
<p class='pln'>51</p>
@@ -92,11 +97,11 @@ function toggle_lines(btn, cls) { <p class='pln'>53</p>
<p class='pln'>54</p>
<p class='pln'>55</p>
-<p class='stm run hide'>56</p>
-<p class='stm run hide'>57</p>
+<p class='stm run hide_run'>56</p>
+<p class='stm run hide_run'>57</p>
<p class='pln'>58</p>
-<p class='stm run hide'>59</p>
-<p class='stm run hide'>60</p>
+<p class='stm run hide_run'>59</p>
+<p class='stm run hide_run'>60</p>
<p class='pln'>61</p>
<p class='pln'>62</p>
<p class='pln'>63</p>
@@ -108,7 +113,7 @@ function toggle_lines(btn, cls) { <p class='pln'>69</p>
<p class='pln'>70</p>
<p class='pln'>71</p>
-<p class='stm run hide'>72</p>
+<p class='stm run hide_run'>72</p>
<p class='pln'>73</p>
<p class='pln'>74</p>
<p class='pln'>75</p>
@@ -122,12 +127,12 @@ function toggle_lines(btn, cls) { <p class='pln'>83</p>
<p class='pln'>84</p>
<p class='pln'>85</p>
-<p class='stm run hide'>86</p>
+<p class='stm run hide_run'>86</p>
<p class='pln'>87</p>
-<p class='stm run hide'>88</p>
+<p class='stm run hide_run'>88</p>
<p class='pln'>89</p>
<p class='pln'>90</p>
-<p class='stm run hide'>91</p>
+<p class='stm run hide_run'>91</p>
<p class='pln'>92</p>
<p class='pln'>93</p>
<p class='pln'>94</p>
@@ -135,12 +140,12 @@ function toggle_lines(btn, cls) { <p class='pln'>96</p>
<p class='pln'>97</p>
<p class='pln'>98</p>
-<p class='stm run hide'>99</p>
-<p class='stm run hide'>100</p>
+<p class='stm run hide_run'>99</p>
+<p class='stm run hide_run'>100</p>
<p class='pln'>101</p>
-<p class='stm run hide'>102</p>
+<p class='stm run hide_run'>102</p>
<p class='pln'>103</p>
-<p class='stm run hide'>104</p>
+<p class='stm run hide_run'>104</p>
<p class='pln'>105</p>
<p class='pln'>106</p>
<p class='pln'>107</p>
@@ -159,11 +164,11 @@ function toggle_lines(btn, cls) { <p class='pln'>120</p>
<p class='pln'>121</p>
<p class='pln'>122</p>
-<p class='stm run hide'>123</p>
-<p class='stm run hide'>124</p>
+<p class='stm run hide_run'>123</p>
+<p class='stm run hide_run'>124</p>
<p class='pln'>125</p>
-<p class='stm run hide'>126</p>
-<p class='stm run hide'>127</p>
+<p class='stm run hide_run'>126</p>
+<p class='stm run hide_run'>127</p>
<p class='pln'>128</p>
<p class='pln'>129</p>
<p class='pln'>130</p>
@@ -177,11 +182,11 @@ function toggle_lines(btn, cls) { <p class='pln'>138</p>
<p class='pln'>139</p>
<p class='pln'>140</p>
-<p class='stm run hide'>141</p>
-<p class='stm run hide'>142</p>
+<p class='stm run hide_run'>141</p>
+<p class='stm run hide_run'>142</p>
<p class='pln'>143</p>
-<p class='stm run hide'>144</p>
-<p class='stm run hide'>145</p>
+<p class='stm run hide_run'>144</p>
+<p class='stm run hide_run'>145</p>
<p class='pln'>146</p>
<p class='pln'>147</p>
<p class='pln'>148</p>
@@ -196,13 +201,13 @@ function toggle_lines(btn, cls) { <p class='pln'>157</p>
<p class='pln'>158</p>
<p class='pln'>159</p>
-<p class='stm run hide'>160</p>
-<p class='stm run hide'>161</p>
+<p class='stm run hide_run'>160</p>
+<p class='stm run hide_run'>161</p>
<p class='pln'>162</p>
-<p class='stm run hide'>163</p>
+<p class='stm run hide_run'>163</p>
<p class='pln'>164</p>
<p class='pln'>165</p>
-<p class='stm run hide'>166</p>
+<p class='stm run hide_run'>166</p>
<p class='pln'>167</p>
<p class='pln'>168</p>
<p class='pln'>169</p>
@@ -214,11 +219,11 @@ function toggle_lines(btn, cls) { <p class='pln'>175</p>
<p class='pln'>176</p>
<p class='pln'>177</p>
-<p class='stm run hide'>178</p>
-<p class='stm run hide'>179</p>
+<p class='stm run hide_run'>178</p>
+<p class='stm run hide_run'>179</p>
<p class='pln'>180</p>
-<p class='stm run hide'>181</p>
-<p class='stm run hide'>182</p>
+<p class='stm run hide_run'>181</p>
+<p class='stm run hide_run'>182</p>
<p class='pln'>183</p>
<p class='pln'>184</p>
<p class='pln'>185</p>
@@ -232,11 +237,11 @@ function toggle_lines(btn, cls) { <p class='pln'>193</p>
<p class='pln'>194</p>
<p class='pln'>195</p>
-<p class='stm run hide'>196</p>
-<p class='stm run hide'>197</p>
+<p class='stm run hide_run'>196</p>
+<p class='stm run hide_run'>197</p>
<p class='pln'>198</p>
-<p class='stm run hide'>199</p>
-<p class='stm run hide'>200</p>
+<p class='stm run hide_run'>199</p>
+<p class='stm run hide_run'>200</p>
<p class='pln'>201</p>
<p class='pln'>202</p>
<p class='pln'>203</p>
@@ -248,11 +253,11 @@ function toggle_lines(btn, cls) { <p class='pln'>209</p>
<p class='pln'>210</p>
<p class='pln'>211</p>
-<p class='stm run hide'>212</p>
-<p class='stm run hide'>213</p>
+<p class='stm run hide_run'>212</p>
+<p class='stm run hide_run'>213</p>
<p class='pln'>214</p>
-<p class='stm run hide'>215</p>
-<p class='stm run hide'>216</p>
+<p class='stm run hide_run'>215</p>
+<p class='stm run hide_run'>216</p>
<p class='pln'>217</p>
<p class='pln'>218</p>
<p class='pln'>219</p>
@@ -265,11 +270,11 @@ function toggle_lines(btn, cls) { <p class='pln'>226</p>
<p class='pln'>227</p>
<p class='pln'>228</p>
-<p class='stm run hide'>229</p>
-<p class='stm run hide'>230</p>
+<p class='stm run hide_run'>229</p>
+<p class='stm run hide_run'>230</p>
<p class='pln'>231</p>
-<p class='stm run hide'>232</p>
-<p class='stm run hide'>233</p>
+<p class='stm run hide_run'>232</p>
+<p class='stm run hide_run'>233</p>
<p class='pln'>234</p>
<p class='pln'>235</p>
<p class='pln'>236</p>
@@ -283,13 +288,13 @@ function toggle_lines(btn, cls) { <p class='pln'>244</p>
<p class='pln'>245</p>
<p class='pln'>246</p>
-<p class='stm run hide'>247</p>
-<p class='stm run hide'>248</p>
+<p class='stm run hide_run'>247</p>
+<p class='stm run hide_run'>248</p>
<p class='pln'>249</p>
-<p class='stm run hide'>250</p>
+<p class='stm run hide_run'>250</p>
<p class='pln'>251</p>
<p class='pln'>252</p>
-<p class='stm run hide'>253</p>
+<p class='stm run hide_run'>253</p>
<p class='pln'>254</p>
<p class='pln'>255</p>
<p class='pln'>256</p>
@@ -301,12 +306,12 @@ function toggle_lines(btn, cls) { <p class='pln'>262</p>
<p class='pln'>263</p>
<p class='pln'>264</p>
-<p class='stm run hide'>265</p>
-<p class='stm run hide'>266</p>
+<p class='stm run hide_run'>265</p>
+<p class='stm run hide_run'>266</p>
<p class='pln'>267</p>
-<p class='stm run hide'>268</p>
+<p class='stm run hide_run'>268</p>
<p class='pln'>269</p>
-<p class='stm run hide'>270</p>
+<p class='stm run hide_run'>270</p>
<p class='pln'>271</p>
<p class='pln'>272</p>
<p class='pln'>273</p>
@@ -315,14 +320,14 @@ function toggle_lines(btn, cls) { <p class='pln'>276</p>
<p class='pln'>277</p>
<p class='pln'>278</p>
-<p class='stm run hide'>279</p>
-<p class='stm run hide'>280</p>
+<p class='stm run hide_run'>279</p>
+<p class='stm run hide_run'>280</p>
<p class='pln'>281</p>
-<p class='stm run hide'>282</p>
+<p class='stm run hide_run'>282</p>
<p class='pln'>283</p>
<p class='pln'>284</p>
<p class='pln'>285</p>
-<p class='stm run hide'>286</p>
+<p class='stm run hide_run'>286</p>
<p class='pln'>287</p>
<p class='pln'>288</p>
<p class='pln'>289</p>
@@ -335,14 +340,14 @@ function toggle_lines(btn, cls) { <p class='pln'>296</p>
<p class='pln'>297</p>
<p class='pln'>298</p>
-<p class='stm run hide'>299</p>
-<p class='stm run hide'>300</p>
+<p class='stm run hide_run'>299</p>
+<p class='stm run hide_run'>300</p>
<p class='pln'>301</p>
-<p class='stm run hide'>302</p>
+<p class='stm run hide_run'>302</p>
<p class='pln'>303</p>
<p class='pln'>304</p>
<p class='pln'>305</p>
-<p class='stm run hide'>306</p>
+<p class='stm run hide_run'>306</p>
<p class='pln'>307</p>
<p class='pln'>308</p>
<p class='pln'>309</p>
@@ -360,11 +365,11 @@ function toggle_lines(btn, cls) { <p class='pln'>321</p>
<p class='pln'>322</p>
<p class='pln'>323</p>
-<p class='stm run hide'>324</p>
-<p class='stm run hide'>325</p>
+<p class='stm run hide_run'>324</p>
+<p class='stm run hide_run'>325</p>
<p class='pln'>326</p>
-<p class='stm run hide'>327</p>
-<p class='stm run hide'>328</p>
+<p class='stm run hide_run'>327</p>
+<p class='stm run hide_run'>328</p>
<p class='pln'>329</p>
<p class='pln'>330</p>
<p class='pln'>331</p>
@@ -379,11 +384,11 @@ function toggle_lines(btn, cls) { <p class='pln'>340</p>
<p class='pln'>341</p>
<p class='pln'>342</p>
-<p class='stm run hide'>343</p>
-<p class='stm run hide'>344</p>
+<p class='stm run hide_run'>343</p>
+<p class='stm run hide_run'>344</p>
<p class='pln'>345</p>
-<p class='stm run hide'>346</p>
-<p class='stm run hide'>347</p>
+<p class='stm run hide_run'>346</p>
+<p class='stm run hide_run'>347</p>
<p class='pln'>348</p>
<p class='pln'>349</p>
<p class='pln'>350</p>
@@ -391,7 +396,7 @@ function toggle_lines(btn, cls) { <p class='pln'>352</p>
<p class='pln'>353</p>
<p class='pln'>354</p>
-<p class='stm run hide'>355</p>
+<p class='stm run hide_run'>355</p>
<p class='pln'>356</p>
<p class='pln'>357</p>
<p class='pln'>358</p>
@@ -399,24 +404,24 @@ function toggle_lines(btn, cls) { <p class='pln'>360</p>
<p class='pln'>361</p>
<p class='pln'>362</p>
-<p class='stm run hide'>363</p>
-<p class='stm run hide'>364</p>
+<p class='stm run hide_run'>363</p>
+<p class='stm run hide_run'>364</p>
<p class='pln'>365</p>
-<p class='stm run hide'>366</p>
-<p class='stm run hide'>367</p>
+<p class='stm run hide_run'>366</p>
+<p class='stm run hide_run'>367</p>
<p class='pln'>368</p>
<p class='pln'>369</p>
<p class='pln'>370</p>
<p class='pln'>371</p>
<p class='pln'>372</p>
<p class='pln'>373</p>
-<p class='stm run hide'>374</p>
+<p class='stm run hide_run'>374</p>
<p class='pln'>375</p>
<p class='pln'>376</p>
<p class='pln'>377</p>
<p class='pln'>378</p>
-<p class='stm run hide'>379</p>
-<p class='stm run hide'>380</p>
+<p class='stm run hide_run'>379</p>
+<p class='stm run hide_run'>380</p>
<p class='pln'>381</p>
<p class='pln'>382</p>
<p class='pln'>383</p>
@@ -426,7 +431,7 @@ function toggle_lines(btn, cls) { <p class='pln'>387</p>
<p class='pln'>388</p>
<p class='pln'>389</p>
-<p class='stm run hide'>390</p>
+<p class='stm run hide_run'>390</p>
<p class='pln'>391</p>
<p class='pln'>392</p>
<p class='pln'>393</p>
@@ -437,14 +442,14 @@ function toggle_lines(btn, cls) { <p class='pln'>398</p>
<p class='pln'>399</p>
<p class='pln'>400</p>
-<p class='stm run hide'>401</p>
-<p class='stm run hide'>402</p>
+<p class='stm run hide_run'>401</p>
+<p class='stm run hide_run'>402</p>
<p class='pln'>403</p>
-<p class='stm run hide'>404</p>
+<p class='stm run hide_run'>404</p>
<p class='pln'>405</p>
<p class='pln'>406</p>
<p class='pln'>407</p>
-<p class='stm run hide'>408</p>
+<p class='stm run hide_run'>408</p>
<p class='stm mis'>409</p>
<p class='stm mis'>410</p>
<p class='stm mis'>411</p>
@@ -453,7 +458,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>414</p>
<p class='stm mis'>415</p>
<p class='pln'>416</p>
-<p class='stm run hide'>417</p>
+<p class='stm run hide_run'>417</p>
<p class='stm mis'>418</p>
<p class='stm mis'>419</p>
<p class='stm mis'>420</p>
@@ -464,7 +469,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>425</p>
<p class='stm mis'>426</p>
<p class='pln'>427</p>
-<p class='stm run hide'>428</p>
+<p class='stm run hide_run'>428</p>
<p class='pln'>429</p>
<p class='stm mis'>430</p>
<p class='stm mis'>431</p>
@@ -472,18 +477,18 @@ function toggle_lines(btn, cls) { <p class='stm mis'>433</p>
<p class='stm mis'>434</p>
<p class='pln'>435</p>
-<p class='stm run hide'>436</p>
+<p class='stm run hide_run'>436</p>
<p class='pln'>437</p>
<p class='pln'>438</p>
<p class='pln'>439</p>
<p class='pln'>440</p>
-<p class='stm run hide'>441</p>
+<p class='stm run hide_run'>441</p>
<p class='stm mis'>442</p>
<p class='stm mis'>443</p>
<p class='pln'>444</p>
<p class='pln'>445</p>
<p class='pln'>446</p>
-<p class='stm run hide'>447</p>
+<p class='stm run hide_run'>447</p>
<p class='stm mis'>448</p>
<p class='pln'>449</p>
<p class='pln'>450</p>
@@ -491,7 +496,7 @@ function toggle_lines(btn, cls) { <p class='pln'>452</p>
<p class='stm mis'>453</p>
<p class='pln'>454</p>
-<p class='stm run hide'>455</p>
+<p class='stm run hide_run'>455</p>
<p class='stm mis'>456</p>
<p class='pln'>457</p>
<p class='pln'>458</p>
@@ -511,7 +516,7 @@ function toggle_lines(btn, cls) { <p class='pln'>472</p>
<p class='stm mis'>473</p>
<p class='pln'>474</p>
-<p class='stm run hide'>475</p>
+<p class='stm run hide_run'>475</p>
<p class='stm mis'>476</p>
<p class='pln'>477</p>
<p class='pln'>478</p>
@@ -526,7 +531,7 @@ function toggle_lines(btn, cls) { <p class='pln'>487</p>
<p class='stm mis'>488</p>
<p class='pln'>489</p>
-<p class='stm run hide'>490</p>
+<p class='stm run hide_run'>490</p>
<p class='stm mis'>491</p>
<p class='pln'>492</p>
<p class='pln'>493</p>
@@ -541,7 +546,7 @@ function toggle_lines(btn, cls) { <p class='pln'>502</p>
<p class='stm mis'>503</p>
<p class='pln'>504</p>
-<p class='stm run hide'>505</p>
+<p class='stm run hide_run'>505</p>
<p class='stm mis'>506</p>
<p class='pln'>507</p>
<p class='pln'>508</p>
@@ -560,7 +565,7 @@ function toggle_lines(btn, cls) { <p class='pln'>521</p>
<p class='stm mis'>522</p>
<p class='pln'>523</p>
-<p class='stm run hide'>524</p>
+<p class='stm run hide_run'>524</p>
<p class='stm mis'>525</p>
<p class='pln'>526</p>
<p class='pln'>527</p>
@@ -583,7 +588,7 @@ function toggle_lines(btn, cls) { <p class='pln'>544</p>
<p class='stm mis'>545</p>
<p class='pln'>546</p>
-<p class='stm run hide'>547</p>
+<p class='stm run hide_run'>547</p>
<p class='stm mis'>548</p>
<p class='pln'>549</p>
<p class='pln'>550</p>
@@ -606,11 +611,11 @@ function toggle_lines(btn, cls) { <p class='pln'>567</p>
<p class='stm mis'>568</p>
<p class='pln'>569</p>
-<p class='stm run hide'>570</p>
+<p class='stm run hide_run'>570</p>
<p class='pln'>571</p>
<p class='pln'>572</p>
<p class='pln'>573</p>
-<p class='stm run hide'>574</p>
+<p class='stm run hide_run'>574</p>
<p class='stm mis'>575</p>
<p class='pln'>576</p>
<p class='pln'>577</p>
@@ -621,7 +626,7 @@ function toggle_lines(btn, cls) { <p class='pln'>582</p>
<p class='pln'>583</p>
<p class='pln'>584</p>
-<p class='stm run hide'>585</p>
+<p class='stm run hide_run'>585</p>
<p class='stm mis'>586</p>
<p class='pln'>587</p>
<p class='pln'>588</p>
@@ -632,7 +637,7 @@ function toggle_lines(btn, cls) { <p class='pln'>593</p>
<p class='pln'>594</p>
<p class='pln'>595</p>
-<p class='stm run hide'>596</p>
+<p class='stm run hide_run'>596</p>
<p class='stm mis'>597</p>
<p class='pln'>598</p>
<p class='pln'>599</p>
@@ -650,12 +655,12 @@ function toggle_lines(btn, cls) { <p class='stm mis'>611</p>
<p class='stm mis'>612</p>
<p class='pln'>613</p>
-<p class='stm run hide'>614</p>
+<p class='stm run hide_run'>614</p>
<p class='pln'>615</p>
<p class='pln'>616</p>
<p class='pln'>617</p>
<p class='pln'>618</p>
-<p class='stm run hide'>619</p>
+<p class='stm run hide_run'>619</p>
<p class='pln'>620</p>
<p class='pln'>621</p>
<p class='pln'>622</p>
@@ -663,19 +668,19 @@ function toggle_lines(btn, cls) { <p class='stm mis'>624</p>
<p class='stm mis'>625</p>
<p class='pln'>626</p>
-<p class='stm run hide'>627</p>
+<p class='stm run hide_run'>627</p>
<p class='stm mis'>628</p>
<p class='stm mis'>629</p>
<p class='stm mis'>630</p>
<p class='pln'>631</p>
-<p class='stm run hide'>632</p>
+<p class='stm run hide_run'>632</p>
<p class='stm mis'>633</p>
<p class='stm mis'>634</p>
<p class='stm mis'>635</p>
<p class='stm mis'>636</p>
<p class='stm mis'>637</p>
<p class='pln'>638</p>
-<p class='stm run hide'>639</p>
+<p class='stm run hide_run'>639</p>
<p class='pln'>640</p>
<p class='stm mis'>641</p>
<p class='stm mis'>642</p>
@@ -683,7 +688,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>644</p>
<p class='stm mis'>645</p>
<p class='pln'>646</p>
-<p class='stm run hide'>647</p>
+<p class='stm run hide_run'>647</p>
<p class='pln'>648</p>
<p class='stm mis'>649</p>
<p class='stm mis'>650</p>
@@ -691,7 +696,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>652</p>
<p class='stm mis'>653</p>
<p class='pln'>654</p>
-<p class='stm run hide'>655</p>
+<p class='stm run hide_run'>655</p>
<p class='pln'>656</p>
<p class='stm mis'>657</p>
<p class='stm mis'>658</p>
@@ -699,7 +704,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>660</p>
<p class='stm mis'>661</p>
<p class='pln'>662</p>
-<p class='stm run hide'>663</p>
+<p class='stm run hide_run'>663</p>
<p class='pln'>664</p>
<p class='stm mis'>665</p>
<p class='stm mis'>666</p>
@@ -707,7 +712,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>668</p>
<p class='stm mis'>669</p>
<p class='pln'>670</p>
-<p class='stm run hide'>671</p>
+<p class='stm run hide_run'>671</p>
<p class='pln'>672</p>
<p class='pln'>673</p>
<p class='stm mis'>674</p>
@@ -717,9 +722,9 @@ function toggle_lines(btn, cls) { <p class='stm mis'>678</p>
<p class='stm mis'>679</p>
<p class='pln'>680</p>
-<p class='stm run hide'>681</p>
+<p class='stm run hide_run'>681</p>
<p class='pln'>682</p>
-<p class='stm run hide'>683</p>
+<p class='stm run hide_run'>683</p>
<p class='pln'>684</p>
<p class='pln'>685</p>
<p class='pln'>686</p>
@@ -727,7 +732,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>688</p>
<p class='stm mis'>689</p>
<p class='pln'>690</p>
-<p class='stm run hide'>691</p>
+<p class='stm run hide_run'>691</p>
<p class='pln'>692</p>
<p class='stm mis'>693</p>
<p class='stm mis'>694</p>
@@ -735,15 +740,15 @@ function toggle_lines(btn, cls) { <p class='stm mis'>696</p>
<p class='stm mis'>697</p>
<p class='pln'>698</p>
-<p class='stm run hide'>699</p>
+<p class='stm run hide_run'>699</p>
<p class='stm mis'>700</p>
<p class='pln'>701</p>
<p class='stm mis'>702</p>
<p class='pln'>703</p>
-<p class='stm run hide'>704</p>
+<p class='stm run hide_run'>704</p>
<p class='stm mis'>705</p>
<p class='pln'>706</p>
-<p class='stm run hide'>707</p>
+<p class='stm run hide_run'>707</p>
<p class='stm mis'>708</p>
<p class='stm mis'>709</p>
<p class='stm mis'>710</p>
@@ -753,9 +758,9 @@ function toggle_lines(btn, cls) { <p class='stm mis'>714</p>
<p class='pln'>715</p>
<p class='pln'>716</p>
-<p class='stm run hide'>717</p>
+<p class='stm run hide_run'>717</p>
<p class='pln'>718</p>
-<p class='stm run hide'>719</p>
+<p class='stm run hide_run'>719</p>
<p class='pln'>720</p>
<p class='stm mis'>721</p>
<p class='stm mis'>722</p>
@@ -763,7 +768,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>724</p>
<p class='stm mis'>725</p>
<p class='pln'>726</p>
-<p class='stm run hide'>727</p>
+<p class='stm run hide_run'>727</p>
<p class='stm mis'>728</p>
<p class='pln'>729</p>
<p class='pln'>730</p>
@@ -773,25 +778,25 @@ function toggle_lines(btn, cls) { <p class='stm mis'>734</p>
<p class='stm mis'>735</p>
<p class='pln'>736</p>
-<p class='stm run hide'>737</p>
+<p class='stm run hide_run'>737</p>
<p class='stm mis'>738</p>
<p class='stm mis'>739</p>
<p class='stm mis'>740</p>
<p class='pln'>741</p>
-<p class='stm run hide'>742</p>
+<p class='stm run hide_run'>742</p>
<p class='stm mis'>743</p>
<p class='stm mis'>744</p>
<p class='stm mis'>745</p>
<p class='stm mis'>746</p>
<p class='pln'>747</p>
-<p class='stm run hide'>748</p>
+<p class='stm run hide_run'>748</p>
<p class='pln'>749</p>
<p class='stm mis'>750</p>
<p class='stm mis'>751</p>
<p class='stm mis'>752</p>
<p class='stm mis'>753</p>
<p class='pln'>754</p>
-<p class='stm run hide'>755</p>
+<p class='stm run hide_run'>755</p>
<p class='stm mis'>756</p>
<p class='pln'>757</p>
<p class='pln'>758</p>
@@ -801,7 +806,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>762</p>
<p class='stm mis'>763</p>
<p class='pln'>764</p>
-<p class='stm run hide'>765</p>
+<p class='stm run hide_run'>765</p>
<p class='stm mis'>766</p>
<p class='pln'>767</p>
<p class='pln'>768</p>
@@ -833,14 +838,14 @@ function toggle_lines(btn, cls) { <p class='stm mis'>794</p>
<p class='stm mis'>795</p>
<p class='pln'>796</p>
-<p class='stm run hide'>797</p>
+<p class='stm run hide_run'>797</p>
<p class='stm mis'>798</p>
<p class='stm mis'>799</p>
<p class='pln'>800</p>
<p class='pln'>801</p>
-<p class='stm run hide'>802</p>
+<p class='stm run hide_run'>802</p>
<p class='pln'>803</p>
-<p class='stm run hide'>804</p>
+<p class='stm run hide_run'>804</p>
<p class='stm mis'>805</p>
<p class='pln'>806</p>
<p class='pln'>807</p>
@@ -872,7 +877,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>833</p>
<p class='stm mis'>834</p>
<p class='pln'>835</p>
-<p class='stm run hide'>836</p>
+<p class='stm run hide_run'>836</p>
<p class='pln'>837</p>
<p class='stm mis'>838</p>
<p class='pln'>839</p>
@@ -903,7 +908,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>864</p>
<p class='stm mis'>865</p>
<p class='pln'>866</p>
-<p class='stm run hide'>867</p>
+<p class='stm run hide_run'>867</p>
<p class='stm mis'>868</p>
<p class='pln'>869</p>
<p class='pln'>870</p>
@@ -950,7 +955,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>911</p>
<p class='stm mis'>912</p>
<p class='pln'>913</p>
-<p class='stm run hide'>914</p>
+<p class='stm run hide_run'>914</p>
<p class='stm mis'>915</p>
<p class='pln'>916</p>
<p class='pln'>917</p>
@@ -1001,7 +1006,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>962</p>
<p class='stm mis'>963</p>
<p class='pln'>964</p>
-<p class='stm run hide'>965</p>
+<p class='stm run hide_run'>965</p>
<p class='stm mis'>966</p>
<p class='pln'>967</p>
<p class='pln'>968</p>
@@ -1043,7 +1048,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1004</p>
<p class='stm mis'>1005</p>
<p class='pln'>1006</p>
-<p class='stm run hide'>1007</p>
+<p class='stm run hide_run'>1007</p>
<p class='stm mis'>1008</p>
<p class='pln'>1009</p>
<p class='pln'>1010</p>
@@ -1063,7 +1068,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1024</p>
<p class='stm mis'>1025</p>
<p class='pln'>1026</p>
-<p class='stm run hide'>1027</p>
+<p class='stm run hide_run'>1027</p>
<p class='stm mis'>1028</p>
<p class='pln'>1029</p>
<p class='pln'>1030</p>
@@ -1109,10 +1114,10 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1070</p>
<p class='pln'>1071</p>
<p class='pln'>1072</p>
-<p class='stm run hide'>1073</p>
+<p class='stm run hide_run'>1073</p>
<p class='pln'>1074</p>
<p class='pln'>1075</p>
-<p class='stm run hide'>1076</p>
+<p class='stm run hide_run'>1076</p>
<p class='pln'>1077</p>
<p class='pln'>1078</p>
<p class='pln'>1079</p>
@@ -1121,7 +1126,7 @@ function toggle_lines(btn, cls) { <p class='pln'>1082</p>
<p class='pln'>1083</p>
<p class='pln'>1084</p>
-<p class='stm run hide'>1085</p>
+<p class='stm run hide_run'>1085</p>
<p class='pln'>1086</p>
<p class='pln'>1087</p>
<p class='pln'>1088</p>
@@ -1130,38 +1135,38 @@ function toggle_lines(btn, cls) { <p class='pln'>1091</p>
<p class='pln'>1092</p>
<p class='pln'>1093</p>
-<p class='stm run hide'>1094</p>
+<p class='stm run hide_run'>1094</p>
<p class='stm mis'>1095</p>
<p class='stm mis'>1096</p>
<p class='stm mis'>1097</p>
<p class='pln'>1098</p>
-<p class='stm run hide'>1099</p>
+<p class='stm run hide_run'>1099</p>
<p class='stm mis'>1100</p>
<p class='stm mis'>1101</p>
<p class='stm mis'>1102</p>
<p class='pln'>1103</p>
-<p class='stm run hide'>1104</p>
+<p class='stm run hide_run'>1104</p>
<p class='stm mis'>1105</p>
<p class='stm mis'>1106</p>
<p class='stm mis'>1107</p>
<p class='pln'>1108</p>
-<p class='stm run hide'>1109</p>
+<p class='stm run hide_run'>1109</p>
<p class='stm mis'>1110</p>
<p class='stm mis'>1111</p>
<p class='stm mis'>1112</p>
<p class='pln'>1113</p>
<p class='pln'>1114</p>
-<p class='stm run hide'>1115</p>
+<p class='stm run hide_run'>1115</p>
<p class='pln'>1116</p>
<p class='pln'>1117</p>
<p class='pln'>1118</p>
<p class='pln'>1119</p>
<p class='pln'>1120</p>
-<p class='stm run hide'>1121</p>
+<p class='stm run hide_run'>1121</p>
<p class='stm mis'>1122</p>
<p class='stm mis'>1123</p>
<p class='pln'>1124</p>
-<p class='stm run hide'>1125</p>
+<p class='stm run hide_run'>1125</p>
<p class='stm mis'>1126</p>
<p class='pln'>1127</p>
<p class='pln'>1128</p>
@@ -1172,8 +1177,8 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1133</p>
<p class='pln'>1134</p>
<p class='pln'>1135</p>
-<p class='stm run hide'>1136</p>
-<p class='stm run hide'>1137</p>
+<p class='stm run hide_run'>1136</p>
+<p class='stm run hide_run'>1137</p>
<p class='pln'>1138</p>
<p class='pln'>1139</p>
<p class='pln'>1140</p>
@@ -1219,36 +1224,36 @@ function toggle_lines(btn, cls) { <p class='pln'>1180</p>
<p class='pln'>1181</p>
<p class='pln'>1182</p>
-<p class='stm run hide'>1183</p>
+<p class='stm run hide_run'>1183</p>
<p class='pln'>1184</p>
<p class='stm mis'>1185</p>
<p class='stm mis'>1186</p>
<p class='pln'>1187</p>
-<p class='stm run hide'>1188</p>
+<p class='stm run hide_run'>1188</p>
<p class='pln'>1189</p>
<p class='stm mis'>1190</p>
<p class='stm mis'>1191</p>
<p class='stm mis'>1192</p>
<p class='pln'>1193</p>
-<p class='stm run hide'>1194</p>
+<p class='stm run hide_run'>1194</p>
<p class='pln'>1195</p>
<p class='stm mis'>1196</p>
<p class='stm mis'>1197</p>
<p class='stm mis'>1198</p>
<p class='pln'>1199</p>
-<p class='stm run hide'>1200</p>
+<p class='stm run hide_run'>1200</p>
<p class='pln'>1201</p>
<p class='stm mis'>1202</p>
<p class='stm mis'>1203</p>
<p class='stm mis'>1204</p>
<p class='pln'>1205</p>
-<p class='stm run hide'>1206</p>
+<p class='stm run hide_run'>1206</p>
<p class='pln'>1207</p>
<p class='stm mis'>1208</p>
<p class='stm mis'>1209</p>
<p class='stm mis'>1210</p>
<p class='pln'>1211</p>
-<p class='stm run hide'>1212</p>
+<p class='stm run hide_run'>1212</p>
<p class='stm mis'>1213</p>
<p class='pln'>1214</p>
<p class='pln'>1215</p>
@@ -1290,7 +1295,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1251</p>
<p class='stm mis'>1252</p>
<p class='pln'>1253</p>
-<p class='stm run hide'>1254</p>
+<p class='stm run hide_run'>1254</p>
<p class='pln'>1255</p>
<p class='pln'>1256</p>
<p class='stm mis'>1257</p>
@@ -1324,9 +1329,9 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1285</p>
<p class='pln'>1286</p>
<p class='pln'>1287</p>
-<p class='stm run hide'>1288</p>
+<p class='stm run hide_run'>1288</p>
<p class='pln'>1289</p>
-<p class='stm run hide'>1290</p>
+<p class='stm run hide_run'>1290</p>
<p class='pln'>1291</p>
<p class='stm mis'>1292</p>
<p class='pln'>1293</p>
@@ -1356,7 +1361,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1317</p>
<p class='stm mis'>1318</p>
<p class='pln'>1319</p>
-<p class='stm run hide'>1320</p>
+<p class='stm run hide_run'>1320</p>
<p class='stm mis'>1321</p>
<p class='pln'>1322</p>
<p class='pln'>1323</p>
@@ -1390,7 +1395,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1351</p>
<p class='stm mis'>1352</p>
<p class='pln'>1353</p>
-<p class='stm run hide'>1354</p>
+<p class='stm run hide_run'>1354</p>
<p class='pln'>1355</p>
<p class='stm mis'>1356</p>
<p class='pln'>1357</p>
@@ -1444,7 +1449,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1405</p>
<p class='stm mis'>1406</p>
<p class='pln'>1407</p>
-<p class='stm run hide'>1408</p>
+<p class='stm run hide_run'>1408</p>
<p class='stm mis'>1409</p>
<p class='pln'>1410</p>
<p class='pln'>1411</p>
@@ -1486,7 +1491,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1447</p>
<p class='stm mis'>1448</p>
<p class='pln'>1449</p>
-<p class='stm run hide'>1450</p>
+<p class='stm run hide_run'>1450</p>
<p class='stm mis'>1451</p>
<p class='pln'>1452</p>
<p class='pln'>1453</p>
@@ -1498,7 +1503,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1459</p>
<p class='stm mis'>1460</p>
<p class='pln'>1461</p>
-<p class='stm run hide'>1462</p>
+<p class='stm run hide_run'>1462</p>
<p class='pln'>1463</p>
<p class='pln'>1464</p>
<p class='stm mis'>1465</p>
@@ -1523,7 +1528,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1484</p>
<p class='stm mis'>1485</p>
<p class='pln'>1486</p>
-<p class='stm run hide'>1487</p>
+<p class='stm run hide_run'>1487</p>
<p class='stm mis'>1488</p>
<p class='pln'>1489</p>
<p class='pln'>1490</p>
@@ -1562,7 +1567,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1523</p>
<p class='stm mis'>1524</p>
<p class='pln'>1525</p>
-<p class='stm run hide'>1526</p>
+<p class='stm run hide_run'>1526</p>
<p class='stm mis'>1527</p>
<p class='pln'>1528</p>
<p class='pln'>1529</p>
@@ -1579,7 +1584,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1540</p>
<p class='stm mis'>1541</p>
<p class='pln'>1542</p>
-<p class='stm run hide'>1543</p>
+<p class='stm run hide_run'>1543</p>
<p class='stm mis'>1544</p>
<p class='pln'>1545</p>
<p class='pln'>1546</p>
@@ -1604,7 +1609,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1565</p>
<p class='stm mis'>1566</p>
<p class='pln'>1567</p>
-<p class='stm run hide'>1568</p>
+<p class='stm run hide_run'>1568</p>
<p class='stm mis'>1569</p>
<p class='pln'>1570</p>
<p class='pln'>1571</p>
@@ -1624,7 +1629,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1585</p>
<p class='stm mis'>1586</p>
<p class='pln'>1587</p>
-<p class='stm run hide'>1588</p>
+<p class='stm run hide_run'>1588</p>
<p class='stm mis'>1589</p>
<p class='pln'>1590</p>
<p class='pln'>1591</p>
@@ -1642,9 +1647,9 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1603</p>
<p class='stm mis'>1604</p>
<p class='pln'>1605</p>
-<p class='stm run hide'>1606</p>
+<p class='stm run hide_run'>1606</p>
<p class='pln'>1607</p>
-<p class='stm run hide'>1608</p>
+<p class='stm run hide_run'>1608</p>
<p class='pln'>1609</p>
<p class='pln'>1610</p>
<p class='pln'>1611</p>
@@ -1674,42 +1679,42 @@ function toggle_lines(btn, cls) { <p class='exc'>1635</p>
<p class='exc'>1636</p>
<p class='pln'>1637</p>
-<p class='stm run hide'>1638</p>
+<p class='stm run hide_run'>1638</p>
<p class='stm mis'>1639</p>
<p class='stm mis'>1640</p>
<p class='stm mis'>1641</p>
<p class='stm mis'>1642</p>
<p class='stm mis'>1643</p>
<p class='pln'>1644</p>
-<p class='stm run hide'>1645</p>
+<p class='stm run hide_run'>1645</p>
<p class='stm mis'>1646</p>
<p class='stm mis'>1647</p>
<p class='pln'>1648</p>
-<p class='stm run hide'>1649</p>
+<p class='stm run hide_run'>1649</p>
<p class='stm mis'>1650</p>
<p class='pln'>1651</p>
<p class='pln'>1652</p>
<p class='stm mis'>1653</p>
<p class='pln'>1654</p>
-<p class='stm run hide'>1655</p>
+<p class='stm run hide_run'>1655</p>
<p class='stm mis'>1656</p>
<p class='stm mis'>1657</p>
<p class='stm mis'>1658</p>
<p class='pln'>1659</p>
-<p class='stm run hide'>1660</p>
+<p class='stm run hide_run'>1660</p>
<p class='stm mis'>1661</p>
<p class='stm mis'>1662</p>
<p class='stm mis'>1663</p>
<p class='pln'>1664</p>
-<p class='stm run hide'>1665</p>
+<p class='stm run hide_run'>1665</p>
<p class='stm mis'>1666</p>
<p class='pln'>1667</p>
<p class='pln'>1668</p>
<p class='stm mis'>1669</p>
<p class='pln'>1670</p>
-<p class='stm run hide'>1671</p>
+<p class='stm run hide_run'>1671</p>
<p class='pln'>1672</p>
-<p class='stm run hide'>1673</p>
+<p class='stm run hide_run'>1673</p>
<p class='stm mis'>1674</p>
<p class='pln'>1675</p>
<p class='pln'>1676</p>
@@ -1734,7 +1739,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1695</p>
<p class='stm mis'>1696</p>
<p class='pln'>1697</p>
-<p class='stm run hide'>1698</p>
+<p class='stm run hide_run'>1698</p>
<p class='stm mis'>1699</p>
<p class='pln'>1700</p>
<p class='pln'>1701</p>
@@ -1763,7 +1768,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1724</p>
<p class='stm mis'>1725</p>
<p class='pln'>1726</p>
-<p class='stm run hide'>1727</p>
+<p class='stm run hide_run'>1727</p>
<p class='stm mis'>1728</p>
<p class='pln'>1729</p>
<p class='pln'>1730</p>
@@ -1792,7 +1797,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1753</p>
<p class='stm mis'>1754</p>
<p class='pln'>1755</p>
-<p class='stm run hide'>1756</p>
+<p class='stm run hide_run'>1756</p>
<p class='stm mis'>1757</p>
<p class='pln'>1758</p>
<p class='pln'>1759</p>
@@ -1886,10 +1891,10 @@ function toggle_lines(btn, cls) { <p class='pln'>1847</p>
<p class='pln'>1848</p>
<p class='pln'>1849</p>
-<p class='stm run hide'>1850</p>
+<p class='stm run hide_run'>1850</p>
<p class='pln'>1851</p>
<p class='pln'>1852</p>
-<p class='stm run hide'>1853</p>
+<p class='stm run hide_run'>1853</p>
<p class='pln'>1854</p>
<p class='stm mis'>1855</p>
<p class='pln'>1856</p>
@@ -1917,7 +1922,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1878</p>
<p class='stm mis'>1879</p>
<p class='pln'>1880</p>
-<p class='stm run hide'>1881</p>
+<p class='stm run hide_run'>1881</p>
<p class='stm mis'>1882</p>
<p class='pln'>1883</p>
<p class='pln'>1884</p>
@@ -1927,7 +1932,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1888</p>
<p class='stm mis'>1889</p>
<p class='pln'>1890</p>
-<p class='stm run hide'>1891</p>
+<p class='stm run hide_run'>1891</p>
<p class='pln'>1892</p>
<p class='pln'>1893</p>
<p class='stm mis'>1894</p>
@@ -1955,9 +1960,9 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1916</p>
<p class='stm mis'>1917</p>
<p class='pln'>1918</p>
-<p class='stm run hide'>1919</p>
+<p class='stm run hide_run'>1919</p>
<p class='pln'>1920</p>
-<p class='stm run hide'>1921</p>
+<p class='stm run hide_run'>1921</p>
<p class='pln'>1922</p>
<p class='stm mis'>1923</p>
<p class='pln'>1924</p>
@@ -1973,7 +1978,7 @@ function toggle_lines(btn, cls) { <p class='stm mis'>1934</p>
<p class='stm mis'>1935</p>
<p class='pln'>1936</p>
-<p class='stm run hide'>1937</p>
+<p class='stm run hide_run'>1937</p>
<p class='pln'>1938</p>
<p class='stm mis'>1939</p>
<p class='pln'>1940</p>
@@ -2000,1966 +2005,1966 @@ function toggle_lines(btn, cls) { </td>
<td class='text' valign='top'>
-<p class='pln'><span class='str'>""" Test cogapp.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> http://nedbatchelder.com/code/cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Copyright 2004-2009, Ned Batchelder.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>"""</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>import</span> <span class='nam'>unittest</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>import</span> <span class='nam'>os</span><span class='op'>,</span> <span class='nam'>random</span><span class='op'>,</span> <span class='nam'>re</span><span class='op'>,</span> <span class='nam'>StringIO</span><span class='op'>,</span> <span class='nam'>stat</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>,</span> <span class='nam'>tempfile</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>import</span> <span class='nam'>path</span> <span class='com'># Non-standard, from http://www.jorendorff.com/articles/python/path</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>Cog</span><span class='op'>,</span> <span class='nam'>CogOptions</span><span class='op'>,</span> <span class='nam'>CogGenerator</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>CogGeneratedError</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>usage</span><span class='op'>,</span> <span class='nam'>__version__</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>from</span> <span class='nam'>whiteutils</span> <span class='key'>import</span> <span class='nam'>reindentBlock</span><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>from</span> <span class='nam'>makefiles</span> <span class='key'>import</span> <span class='op'>*</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestCase</span><span class='op'>(</span><span class='nam'>unittest</span><span class='op'>.</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Base class for all Cog test cases. Adds utility methods I like.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>excClass</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>,</span> <span class='nam'>callableObj</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwargs</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Just like unittest.TestCase.assertRaises,</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> but checks that the message is right too.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>callableObj</span><span class='op'>(</span><span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwargs</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>except</span> <span class='nam'>excClass</span><span class='op'>,</span> <span class='nam'>exc</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>excMsg</span> <span class='op'>=</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>exc</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>msg</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># No message provided: it passes.</span><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>return</span> <span class='com'>#pragma: no cover</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>elif</span> <span class='nam'>excMsg</span> <span class='op'>==</span> <span class='nam'>msg</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Message provided, and we got the right message: it passes.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>else</span><span class='op'>:</span> <span class='com'>#pragma: no cover</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Message provided, and it didn't match: fail!</span><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>(</span><span class='str'>"Right exception, wrong message: got '%s' expected '%s'"</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>excMsg</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>else</span><span class='op'>:</span> <span class='com'>#pragma: no cover</span><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>excClass</span><span class='op'>,</span><span class='str'>'__name__'</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='exc'> <span class='nam'>excName</span> <span class='op'>=</span> <span class='nam'>excClass</span><span class='op'>.</span><span class='nam'>__name__</span><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>else</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='exc'> <span class='nam'>excName</span> <span class='op'>=</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>excClass</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>(</span><span class='str'>"Expected to raise %s, didn't get an exception at all"</span> <span class='op'>%</span> <span class='nam'>excName</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogTestsInMemory</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Test cases for cogapp.Cog()</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testNoCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>strings</span> <span class='op'>=</span> <span class='op'>[</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>''</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>' '</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>' \t \t \tx'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'hello'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'the cat\nin the\nhat.'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'Horton\n\tHears A\n\t\tWho'</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Some text.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This is line one\\n")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This is line two")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> gobbledegook.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> epilogue.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Some text.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This is line one\\n")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This is line two")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is line one</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is line two</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> epilogue.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>outfile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testEmptyCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># The cog clause can be totally empty. Not sure why you'd want it,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># but it works.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hello</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> goodbye</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testMultipleCogs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># One file can have many cog chunks, even abutting each other.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out("chunk1")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> chunk1</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out("chunk2")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> chunk2</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> between chunks</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out("chunk3")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> chunk3</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testTrimBlankLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out("This is line one\\n", trimblanklines=True)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out('''</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is line two</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ''', dedent=True, trimblanklines=True)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This is line three", trimblanklines=True)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is line one</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is line two</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is line three</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testTrimEmptyBlankLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out("This is line one\\n", trimblanklines=True)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out('''</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is line two</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ''', dedent=True, trimblanklines=True)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out('', dedent=True, trimblanklines=True)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This is line three", trimblanklines=True)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is line one</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is line two</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is line three</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>test22EndOfLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># In Python 2.2, this cog file was not parsing because the</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># last line is indented but didn't end with a newline.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for i in range(3):</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out("%d\\n" % i)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> 0</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> 1</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> 2</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testIndentedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> first line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for i in range(3):</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out("xx%d\\n" % i)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xx0</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xx1</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xx2</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> last line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testPrefixedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --for i in range(3):</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -- cog.out("xx%d\\n" % i)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xx0</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xx1</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xx2</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testPrefixedIndentedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> prologue</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -- import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -- for i in range(3):</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -- cog.out("xy%d\\n" % i)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xy0</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xy1</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xy2</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testBogusPrefixMatch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> prologue</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> # This comment should not be clobbered by removing the pound sign.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for i in range(3):</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out("xy%d\\n" % i)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xy0</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xy1</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xy2</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testNoFinalNewline</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># If the cog'ed output has no final newline,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># it shouldn't eat up the cog terminator.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> prologue</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for i in range(3):</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out("%d" % i)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> 012</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> epilogue</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testNoOutputAtAll</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># If there is absolutely no cog output, that's ok.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> prologue</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> i = 1</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> epilogue</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testPurelyBlankLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># If there is a blank line in the cog code with no whitespace</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># prefix, that should be OK.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> prologue</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import sys</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out("Hello")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> $</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.out("There")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> HelloThere</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> epilogue</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>'$'</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testEmptyOutl</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Alexander Belchenko suggested the string argument to outl should</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># be optional. Does it work?</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> prologue</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("x")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl()</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("y")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl(trimblanklines=True)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("z")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> x</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='str'> y</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> z</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> epilogue</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testFirstLineNum</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> fooey</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("started at line number %d" % cog.firstLineNum)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> started at line number 2</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> blah blah</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("and again at line %d" % cog.firstLineNum)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> and again at line 8</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testCompactOneLineCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> first line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hey: [[[cog cog.outl("hello %d" % (3*3*3*3)) ]]] looky!</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> get rid of this!</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> last line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> first line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hey: [[[cog cog.outl("hello %d" % (3*3*3*3)) ]]] looky!</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hello 81</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> last line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>outfile</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testInsideOutCompact</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> first line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hey?: ]]] what is this? [[[cog strange!</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> get rid of this!</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> last line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>"infile.txt(2): Cog code markers inverted"</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>"infile.txt"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testSharingGlobals</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> first line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hey: [[[cog s="hey there" ]]] looky!</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> more literal junk.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[cog cog.outl(s) ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> last line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> first line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hey: [[[cog s="hey there" ]]] looky!</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> more literal junk.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[cog cog.outl(s) ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hey there</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> last line</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>outfile</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogOptionsTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Test the CogOptions class.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testEquality</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-r'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertNotEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-r'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testCloning</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'fooey'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'booey'</span><span class='op'>,</span> <span class='str'>'-s'</span><span class='op'>,</span> <span class='str'>' /*x*/'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>o</span><span class='op'>.</span><span class='nam'>clone</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'huey'</span><span class='op'>,</span> <span class='str'>'-D'</span><span class='op'>,</span> <span class='str'>'foo=quux'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertNotEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>q</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>q</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'fooey'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'booey'</span><span class='op'>,</span> <span class='str'>'-s'</span><span class='op'>,</span> <span class='str'>' /*x*/'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'huey'</span><span class='op'>,</span> <span class='str'>'-D'</span><span class='op'>,</span> <span class='str'>'foo=quux'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>p</span><span class='op'>,</span> <span class='nam'>q</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testCombiningFlags</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Single-character flags can be combined.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-e'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-z'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-erz'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>FileStructureTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Test cases to check that we're properly strict about the structure</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> of files.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>msg</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'infile.txt'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testBeginNoEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Fooey</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl('hello')</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(2): Cog block begun but never ended."</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testNoEoo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Fooey</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl('hello')</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(4): Missing '[[[end]]]' before end of file."</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Fooey</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl('hello')</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl('goodbye')</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(5): Unexpected '[[[cog'"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testStartWithEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(1): Unexpected ']]]'"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl('hello')</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]] </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(5): Unexpected ']]]'"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testStartWithEoo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(1): Unexpected '[[[end]]]'"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl('hello')</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(5): Unexpected '[[[end]]]'"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testNoEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(3): Unexpected '[[[end]]]'"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl('hello')</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(7): Unexpected '[[[end]]]'"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testTwoBegins</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(2): Unexpected '[[[cog'"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(6): Unexpected '[[[cog'"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testTwoEnds</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(4): Unexpected ']]]'"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(8): Unexpected ']]]'"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogErrorTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Test cases for cog.error().</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testErrorMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[cog cog.error("This ain't right!")]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogGeneratedError</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>"This ain't right!"</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testErrorNoMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[cog cog.error()]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogGeneratedError</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>"Error raised by cog generator."</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testNoErrorIfErrorNotCalled</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --for i in range(3):</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -- if i > 10:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -- cog.error("Something is amiss!")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> -- cog.out("xx%d\\n" % i)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xx0</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xx1</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> xx2</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogGeneratorGetCodeTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Unit tests against CogGenerator to see if its getCode() method works</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> properly.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" All tests get a generator to use, and short same-length names for</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> the functions we're going to use.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span> <span class='op'>=</span> <span class='nam'>CogGenerator</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseMarker</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseLine</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testEmpty</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// ]]]'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>' print "hello"'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>' print "bye"'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// ]]]'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'print "hello"\nprint "bye"'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testCompressed1</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog: print """'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'// hello'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'// bye'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// """)]]]'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'hello\nbye'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testCompressed2</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog: print """'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'hello'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'bye'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// """)]]]'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'hello\nbye'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testCompressed3</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'print """hello'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'bye'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// """)]]]'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'print """hello\nbye'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testCompressed4</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog: print """'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'hello'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'bye""")'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// ]]]'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'hello\nbye""")'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testNoCommonPrefixForMarkers</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># It's important to be able to use #if 0 to hide lines from a</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># C++ compiler.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'#if 0 //[[[cog'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'\timport cog, sys'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>''</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'\tprint sys.argv'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'#endif //]]]'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'import cog, sys\n\nprint sys.argv'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestCaseWithTempDir</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>newCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Initialize the cog members for another run.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Create a cog engine, and catch its output.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span> <span class='op'>=</span> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stdout</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>,</span> <span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Create a temporary directory.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>(</span><span class='nam'>tempfile</span><span class='op'>.</span><span class='nam'>gettempdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>/</span> <span class='op'>(</span><span class='str'>'testcog_tempdir_'</span> <span class='op'>+</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>random</span><span class='op'>.</span><span class='nam'>random</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='op'>[</span><span class='num'>2</span><span class='op'>:</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>.</span><span class='nam'>mkdir</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>olddir</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>olddir</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Get rid of the temporary directory.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>.</span><span class='nam'>rmtree</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFName1</span><span class='op'>,</span> <span class='nam'>sFName2</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName1</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>text</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName2</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>text</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>assertFileContent</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFName</span><span class='op'>,</span> <span class='nam'>sContent</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>sAbsName</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sAbsName</span><span class='op'>,</span> <span class='str'>'rb'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>sFileContent</span> <span class='op'>=</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>sFileContent</span><span class='op'>,</span> <span class='nam'>sContent</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>ArgumentHandlingTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testArgumentFailure</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Return value 2 means usage problem.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-j'</span><span class='op'>]</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>2</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"option -j not recognized"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-j'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testNoDashOAndAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> # Please run cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'foo'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testDashV</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-v'</span><span class='op'>]</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='str'>'Cog version %s\n'</span> <span class='op'>%</span> <span class='nam'>__version__</span><span class='op'>,</span> <span class='nam'>output</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>producesHelp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>args</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>argv</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>]</span> <span class='op'>+</span> <span class='nam'>args</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEquals</span><span class='op'>(</span><span class='nam'>usage</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testDashH</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># -h or -? anywhere on the command line should just print help.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>"-h"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>"-?"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>"fooey.txt -h"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>"-o -r @fooey.txt -? @booey.txt"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testDashOAndDashR</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cogfile.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> # Please run cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'foo'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'cogfile.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testDashZ</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> // This is my C++ file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for fn in fnames:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> // This is my C++ file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for fn in fnames:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoSomething();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoAnotherThing();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoLastThing();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>"test.cog(6): Missing '[[[end]]]' before end of file."</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-z'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testBadDashD</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-Dfooey'</span><span class='op'>,</span> <span class='str'>'cog.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-D'</span><span class='op'>,</span> <span class='str'>'fooey'</span><span class='op'>,</span> <span class='str'>'cog.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestFileHandling</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> // This is my C++ file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for fn in fnames:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> // This is my C++ file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for fn in fnames:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoSomething();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoAnotherThing();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoLastThing();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"(changed)"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testOutputFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># -o sets the output file.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> // This is my C++ file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for fn in fnames:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> // This is my C++ file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for fn in fnames:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoSomething();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoAnotherThing();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoLastThing();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'one.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello world")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'one.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello world")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hello world</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'two.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("goodbye cruel world")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'two.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("goodbye cruel world")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> goodbye cruel world</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> # Please run cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> one.cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> two.cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'one.cog'</span><span class='op'>,</span> <span class='str'>'one.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'two.cog'</span><span class='op'>,</span> <span class='str'>'two.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"(changed)"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testNestedAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'one.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello world")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'one.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello world")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hello world</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'two.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("goodbye cruel world")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'two.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("goodbye cruel world")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> goodbye cruel world</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> # Please run cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> one.cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> @cogfiles2.txt</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cogfiles2.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> # This one too, please.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> two.cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'one.cog'</span><span class='op'>,</span> <span class='str'>'one.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'two.cog'</span><span class='op'>,</span> <span class='str'>'two.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"(changed)"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testAtFileWithArgs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'both.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("one: %s" % globals().has_key('one'))</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("two: %s" % globals().has_key('two'))</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'one.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("one: %s" % globals().has_key('one'))</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("two: %s" % globals().has_key('two'))</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> one: True // ONE</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> two: False // ONE</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'two.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("one: %s" % globals().has_key('one'))</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("two: %s" % globals().has_key('two'))</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> one: False // TWO</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> two: True // TWO</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> # Please run cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> both.cog -o both.one -s ' // ONE' -D one=x</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> both.cog -o both.two -s ' // TWO' -D two=x</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'both.one'</span><span class='op'>,</span> <span class='str'>'one.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'both.two'</span><span class='op'>,</span> <span class='str'>'two.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testAtFileWithBadArgCombo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'both.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("one: %s" % globals().has_key('one'))</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("two: %s" % globals().has_key('two'))</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> # Please run cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> both.cog </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> both.cog -d # This is bad: -r and -d</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testAtFileWithTrickyFilenames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'one 1.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog cog.outl("hello world") ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'one.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog cog.outl("hello world") ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hello world //xxx</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'subdir'</span><span class='op'>:</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'subback.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog cog.outl("down deep with backslashes") ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'subfwd.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog cog.outl("down deep with slashes") ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'subback.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog cog.outl("down deep with backslashes") ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> down deep with backslashes //yyy</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'subfwd.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog cog.outl("down deep with slashes") ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> down deep with slashes //zzz</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> # Please run cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> 'one 1.cog' -s ' //xxx'</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> subdir\subback.cog -s ' //yyy'</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> subdir/subfwd.cog -s ' //zzz'</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-z'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'one 1.cog'</span><span class='op'>,</span> <span class='str'>'one.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'subdir/subback.cog'</span><span class='op'>,</span> <span class='str'>'subback.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'subdir/subfwd.cog'</span><span class='op'>,</span> <span class='str'>'subfwd.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogTestLineEndings</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>"""Tests for -U option (force LF line-endings in output)."""</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>lines_in</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'Some text.'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'//[[[cog'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog.outl("Cog text")'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'//]]]'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'gobbledegook.'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'//[[[end]]]'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'epilogue.'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>''</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>lines_out</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'Some text.'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'//[[[cog'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog.outl("Cog text")'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'//]]]'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'Cog text'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'//[[[end]]]'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'epilogue.'</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>''</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testOutputNativeEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>'infile'</span><span class='op'>:</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'outfile'</span><span class='op'>,</span> <span class='str'>'infile'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>'outfile'</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testOutputLfEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>'infile'</span><span class='op'>:</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-U'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'outfile'</span><span class='op'>,</span> <span class='str'>'infile'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>'outfile'</span><span class='op'>,</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testReplaceNativeEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testReplaceLfEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-U'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestCaseWithImports</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" When running tests which import modules, the sys.modules list</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> leaks from one test to the next. This test case class scrubs</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> the list after each run to keep the tests isolated from each other.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sysmodulekeys</span> <span class='op'>=</span> <span class='nam'>list</span><span class='op'>(</span><span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>modstoscrub</span> <span class='op'>=</span> <span class='op'>[</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>modname</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>for</span> <span class='nam'>modname</span> <span class='key'>in</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class="strut"> </span></p>
-<p class='pln'> <span class='key'>if</span> <span class='nam'>modname</span> <span class='key'>not</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sysmodulekeys</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>for</span> <span class='nam'>modname</span> <span class='key'>in</span> <span class='nam'>modstoscrub</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>del</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='op'>[</span><span class='nam'>modname</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogIncludeTests</span><span class='op'>(</span><span class='nam'>TestCaseWithImports</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>dincludes</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import mymodule</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import mymodule</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Hello from mymodule</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test2.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import mymodule</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Hello from mymodule in inc2</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'include'</span><span class='op'>:</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'mymodule.py'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("Hello from mymodule")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'inc2'</span><span class='op'>:</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'mymodule.py'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("Hello from mymodule in inc2")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'inc3'</span><span class='op'>:</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'someothermodule.py'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This is some other module.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testNeedIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Try it without the -I, to see that an ImportError happens.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>ImportError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Test that -I adds include directories properly.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'include'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testTwoIncludePaths</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Test that two -I's add include directories properly.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'include'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'inc2'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testTwoIncludePaths2</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Test that two -I's add include directories properly.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'inc2'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'include'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test2.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testUselessIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Test that the search will continue past the first directory.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'inc3'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'include'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testSysPathIsUnchanged</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'bad.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog cog.error("Oh no!") ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'good.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog cog.outl("Oh yes!") ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Is it unchanged just by creating a cog engine?</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>oldsyspath</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>[</span><span class='op'>:</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Is it unchanged for a successful run?</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'good.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Is it unchanged for a successful run with includes?</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'xyzzy'</span><span class='op'>,</span> <span class='str'>'good.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Is it unchanged for a successful run with two includes?</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'xyzzy'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'quux'</span><span class='op'>,</span> <span class='str'>'good.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Is it unchanged for a failed run?</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'bad.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Is it unchanged for a failed run with includes?</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'xyzzy'</span><span class='op'>,</span> <span class='str'>'bad.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Is it unchanged for a failed run with two includes?</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'xyzzy'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'quux'</span><span class='op'>,</span> <span class='str'>'bad.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testSubDirectories</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Test that relative paths on the command line work, with includes.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'code'</span><span class='op'>:</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import mysubmodule</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import mysubmodule</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Hello from mysubmodule</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'mysubmodule.py'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> import cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("Hello from mysubmodule")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># We should be able to invoke cog without the -I switch, and it will</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># auto-include the current directory</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'code/test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'code/test.cog'</span><span class='op'>,</span> <span class='str'>'code/test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogTestsInFiles</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testWarnIfNoCogCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Test that the -e switch warns if there is no Cog code.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'with.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("hello world")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> hello world</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'without.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> There's no cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> code in this file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-e'</span><span class='op'>,</span> <span class='str'>'with.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"Warning"</span><span class='op'>)</span> <span class='op'><</span> <span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-e'</span><span class='op'>,</span> <span class='str'>'without.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"Warning: no cog code found in without.cog"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'without.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"Warning"</span><span class='op'>)</span> <span class='op'><</span> <span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testFileNameProps</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This is %s in, %s out" % (cog.inFile, cog.outFile))</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> this is cog1.txt in, cog1.txt out</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This is %s in, %s out" % (cog.inFile, cog.outFile))</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is cog1.txt in, cog1.txt out</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1out.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This is %s in, %s out" % (cog.inFile, cog.outFile))</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This is cog1.txt in, cog1out.txt out</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> [[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'cog1out.txt'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1out.txt'</span><span class='op'>,</span> <span class='str'>'cog1out.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testGlobalsDontCrossFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Make sure that global values don't get shared between files.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'one.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog s = "This was set in one.cog" ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog cog.outl(s) ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'one.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog s = "This was set in one.cog" ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog cog.outl(s) ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This was set in one.cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'two.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> try:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl(s)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> except NameError:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("s isn't set!")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'two.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> try:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl(s)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> except NameError:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("s isn't set!")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> s isn't set!</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> # Please run cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> one.cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> two.cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'one.cog'</span><span class='op'>,</span> <span class='str'>'one.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'two.cog'</span><span class='op'>,</span> <span class='str'>'two.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"(changed)"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testRemoveGeneratedOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was generated.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was generated.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was not.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was generated.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was not.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.out2'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was generated.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was generated.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was not.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Remove generated output.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-x'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Regenerate the generated output.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out2'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Remove the generated output again.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-x'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testMsgCall</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.msg("Hello there!")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> #[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>"Message: Hello there!\n"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testErrorMessageHasNoTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Test that a Cog error is printed to stderr with no traceback.</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Xhis line was newly</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> generated by cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> blah blah.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>stderr</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>"cog1.txt"</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>"Cogging cog1.txt\n"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>"cog1.txt(9): Output has been edited! Delete old checksum to unprotect.\n"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testDashD</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[cog cog.outl("Defined fooey as " + fooey) ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.kablooey'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[cog cog.outl("Defined fooey as " + fooey) ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Defined fooey as kablooey</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.einstein'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[cog cog.outl("Defined fooey as " + fooey) ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Defined fooey as e=mc2</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-D'</span><span class='op'>,</span> <span class='str'>'fooey=kablooey'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.kablooey'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-Dfooey=kablooey'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.kablooey'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-Dfooey=e=mc2'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.einstein'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-Dbar=quux'</span><span class='op'>,</span> <span class='str'>'-Dfooey=kablooey'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.kablooey'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-Dfooey=kablooey'</span><span class='op'>,</span> <span class='str'>'-Dbar=quux'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.kablooey'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-Dfooey=gooey'</span><span class='op'>,</span> <span class='str'>'-Dfooey=kablooey'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.kablooey'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testOutputToStdout</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[cog cog.outl('Hey there!') ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> --[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>stderr</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>outerr</span> <span class='op'>=</span> <span class='nam'>stderr</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>"--[[[cog cog.outl('Hey there!') ]]]\nHey there!\n--[[[end]]]\n"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>outerr</span><span class='op'>,</span> <span class='str'>""</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testSuffixOutputLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Hey there.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\nb\\n \\nc') ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ;[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Good bye.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Hey there.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\nb\\n \\nc') ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> a (foo)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> b (foo)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> c (foo)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ;[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Good bye.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-s'</span><span class='op'>,</span> <span class='str'>' (foo)'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testEmptySuffix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\nb\\nc') ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ;[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\nb\\nc') ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> a</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> b</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> c</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ;[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-s'</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testHellishSuffix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\n\\nb') ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\n\\nb') ]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> a /\\n*+([)]><</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> b /\\n*+([)]><</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-z'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-s'</span><span class='op'>,</span> <span class='str'>r' /\n*+([)]><'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>WritabilityTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for fn in ['DoSomething', 'DoAnotherThing', 'DoLastThing']:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for fn in ['DoSomething', 'DoAnotherThing', 'DoLastThing']:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoSomething();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoAnotherThing();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoLastThing();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>if</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>name</span> <span class='op'>==</span> <span class='str'>'nt'</span><span class='op'>:</span> <span class='com'># pragma: no cover</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># for Windows</span><span class="strut"> </span></p>
-<p class='exc'> <span class='nam'>cmd_w_args</span> <span class='op'>=</span> <span class='str'>'attrib -R %s'</span><span class="strut"> </span></p>
-<p class='exc'> <span class='nam'>cmd_w_asterisk</span> <span class='op'>=</span> <span class='str'>'attrib -R *'</span><span class="strut"> </span></p>
-<p class='exc'> <span class='key'>else</span><span class='op'>:</span> <span class='com'># pragma: no cover</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># for unix-like</span><span class="strut"> </span></p>
-<p class='exc'> <span class='nam'>cmd_w_args</span> <span class='op'>=</span> <span class='str'>'chmod +w %s'</span><span class="strut"> </span></p>
-<p class='exc'> <span class='nam'>cmd_w_asterisk</span> <span class='op'>=</span> <span class='str'>'chmod +w *'</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='str'>'test.cog'</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>.</span><span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>stat</span><span class='op'>.</span><span class='nam'>S_IREAD</span><span class='op'>)</span> <span class='com'># Make the file readonly.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>.</span><span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>stat</span><span class='op'>.</span><span class='nam'>S_IWRITE</span><span class='op'>)</span> <span class='com'># Make the file writable again.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testReadonlyNoCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>"Can't overwrite test.cog"</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testReadonlyWithCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-w'</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cmd_w_args</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testReadonlyWithCommandWithNoSlot</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-w'</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cmd_w_asterisk</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testReadonlyWithIneffectualCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>"Couldn't make test.cog writable"</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-w'</span><span class='op'>,</span> <span class='str'>'echo %s'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>ChecksumTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testCreateChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was generated.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was generated.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was not.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was generated.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was generated.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was not.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testCheckChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was generated.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was newly</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> generated by cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> blah blah.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testRemoveChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was generated.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893) fooey</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was newly</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> generated by cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> blah blah.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] fooey</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testTamperedChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Xhis line was newly</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> generated by cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> blah blah.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog2.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was newly</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> generated by cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> blah blah!</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog3.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was newly</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> generated by cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> blah blah.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog4.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was newly</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> generated by cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> blah blah..</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog5.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> This line was newly</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> generated by cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> blah blah.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> extra</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'cog6.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>"cog1.txt(9): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog1.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>"cog2.txt(9): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog2.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>"cog3.txt(10): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog3.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>"cog4.txt(9): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog4.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>"cog5.txt(10): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog5.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>"cog6.txt(6): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog6.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>BlakeTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Blake Winton's contributions. </span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testDeleteCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># -o sets the output file.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> // This is my C++ file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for fn in fnames:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Some Sample Code Here</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]Data Data</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> And Some More</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> // This is my C++ file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoSomething();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoAnotherThing();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoLastThing();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> And Some More</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-d'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testDeleteCodeWithDashRFails</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> // This is my C++ file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-d'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testSettingGlobals</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Blake Winton contributed a way to set the globals that will be used in</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># processFile().</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> // This is my C++ file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> for fn in fnames:</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Some Sample Code Here</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]"""</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> // This is my C++ file.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoBlake();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoWinton();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> void DoContribution();</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>globals</span> <span class='op'>=</span> <span class='op'>{</span><span class='op'>}</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>globals</span><span class='op'>[</span><span class='str'>'fnames'</span><span class='op'>]</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'DoBlake'</span><span class='op'>,</span> <span class='str'>'DoWinton'</span><span class='op'>,</span> <span class='str'>'DoContribution'</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>=</span><span class='nam'>globals</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>class</span> <span class='nam'>ErrorCallTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testErrorCallHasNoTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Test that cog.error() doesn't show a traceback.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'error.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> cog.error("Something Bad!")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'error.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>"Cogging error.cog\nError: Something Bad!\n"</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>def</span> <span class='nam'>testRealErrorHasTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Test that a genuine error does show a traceback.</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>'error.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> raise RuntimeError("Hey!")</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> //[[[end]]]</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class="strut"> </span></p>
-<p class='pln'> <span class='op'>}</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'error.cog'</span><span class='op'>]</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>msg</span> <span class='op'>=</span> <span class='str'>'Actual output:\n'</span> <span class='op'>+</span> <span class='nam'>output</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assert_</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>startswith</span><span class='op'>(</span><span class='str'>"Cogging error.cog\nTraceback (most recent"</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assert_</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"RuntimeError: Hey!"</span><span class='op'>)</span> <span class='op'>></span> <span class='num'>0</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='exc'><span class='key'>if</span> <span class='nam'>__name__</span> <span class='op'>==</span> <span class='str'>'__main__'</span><span class='op'>:</span> <span class='com'>#pragma: no cover</span><span class="strut"> </span></p>
-<p class='exc'> <span class='nam'>unittest</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'><span class='com'># Things not yet tested:</span><span class="strut"> </span></p>
-<p class='pln'><span class='com'># - A bad -w command (currently fails silently).</span><span class="strut"> </span></p>
+<p class='pln'><span class='str'>""" Test cogapp.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> http://nedbatchelder.com/code/cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Copyright 2004-2009, Ned Batchelder.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>"""</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>unittest</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>os</span><span class='op'>,</span> <span class='nam'>random</span><span class='op'>,</span> <span class='nam'>re</span><span class='op'>,</span> <span class='nam'>StringIO</span><span class='op'>,</span> <span class='nam'>stat</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>,</span> <span class='nam'>tempfile</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>path</span> <span class='com'># Non-standard, from http://www.jorendorff.com/articles/python/path</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>Cog</span><span class='op'>,</span> <span class='nam'>CogOptions</span><span class='op'>,</span> <span class='nam'>CogGenerator</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>CogGeneratedError</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>usage</span><span class='op'>,</span> <span class='nam'>__version__</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>from</span> <span class='nam'>whiteutils</span> <span class='key'>import</span> <span class='nam'>reindentBlock</span><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>from</span> <span class='nam'>makefiles</span> <span class='key'>import</span> <span class='op'>*</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>TestCase</span><span class='op'>(</span><span class='nam'>unittest</span><span class='op'>.</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Base class for all Cog test cases. Adds utility methods I like.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>excClass</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>,</span> <span class='nam'>callableObj</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwargs</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Just like unittest.TestCase.assertRaises,</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> but checks that the message is right too.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>callableObj</span><span class='op'>(</span><span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwargs</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>except</span> <span class='nam'>excClass</span><span class='op'>,</span> <span class='nam'>exc</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>excMsg</span> <span class='op'>=</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>exc</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>msg</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># No message provided: it passes.</span><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>return</span> <span class='com'>#pragma: no cover</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>elif</span> <span class='nam'>excMsg</span> <span class='op'>==</span> <span class='nam'>msg</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Message provided, and we got the right message: it passes.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>else</span><span class='op'>:</span> <span class='com'>#pragma: no cover</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Message provided, and it didn't match: fail!</span><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>(</span><span class='str'>"Right exception, wrong message: got '%s' expected '%s'"</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>excMsg</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>else</span><span class='op'>:</span> <span class='com'>#pragma: no cover</span><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>excClass</span><span class='op'>,</span><span class='str'>'__name__'</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='exc'> <span class='nam'>excName</span> <span class='op'>=</span> <span class='nam'>excClass</span><span class='op'>.</span><span class='nam'>__name__</span><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='exc'> <span class='nam'>excName</span> <span class='op'>=</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>excClass</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>(</span><span class='str'>"Expected to raise %s, didn't get an exception at all"</span> <span class='op'>%</span> <span class='nam'>excName</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogTestsInMemory</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Test cases for cogapp.Cog()</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testNoCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>strings</span> <span class='op'>=</span> <span class='op'>[</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>''</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>' '</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>' \t \t \tx'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'hello'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'the cat\nin the\nhat.'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'Horton\n\tHears A\n\t\tWho'</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Some text.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This is line one\\n")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This is line two")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> gobbledegook.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> epilogue.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Some text.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This is line one\\n")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This is line two")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is line one</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is line two</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> epilogue.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>outfile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testEmptyCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># The cog clause can be totally empty. Not sure why you'd want it,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># but it works.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hello</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> goodbye</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testMultipleCogs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># One file can have many cog chunks, even abutting each other.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out("chunk1")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> chunk1</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out("chunk2")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> chunk2</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> between chunks</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out("chunk3")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> chunk3</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testTrimBlankLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out("This is line one\\n", trimblanklines=True)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out('''</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is line two</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ''', dedent=True, trimblanklines=True)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This is line three", trimblanklines=True)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is line one</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is line two</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is line three</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testTrimEmptyBlankLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out("This is line one\\n", trimblanklines=True)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out('''</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is line two</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ''', dedent=True, trimblanklines=True)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out('', dedent=True, trimblanklines=True)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This is line three", trimblanklines=True)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is line one</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is line two</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is line three</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>test22EndOfLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># In Python 2.2, this cog file was not parsing because the</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># last line is indented but didn't end with a newline.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for i in range(3):</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out("%d\\n" % i)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> 0</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> 1</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> 2</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testIndentedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> first line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for i in range(3):</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out("xx%d\\n" % i)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xx0</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xx1</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xx2</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> last line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testPrefixedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --for i in range(3):</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -- cog.out("xx%d\\n" % i)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xx0</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xx1</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xx2</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testPrefixedIndentedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> prologue</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -- import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -- for i in range(3):</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -- cog.out("xy%d\\n" % i)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xy0</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xy1</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xy2</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testBogusPrefixMatch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> prologue</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> # This comment should not be clobbered by removing the pound sign.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for i in range(3):</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out("xy%d\\n" % i)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xy0</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xy1</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xy2</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testNoFinalNewline</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># If the cog'ed output has no final newline,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># it shouldn't eat up the cog terminator.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> prologue</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for i in range(3):</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out("%d" % i)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> 012</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> epilogue</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testNoOutputAtAll</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># If there is absolutely no cog output, that's ok.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> prologue</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> i = 1</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> epilogue</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testPurelyBlankLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># If there is a blank line in the cog code with no whitespace</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># prefix, that should be OK.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> prologue</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import sys</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out("Hello")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> $</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.out("There")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> HelloThere</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> epilogue</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>'$'</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testEmptyOutl</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Alexander Belchenko suggested the string argument to outl should</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># be optional. Does it work?</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> prologue</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("x")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl()</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("y")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl(trimblanklines=True)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("z")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> x</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='str'> y</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> z</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> epilogue</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testFirstLineNum</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> fooey</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("started at line number %d" % cog.firstLineNum)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> started at line number 2</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> blah blah</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("and again at line %d" % cog.firstLineNum)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> and again at line 8</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testCompactOneLineCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> first line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hey: [[[cog cog.outl("hello %d" % (3*3*3*3)) ]]] looky!</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> get rid of this!</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> last line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> first line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hey: [[[cog cog.outl("hello %d" % (3*3*3*3)) ]]] looky!</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hello 81</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> last line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>outfile</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testInsideOutCompact</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> first line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hey?: ]]] what is this? [[[cog strange!</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> get rid of this!</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> last line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>"infile.txt(2): Cog code markers inverted"</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>"infile.txt"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testSharingGlobals</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> first line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hey: [[[cog s="hey there" ]]] looky!</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> more literal junk.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[cog cog.outl(s) ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> last line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> first line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hey: [[[cog s="hey there" ]]] looky!</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> more literal junk.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[cog cog.outl(s) ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hey there</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> last line</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>outfile</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogOptionsTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Test the CogOptions class.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testEquality</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-r'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertNotEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-r'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testCloning</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'fooey'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'booey'</span><span class='op'>,</span> <span class='str'>'-s'</span><span class='op'>,</span> <span class='str'>' /*x*/'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>o</span><span class='op'>.</span><span class='nam'>clone</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'huey'</span><span class='op'>,</span> <span class='str'>'-D'</span><span class='op'>,</span> <span class='str'>'foo=quux'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertNotEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>q</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>q</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'fooey'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'booey'</span><span class='op'>,</span> <span class='str'>'-s'</span><span class='op'>,</span> <span class='str'>' /*x*/'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'huey'</span><span class='op'>,</span> <span class='str'>'-D'</span><span class='op'>,</span> <span class='str'>'foo=quux'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>p</span><span class='op'>,</span> <span class='nam'>q</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testCombiningFlags</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Single-character flags can be combined.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-e'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-z'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'-erz'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>FileStructureTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Test cases to check that we're properly strict about the structure</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> of files.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>msg</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'infile.txt'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testBeginNoEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Fooey</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl('hello')</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(2): Cog block begun but never ended."</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testNoEoo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Fooey</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl('hello')</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(4): Missing '[[[end]]]' before end of file."</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Fooey</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl('hello')</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl('goodbye')</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(5): Unexpected '[[[cog'"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testStartWithEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(1): Unexpected ']]]'"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl('hello')</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]] </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(5): Unexpected ']]]'"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testStartWithEoo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(1): Unexpected '[[[end]]]'"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl('hello')</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(5): Unexpected '[[[end]]]'"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testNoEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(3): Unexpected '[[[end]]]'"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl('hello')</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(7): Unexpected '[[[end]]]'"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testTwoBegins</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(2): Unexpected '[[[cog'"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(6): Unexpected '[[[cog'"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testTwoEnds</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>"infile.txt(4): Unexpected ']]]'"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>"infile.txt(8): Unexpected ']]]'"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogErrorTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Test cases for cog.error().</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testErrorMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[cog cog.error("This ain't right!")]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogGeneratedError</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>"This ain't right!"</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testErrorNoMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[cog cog.error()]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogGeneratedError</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>"Error raised by cog generator."</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testNoErrorIfErrorNotCalled</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --for i in range(3):</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -- if i > 10:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -- cog.error("Something is amiss!")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> -- cog.out("xx%d\\n" % i)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xx0</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xx1</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> xx2</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogGeneratorGetCodeTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Unit tests against CogGenerator to see if its getCode() method works</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> properly.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" All tests get a generator to use, and short same-length names for</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> the functions we're going to use.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span> <span class='op'>=</span> <span class='nam'>CogGenerator</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseMarker</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseLine</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testEmpty</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// ]]]'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>' print "hello"'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>' print "bye"'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// ]]]'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'print "hello"\nprint "bye"'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testCompressed1</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog: print """'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'// hello'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'// bye'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// """)]]]'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'hello\nbye'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testCompressed2</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog: print """'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'hello'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'bye'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// """)]]]'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'hello\nbye'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testCompressed3</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'print """hello'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'bye'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// """)]]]'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'print """hello\nbye'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testCompressed4</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// [[[cog: print """'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'hello'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'bye""")'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'// ]]]'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'hello\nbye""")'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testNoCommonPrefixForMarkers</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># It's important to be able to use #if 0 to hide lines from a</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># C++ compiler.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'#if 0 //[[[cog'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'\timport cog, sys'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>''</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>'\tprint sys.argv'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>'#endif //]]]'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>'import cog, sys\n\nprint sys.argv'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>TestCaseWithTempDir</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>newCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Initialize the cog members for another run.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Create a cog engine, and catch its output.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span> <span class='op'>=</span> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stdout</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>,</span> <span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Create a temporary directory.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>(</span><span class='nam'>tempfile</span><span class='op'>.</span><span class='nam'>gettempdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>/</span> <span class='op'>(</span><span class='str'>'testcog_tempdir_'</span> <span class='op'>+</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>random</span><span class='op'>.</span><span class='nam'>random</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='op'>[</span><span class='num'>2</span><span class='op'>:</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>.</span><span class='nam'>mkdir</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>olddir</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>olddir</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Get rid of the temporary directory.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>.</span><span class='nam'>rmtree</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFName1</span><span class='op'>,</span> <span class='nam'>sFName2</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName1</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>text</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName2</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>text</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>assertFileContent</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFName</span><span class='op'>,</span> <span class='nam'>sContent</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>sAbsName</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sAbsName</span><span class='op'>,</span> <span class='str'>'rb'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>sFileContent</span> <span class='op'>=</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>finally</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>sFileContent</span><span class='op'>,</span> <span class='nam'>sContent</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>ArgumentHandlingTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testArgumentFailure</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Return value 2 means usage problem.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-j'</span><span class='op'>]</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>2</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"option -j not recognized"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-j'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testNoDashOAndAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> # Please run cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'foo'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testDashV</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-v'</span><span class='op'>]</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='str'>'Cog version %s\n'</span> <span class='op'>%</span> <span class='nam'>__version__</span><span class='op'>,</span> <span class='nam'>output</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>producesHelp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>args</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>argv</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>]</span> <span class='op'>+</span> <span class='nam'>args</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEquals</span><span class='op'>(</span><span class='nam'>usage</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testDashH</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># -h or -? anywhere on the command line should just print help.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>"-h"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>"-?"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>"fooey.txt -h"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>"-o -r @fooey.txt -? @booey.txt"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testDashOAndDashR</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cogfile.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> # Please run cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'foo'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'cogfile.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testDashZ</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> // This is my C++ file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for fn in fnames:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> // This is my C++ file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for fn in fnames:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoSomething();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoAnotherThing();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoLastThing();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>"test.cog(6): Missing '[[[end]]]' before end of file."</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-z'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testBadDashD</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-Dfooey'</span><span class='op'>,</span> <span class='str'>'cog.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-D'</span><span class='op'>,</span> <span class='str'>'fooey'</span><span class='op'>,</span> <span class='str'>'cog.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>TestFileHandling</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> // This is my C++ file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for fn in fnames:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> // This is my C++ file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for fn in fnames:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoSomething();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoAnotherThing();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoLastThing();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"(changed)"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testOutputFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># -o sets the output file.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> // This is my C++ file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for fn in fnames:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> // This is my C++ file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for fn in fnames:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoSomething();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoAnotherThing();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoLastThing();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'one.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello world")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'one.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello world")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hello world</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'two.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("goodbye cruel world")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'two.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("goodbye cruel world")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> goodbye cruel world</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> # Please run cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> one.cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> two.cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'one.cog'</span><span class='op'>,</span> <span class='str'>'one.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'two.cog'</span><span class='op'>,</span> <span class='str'>'two.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"(changed)"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testNestedAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'one.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello world")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'one.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello world")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hello world</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'two.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("goodbye cruel world")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'two.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("goodbye cruel world")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> goodbye cruel world</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> # Please run cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> one.cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> @cogfiles2.txt</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cogfiles2.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> # This one too, please.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> two.cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'one.cog'</span><span class='op'>,</span> <span class='str'>'one.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'two.cog'</span><span class='op'>,</span> <span class='str'>'two.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"(changed)"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testAtFileWithArgs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'both.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("one: %s" % globals().has_key('one'))</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("two: %s" % globals().has_key('two'))</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'one.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("one: %s" % globals().has_key('one'))</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("two: %s" % globals().has_key('two'))</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> one: True // ONE</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> two: False // ONE</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'two.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("one: %s" % globals().has_key('one'))</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("two: %s" % globals().has_key('two'))</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> one: False // TWO</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> two: True // TWO</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> # Please run cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> both.cog -o both.one -s ' // ONE' -D one=x</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> both.cog -o both.two -s ' // TWO' -D two=x</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'both.one'</span><span class='op'>,</span> <span class='str'>'one.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'both.two'</span><span class='op'>,</span> <span class='str'>'two.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testAtFileWithBadArgCombo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'both.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("one: %s" % globals().has_key('one'))</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("two: %s" % globals().has_key('two'))</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> # Please run cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> both.cog </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> both.cog -d # This is bad: -r and -d</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testAtFileWithTrickyFilenames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'one 1.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog cog.outl("hello world") ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'one.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog cog.outl("hello world") ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hello world //xxx</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'subdir'</span><span class='op'>:</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'subback.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog cog.outl("down deep with backslashes") ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'subfwd.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog cog.outl("down deep with slashes") ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'subback.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog cog.outl("down deep with backslashes") ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> down deep with backslashes //yyy</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'subfwd.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog cog.outl("down deep with slashes") ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> down deep with slashes //zzz</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> # Please run cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> 'one 1.cog' -s ' //xxx'</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> subdir\subback.cog -s ' //yyy'</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> subdir/subfwd.cog -s ' //zzz'</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-z'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'one 1.cog'</span><span class='op'>,</span> <span class='str'>'one.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'subdir/subback.cog'</span><span class='op'>,</span> <span class='str'>'subback.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'subdir/subfwd.cog'</span><span class='op'>,</span> <span class='str'>'subfwd.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogTestLineEndings</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>"""Tests for -U option (force LF line-endings in output)."""</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>lines_in</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'Some text.'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'//[[[cog'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog.outl("Cog text")'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'//]]]'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'gobbledegook.'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'//[[[end]]]'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'epilogue.'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>''</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>lines_out</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'Some text.'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'//[[[cog'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog.outl("Cog text")'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'//]]]'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'Cog text'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'//[[[end]]]'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'epilogue.'</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>''</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testOutputNativeEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>'infile'</span><span class='op'>:</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'outfile'</span><span class='op'>,</span> <span class='str'>'infile'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>'outfile'</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testOutputLfEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>'infile'</span><span class='op'>:</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-U'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'outfile'</span><span class='op'>,</span> <span class='str'>'infile'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>'outfile'</span><span class='op'>,</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testReplaceNativeEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testReplaceLfEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-U'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>TestCaseWithImports</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" When running tests which import modules, the sys.modules list</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> leaks from one test to the next. This test case class scrubs</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> the list after each run to keep the tests isolated from each other.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sysmodulekeys</span> <span class='op'>=</span> <span class='nam'>list</span><span class='op'>(</span><span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>modstoscrub</span> <span class='op'>=</span> <span class='op'>[</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>modname</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>for</span> <span class='nam'>modname</span> <span class='key'>in</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='strut'> </span></p>
+<p class='pln'> <span class='key'>if</span> <span class='nam'>modname</span> <span class='key'>not</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sysmodulekeys</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>for</span> <span class='nam'>modname</span> <span class='key'>in</span> <span class='nam'>modstoscrub</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>del</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='op'>[</span><span class='nam'>modname</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogIncludeTests</span><span class='op'>(</span><span class='nam'>TestCaseWithImports</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>dincludes</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import mymodule</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import mymodule</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Hello from mymodule</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test2.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import mymodule</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Hello from mymodule in inc2</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'include'</span><span class='op'>:</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'mymodule.py'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("Hello from mymodule")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'inc2'</span><span class='op'>:</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'mymodule.py'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("Hello from mymodule in inc2")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'inc3'</span><span class='op'>:</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'someothermodule.py'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This is some other module.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testNeedIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Try it without the -I, to see that an ImportError happens.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>ImportError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Test that -I adds include directories properly.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'include'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testTwoIncludePaths</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Test that two -I's add include directories properly.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'include'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'inc2'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testTwoIncludePaths2</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Test that two -I's add include directories properly.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'inc2'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'include'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test2.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testUselessIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Test that the search will continue past the first directory.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'inc3'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'include'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testSysPathIsUnchanged</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'bad.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog cog.error("Oh no!") ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'good.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog cog.outl("Oh yes!") ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Is it unchanged just by creating a cog engine?</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>oldsyspath</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>[</span><span class='op'>:</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Is it unchanged for a successful run?</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'good.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Is it unchanged for a successful run with includes?</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'xyzzy'</span><span class='op'>,</span> <span class='str'>'good.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Is it unchanged for a successful run with two includes?</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'xyzzy'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'quux'</span><span class='op'>,</span> <span class='str'>'good.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Is it unchanged for a failed run?</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'bad.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Is it unchanged for a failed run with includes?</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'xyzzy'</span><span class='op'>,</span> <span class='str'>'bad.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Is it unchanged for a failed run with two includes?</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'xyzzy'</span><span class='op'>,</span> <span class='str'>'-I'</span><span class='op'>,</span> <span class='str'>'quux'</span><span class='op'>,</span> <span class='str'>'bad.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testSubDirectories</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Test that relative paths on the command line work, with includes.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'code'</span><span class='op'>:</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import mysubmodule</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import mysubmodule</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Hello from mysubmodule</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'mysubmodule.py'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> import cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("Hello from mysubmodule")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># We should be able to invoke cog without the -I switch, and it will</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># auto-include the current directory</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'code/test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'code/test.cog'</span><span class='op'>,</span> <span class='str'>'code/test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>CogTestsInFiles</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testWarnIfNoCogCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Test that the -e switch warns if there is no Cog code.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'with.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("hello world")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> hello world</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'without.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> There's no cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> code in this file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-e'</span><span class='op'>,</span> <span class='str'>'with.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"Warning"</span><span class='op'>)</span> <span class='op'><</span> <span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-e'</span><span class='op'>,</span> <span class='str'>'without.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"Warning: no cog code found in without.cog"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'without.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"Warning"</span><span class='op'>)</span> <span class='op'><</span> <span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testFileNameProps</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This is %s in, %s out" % (cog.inFile, cog.outFile))</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> this is cog1.txt in, cog1.txt out</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This is %s in, %s out" % (cog.inFile, cog.outFile))</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is cog1.txt in, cog1.txt out</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1out.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This is %s in, %s out" % (cog.inFile, cog.outFile))</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This is cog1.txt in, cog1out.txt out</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> [[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'cog1out.txt'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1out.txt'</span><span class='op'>,</span> <span class='str'>'cog1out.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testGlobalsDontCrossFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Make sure that global values don't get shared between files.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'one.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog s = "This was set in one.cog" ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog cog.outl(s) ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'one.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog s = "This was set in one.cog" ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog cog.outl(s) ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This was set in one.cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'two.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> try:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl(s)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> except NameError:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("s isn't set!")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'two.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> try:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl(s)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> except NameError:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("s isn't set!")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> s isn't set!</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cogfiles.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> # Please run cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> one.cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> two.cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'@cogfiles.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'one.cog'</span><span class='op'>,</span> <span class='str'>'one.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'two.cog'</span><span class='op'>,</span> <span class='str'>'two.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"(changed)"</span><span class='op'>)</span> <span class='op'>>=</span> <span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testRemoveGeneratedOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was generated.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was generated.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was not.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was generated.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was not.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.out2'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was generated.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was generated.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was not.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Remove generated output.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-x'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Regenerate the generated output.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out2'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Remove the generated output again.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-x'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testMsgCall</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.msg("Hello there!")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> #[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>"Message: Hello there!\n"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testErrorMessageHasNoTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Test that a Cog error is printed to stderr with no traceback.</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Xhis line was newly</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> generated by cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> blah blah.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>stderr</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>"cog1.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>"Cogging cog1.txt\n"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>"cog1.txt(9): Output has been edited! Delete old checksum to unprotect.\n"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testDashD</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[cog cog.outl("Defined fooey as " + fooey) ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.kablooey'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[cog cog.outl("Defined fooey as " + fooey) ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Defined fooey as kablooey</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.einstein'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[cog cog.outl("Defined fooey as " + fooey) ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Defined fooey as e=mc2</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-D'</span><span class='op'>,</span> <span class='str'>'fooey=kablooey'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.kablooey'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-Dfooey=kablooey'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.kablooey'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-Dfooey=e=mc2'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.einstein'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-Dbar=quux'</span><span class='op'>,</span> <span class='str'>'-Dfooey=kablooey'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.kablooey'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-Dfooey=kablooey'</span><span class='op'>,</span> <span class='str'>'-Dbar=quux'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.kablooey'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-Dfooey=gooey'</span><span class='op'>,</span> <span class='str'>'-Dfooey=kablooey'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.kablooey'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testOutputToStdout</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[cog cog.outl('Hey there!') ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> --[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>stderr</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>outerr</span> <span class='op'>=</span> <span class='nam'>stderr</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>"--[[[cog cog.outl('Hey there!') ]]]\nHey there!\n--[[[end]]]\n"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>outerr</span><span class='op'>,</span> <span class='str'>""</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testSuffixOutputLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Hey there.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\nb\\n \\nc') ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ;[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Good bye.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Hey there.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\nb\\n \\nc') ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> a (foo)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> b (foo)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> c (foo)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ;[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Good bye.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-s'</span><span class='op'>,</span> <span class='str'>' (foo)'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testEmptySuffix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\nb\\nc') ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ;[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\nb\\nc') ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> a</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> b</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> c</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ;[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-s'</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testHellishSuffix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\n\\nb') ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> ;[[[cog cog.outl('a\\n\\nb') ]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> a /\\n*+([)]><</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> b /\\n*+([)]><</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-z'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-s'</span><span class='op'>,</span> <span class='str'>r' /\n*+([)]><'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>WritabilityTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for fn in ['DoSomething', 'DoAnotherThing', 'DoLastThing']:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for fn in ['DoSomething', 'DoAnotherThing', 'DoLastThing']:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoSomething();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoAnotherThing();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoLastThing();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>if</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>name</span> <span class='op'>==</span> <span class='str'>'nt'</span><span class='op'>:</span> <span class='com'># pragma: no cover</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># for Windows</span><span class='strut'> </span></p>
+<p class='exc'> <span class='nam'>cmd_w_args</span> <span class='op'>=</span> <span class='str'>'attrib -R %s'</span><span class='strut'> </span></p>
+<p class='exc'> <span class='nam'>cmd_w_asterisk</span> <span class='op'>=</span> <span class='str'>'attrib -R *'</span><span class='strut'> </span></p>
+<p class='exc'> <span class='key'>else</span><span class='op'>:</span> <span class='com'># pragma: no cover</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># for unix-like</span><span class='strut'> </span></p>
+<p class='exc'> <span class='nam'>cmd_w_args</span> <span class='op'>=</span> <span class='str'>'chmod +w %s'</span><span class='strut'> </span></p>
+<p class='exc'> <span class='nam'>cmd_w_asterisk</span> <span class='op'>=</span> <span class='str'>'chmod +w *'</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='str'>'test.cog'</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>.</span><span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>stat</span><span class='op'>.</span><span class='nam'>S_IREAD</span><span class='op'>)</span> <span class='com'># Make the file readonly.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>.</span><span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>stat</span><span class='op'>.</span><span class='nam'>S_IWRITE</span><span class='op'>)</span> <span class='com'># Make the file writable again.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testReadonlyNoCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>"Can't overwrite test.cog"</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testReadonlyWithCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-w'</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cmd_w_args</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testReadonlyWithCommandWithNoSlot</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-w'</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cmd_w_asterisk</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testReadonlyWithIneffectualCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>"Couldn't make test.cog writable"</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-w'</span><span class='op'>,</span> <span class='str'>'echo %s'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>ChecksumTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testCreateChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was generated.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was generated.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was not.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was generated.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was generated.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was not.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testCheckChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was generated.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was newly</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> generated by cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> blah blah.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testRemoveChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was generated.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893) fooey</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was newly</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> generated by cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> blah blah.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] fooey</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'cog1.txt'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'cog1.txt'</span><span class='op'>,</span> <span class='str'>'cog1.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testTamperedChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog1.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Xhis line was newly</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> generated by cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> blah blah.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog2.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was newly</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> generated by cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> blah blah!</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog3.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was newly</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> generated by cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> blah blah.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog4.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was newly</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> generated by cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> blah blah..</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog5.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> This line was newly</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> generated by cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> blah blah.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> extra</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'cog6.txt'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("This line was newly")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("generated by cog")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("blah blah.")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>"cog1.txt(9): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog1.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>"cog2.txt(9): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog2.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>"cog3.txt(10): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog3.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>"cog4.txt(9): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog4.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>"cog5.txt(10): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog5.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>"cog6.txt(6): Output has been edited! Delete old checksum to unprotect."</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-c'</span><span class='op'>,</span> <span class='str'>"cog6.txt"</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>BlakeTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Blake Winton's contributions. </span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testDeleteCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># -o sets the output file.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> // This is my C++ file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> fnames = ['DoSomething', 'DoAnotherThing', 'DoLastThing']</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for fn in fnames:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Some Sample Code Here</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]Data Data</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> And Some More</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> // This is my C++ file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoSomething();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoAnotherThing();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoLastThing();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> And Some More</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-d'</span><span class='op'>,</span> <span class='str'>'-o'</span><span class='op'>,</span> <span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testDeleteCodeWithDashRFails</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> // This is my C++ file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'-d'</span><span class='op'>,</span> <span class='str'>'test.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testSettingGlobals</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Blake Winton contributed a way to set the globals that will be used in</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># processFile().</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> // This is my C++ file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> for fn in fnames:</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.outl("void %s();" % fn)</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Some Sample Code Here</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]"""</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'test.out'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> // This is my C++ file.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoBlake();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoWinton();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> void DoContribution();</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>globals</span> <span class='op'>=</span> <span class='op'>{</span><span class='op'>}</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>globals</span><span class='op'>[</span><span class='str'>'fnames'</span><span class='op'>]</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>'DoBlake'</span><span class='op'>,</span> <span class='str'>'DoWinton'</span><span class='op'>,</span> <span class='str'>'DoContribution'</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='str'>'test.cog'</span><span class='op'>,</span> <span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>=</span><span class='nam'>globals</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>'test.cogged'</span><span class='op'>,</span> <span class='str'>'test.out'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>ErrorCallTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testErrorCallHasNoTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Test that cog.error() doesn't show a traceback.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'error.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> cog.error("Something Bad!")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'error.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>"Cogging error.cog\nError: Something Bad!\n"</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>def</span> <span class='nam'>testRealErrorHasTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Test that a genuine error does show a traceback.</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>'error.cog'</span><span class='op'>:</span> <span class='str'>"""\</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> raise RuntimeError("Hey!")</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> //[[[end]]]</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='op'>,</span><span class='strut'> </span></p>
+<p class='pln'> <span class='op'>}</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>'argv0'</span><span class='op'>,</span> <span class='str'>'-r'</span><span class='op'>,</span> <span class='str'>'error.cog'</span><span class='op'>]</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>msg</span> <span class='op'>=</span> <span class='str'>'Actual output:\n'</span> <span class='op'>+</span> <span class='nam'>output</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assert_</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>startswith</span><span class='op'>(</span><span class='str'>"Cogging error.cog\nTraceback (most recent"</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assert_</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>"RuntimeError: Hey!"</span><span class='op'>)</span> <span class='op'>></span> <span class='num'>0</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='exc'><span class='key'>if</span> <span class='nam'>__name__</span> <span class='op'>==</span> <span class='str'>'__main__'</span><span class='op'>:</span> <span class='com'>#pragma: no cover</span><span class='strut'> </span></p>
+<p class='exc'> <span class='nam'>unittest</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'><span class='com'># Things not yet tested:</span><span class='strut'> </span></p>
+<p class='pln'><span class='com'># - A bad -w command (currently fails silently).</span><span class='strut'> </span></p>
</td>
</tr>
diff --git a/doc/sample_html/cogapp_whiteutils.html b/doc/sample_html/cogapp_whiteutils.html index b2aaf86..3fbdc30 100644 --- a/doc/sample_html/cogapp_whiteutils.html +++ b/doc/sample_html/cogapp_whiteutils.html @@ -1,19 +1,21 @@ -<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
+<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Coverage for cogapp\whiteutils</title>
<link rel='stylesheet' href='style.css' type='text/css'>
-<script src='jquery-1.3.2.min.js'></script>
-<script>
+<script type='text/javascript' src='jquery-1.3.2.min.js'></script>
+<script type='text/javascript'>
function toggle_lines(btn, cls) {
var btn = $(btn);
- if (btn.hasClass("hide")) {
- $("#source ."+cls).removeClass("hide");
- btn.removeClass("hide");
+ var hide = "hide_"+cls;
+ if (btn.hasClass(hide)) {
+ $("#source ."+cls).removeClass(hide);
+ btn.removeClass(hide);
}
else {
- $("#source ."+cls).addClass("hide");
- btn.addClass("hide");
+ $("#source ."+cls).addClass(hide);
+ btn.addClass(hide);
}
}
</script>
@@ -26,9 +28,12 @@ function toggle_lines(btn, cls) { </h1>
<h2 class='stats'>
37 statements
- <span class='run hide' onclick='toggle_lines(this, "run")'>34 run</span>
+ <span class='run hide_run' onclick='toggle_lines(this, "run")'>34 run</span>
<span class='exc' onclick='toggle_lines(this, "exc")'>0 excluded</span>
<span class='mis' onclick='toggle_lines(this, "mis")'>3 missing</span>
+
+ <span class='par run hide_run' onclick='toggle_lines(this, "par")'>2 partial</span>
+
</h2>
</div>
</div>
@@ -43,129 +48,129 @@ function toggle_lines(btn, cls) { <p class='pln'>4</p>
<p class='pln'>5</p>
<p class='pln'>6</p>
-<p class='stm run hide'>7</p>
+<p class='stm run hide_run'>7</p>
<p class='pln'>8</p>
-<p class='stm run hide'>9</p>
+<p class='stm run hide_run'>9</p>
<p class='pln'>10</p>
<p class='pln'>11</p>
<p class='pln'>12</p>
<p class='pln'>13</p>
-<p class='stm run hide'>14</p>
+<p class='stm run hide_run'>14</p>
<p class='pln'>15</p>
-<p class='stm run hide'>16</p>
+<p class='stm run hide_run'>16</p>
<p class='pln'>17</p>
<p class='pln'>18</p>
<p class='pln'>19</p>
-<p class='stm run hide'>20</p>
+<p class='stm run hide_run'>20</p>
<p class='pln'>21</p>
<p class='pln'>22</p>
<p class='pln'>23</p>
-<p class='stm run hide'>24</p>
-<p class='stm run hide'>25</p>
-<p class='stm run hide'>26</p>
+<p class='stm run hide_run'>24</p>
+<p class='stm run hide_run'>25</p>
+<p class='stm par run hide_run'>26</p>
<p class='stm mis'>27</p>
<p class='stm mis'>28</p>
-<p class='stm run hide'>29</p>
+<p class='stm run hide_run'>29</p>
<p class='pln'>30</p>
-<p class='stm run hide'>31</p>
+<p class='stm run hide_run'>31</p>
<p class='pln'>32</p>
<p class='pln'>33</p>
<p class='pln'>34</p>
<p class='pln'>35</p>
-<p class='stm run hide'>36</p>
-<p class='stm run hide'>37</p>
-<p class='stm run hide'>38</p>
-<p class='stm run hide'>39</p>
-<p class='stm run hide'>40</p>
-<p class='stm run hide'>41</p>
-<p class='stm run hide'>42</p>
-<p class='stm run hide'>43</p>
-<p class='stm run hide'>44</p>
-<p class='stm run hide'>45</p>
-<p class='stm run hide'>46</p>
+<p class='stm run hide_run'>36</p>
+<p class='stm run hide_run'>37</p>
+<p class='stm run hide_run'>38</p>
+<p class='stm run hide_run'>39</p>
+<p class='stm run hide_run'>40</p>
+<p class='stm run hide_run'>41</p>
+<p class='stm run hide_run'>42</p>
+<p class='stm run hide_run'>43</p>
+<p class='stm run hide_run'>44</p>
+<p class='stm run hide_run'>45</p>
+<p class='stm run hide_run'>46</p>
<p class='pln'>47</p>
-<p class='stm run hide'>48</p>
+<p class='stm run hide_run'>48</p>
<p class='pln'>49</p>
<p class='pln'>50</p>
-<p class='stm run hide'>51</p>
+<p class='stm par run hide_run'>51</p>
<p class='stm mis'>52</p>
-<p class='stm run hide'>53</p>
-<p class='stm run hide'>54</p>
-<p class='stm run hide'>55</p>
-<p class='stm run hide'>56</p>
-<p class='stm run hide'>57</p>
-<p class='stm run hide'>58</p>
-<p class='stm run hide'>59</p>
-<p class='stm run hide'>60</p>
-<p class='stm run hide'>61</p>
-<p class='stm run hide'>62</p>
-<p class='stm run hide'>63</p>
+<p class='stm run hide_run'>53</p>
+<p class='stm run hide_run'>54</p>
+<p class='stm run hide_run'>55</p>
+<p class='stm run hide_run'>56</p>
+<p class='stm run hide_run'>57</p>
+<p class='stm run hide_run'>58</p>
+<p class='stm run hide_run'>59</p>
+<p class='stm run hide_run'>60</p>
+<p class='stm run hide_run'>61</p>
+<p class='stm run hide_run'>62</p>
+<p class='stm run hide_run'>63</p>
</td>
<td class='text' valign='top'>
-<p class='pln'><span class='str'>""" Indentation utilities for Cog.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> http://nedbatchelder.com/code/cog</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> </span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Copyright 2004-2009, Ned Batchelder.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'>"""</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>import</span> <span class='nam'>re</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>def</span> <span class='nam'>whitePrefix</span><span class='op'>(</span><span class='nam'>strings</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Determine the whitespace prefix common to all non-blank lines</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> in the argument list.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Remove all blank lines from the list</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>strings</span> <span class='op'>=</span> <span class='op'>[</span><span class='nam'>s</span> <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span> <span class='key'>if</span> <span class='nam'>s</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>!=</span> <span class='str'>''</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>strings</span><span class='op'>:</span> <span class='key'>return</span> <span class='str'>''</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Find initial whitespace chunk in the first line.</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># This is the best prefix we can hope for.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>match</span><span class='op'>(</span><span class='str'>r'\s*'</span><span class='op'>,</span> <span class='nam'>strings</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>group</span><span class='op'>(</span><span class='num'>0</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># Loop over the other strings, keeping only as much of</span><span class="strut"> </span></p>
-<p class='pln'> <span class='com'># the prefix as matches each string.</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>for</span> <span class='nam'>i</span> <span class='key'>in</span> <span class='nam'>range</span><span class='op'>(</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span> <span class='op'>!=</span> <span class='nam'>s</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='op'>:</span><span class='nam'>i</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>break</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='nam'>prefix</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>def</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>,</span> <span class='nam'>newIndent</span><span class='op'>=</span><span class='str'>''</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Take a block of text as a string or list of lines.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Remove any common whitespace indentation.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> Re-indent using newIndent, and return it as a single string.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>lines</span> <span class='op'>=</span> <span class='nam'>lines</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>'\n'</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>oldIndent</span> <span class='op'>=</span> <span class='nam'>whitePrefix</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>outLines</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>lines</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>oldIndent</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>oldIndent</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='nam'>newIndent</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>newIndent</span> <span class='op'>+</span> <span class='nam'>l</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>outLines</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>outLines</span><span class='op'>)</span><span class="strut"> </span></p>
-<p class='pln'><span class="strut"> </span></p>
-<p class='stm run hide'><span class='key'>def</span> <span class='nam'>commonPrefix</span><span class='op'>(</span><span class='nam'>strings</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='pln'> <span class='str'>""" Find the longest string that is a prefix of all the strings.</span><span class="strut"> </span></p>
-<p class='pln'><span class='str'> """</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>strings</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm mis'> <span class='key'>return</span> <span class='str'>''</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>strings</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span> <span class='op'><</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='op'>:</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>prefix</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='str'>''</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>for</span> <span class='nam'>i</span> <span class='key'>in</span> <span class='nam'>range</span><span class='op'>(</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>if</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span> <span class='op'>!=</span> <span class='nam'>s</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span><span class='op'>:</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='op'>:</span><span class='nam'>i</span><span class='op'>]</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>break</span><span class="strut"> </span></p>
-<p class='stm run hide'> <span class='key'>return</span> <span class='nam'>prefix</span><span class="strut"> </span></p>
+<p class='pln'><span class='str'>""" Indentation utilities for Cog.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> http://nedbatchelder.com/code/cog</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> </span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Copyright 2004-2009, Ned Batchelder.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'>"""</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>re</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>whitePrefix</span><span class='op'>(</span><span class='nam'>strings</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Determine the whitespace prefix common to all non-blank lines</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> in the argument list.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Remove all blank lines from the list</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>strings</span> <span class='op'>=</span> <span class='op'>[</span><span class='nam'>s</span> <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span> <span class='key'>if</span> <span class='nam'>s</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>!=</span> <span class='str'>''</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>strings</span><span class='op'>:</span> <span class='key'>return</span> <span class='str'>''</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Find initial whitespace chunk in the first line.</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># This is the best prefix we can hope for.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>match</span><span class='op'>(</span><span class='str'>r'\s*'</span><span class='op'>,</span> <span class='nam'>strings</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>group</span><span class='op'>(</span><span class='num'>0</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># Loop over the other strings, keeping only as much of</span><span class='strut'> </span></p>
+<p class='pln'> <span class='com'># the prefix as matches each string.</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>for</span> <span class='nam'>i</span> <span class='key'>in</span> <span class='nam'>range</span><span class='op'>(</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>27</span> <span class='key'>if</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span> <span class='op'>!=</span> <span class='nam'>s</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='op'>:</span><span class='nam'>i</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>break</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='nam'>prefix</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>,</span> <span class='nam'>newIndent</span><span class='op'>=</span><span class='str'>''</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Take a block of text as a string or list of lines.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Remove any common whitespace indentation.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> Re-indent using newIndent, and return it as a single string.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>lines</span> <span class='op'>=</span> <span class='nam'>lines</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>'\n'</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>oldIndent</span> <span class='op'>=</span> <span class='nam'>whitePrefix</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>outLines</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>lines</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>oldIndent</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>oldIndent</span><span class='op'>,</span> <span class='str'>''</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='nam'>newIndent</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>newIndent</span> <span class='op'>+</span> <span class='nam'>l</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>outLines</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='str'>'\n'</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>outLines</span><span class='op'>)</span><span class='strut'> </span></p>
+<p class='pln'><span class='strut'> </span></p>
+<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>commonPrefix</span><span class='op'>(</span><span class='nam'>strings</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='pln'> <span class='str'>""" Find the longest string that is a prefix of all the strings.</span><span class='strut'> </span></p>
+<p class='pln'><span class='str'> """</span><span class='strut'> </span></p>
+<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>52</span> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>strings</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm mis'> <span class='key'>return</span> <span class='str'>''</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>strings</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span> <span class='op'><</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='op'>:</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>prefix</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='str'>''</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>for</span> <span class='nam'>i</span> <span class='key'>in</span> <span class='nam'>range</span><span class='op'>(</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>if</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span> <span class='op'>!=</span> <span class='nam'>s</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span><span class='op'>:</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='op'>:</span><span class='nam'>i</span><span class='op'>]</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>break</span><span class='strut'> </span></p>
+<p class='stm run hide_run'> <span class='key'>return</span> <span class='nam'>prefix</span><span class='strut'> </span></p>
</td>
</tr>
diff --git a/doc/sample_html/coverage_html.js b/doc/sample_html/coverage_html.js new file mode 100644 index 0000000..c0abab8 --- /dev/null +++ b/doc/sample_html/coverage_html.js @@ -0,0 +1,64 @@ +// Coverage.py HTML report browser code. + +// Loaded on index.html +function index_page_ready($) { + // Look for a cookie containing previous sort settings: + sort_list = []; + cookie_name = "COVERAGE_INDEX_SORT"; + + // This almost makes it worth installing the jQuery cookie plugin: + if (document.cookie.indexOf(cookie_name) > -1) { + cookies = document.cookie.split(";"); + for (var i=0; i < cookies.length; i++) { + parts = cookies[i].split("=") + + if ($.trim(parts[0]) == cookie_name && parts[1]) { + sort_list = eval("[[" + parts[1] + "]]"); + break; + } + } + } + + // Create a new widget which exists only to save and restore + // the sort order: + $.tablesorter.addWidget({ + id: "persistentSort", + + // Format is called by the widget before displaying: + format: function(table) { + if (table.config.sortList.length == 0 && sort_list.length > 0) { + // This table hasn't been sorted before - we'll use + // our stored settings: + jQuery(table).trigger('sorton', [sort_list]); + } + else { + // This is not the first load - something has + // already defined sorting so we'll just update + // our stored value to match: + sort_list = table.config.sortList; + } + } + }); + + // Configure our tablesorter to handle the variable number of + // columns produced depending on report options: + var headers = {}; + var col_count = jQuery("table.index > thead > tr > th").length; + + headers[0] = { sorter: 'text' }; + for (var i = 1; i < col_count-1; i++) { + headers[i] = { sorter: 'digit' }; + } + headers[col_count-1] = { sorter: 'percent' }; + + // Enable the table sorter: + $("table.index").tablesorter({ + widgets: ['persistentSort'], + headers: headers + }); + + // Watch for page unload events so we can save the final sort settings: + $(window).unload(function() { + document.cookie = cookie_name + "=" + sort_list.toString() + "; path=/" + }); +} diff --git a/doc/sample_html/index.html b/doc/sample_html/index.html index c44d355..dd78fe4 100644 --- a/doc/sample_html/index.html +++ b/doc/sample_html/index.html @@ -1,86 +1,128 @@ -<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
-<head>
-<title>Coverage report</title>
-<link rel='stylesheet' href='style.css' type='text/css'>
-</head>
-<body>
+ <head>
+ <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
+ <title>Coverage report</title>
+ <link rel='stylesheet' href='style.css' type='text/css'>
+ <script type='text/javascript' src='jquery-1.3.2.min.js'></script>
+ <script type='text/javascript' src='jquery.tablesorter.min.js'></script>
+ <script type='text/javascript' src='coverage_html.js'></script>
+ <script type="text/javascript" charset="utf-8">
+ jQuery(document).ready(index_page_ready);
+ </script>
+ </head>
+ <body>
-<div id='header'>
- <div class='content'>
- <h1>Coverage report:
- <span class='pc_cov'>43%</span>
- </h1>
- </div>
-</div>
+ <div id='header'>
+ <div class='content'>
+ <h1>Coverage report:
+ <span class='pc_cov'>41%</span>
+ </h1>
+ </div>
+ </div>
-<div id='index'>
-<table class='index'>
-<tr>
- <th class='name'>Module</th>
- <th>statements</th>
- <th>run</th>
- <th>excluded</th>
- <th>coverage</th>
-</tr>
+ <div id='index'>
+ <table class='index'>
+ <thead>
+
+ <tr class='tablehead' title='Click to sort'>
+ <th class='name left headerSortDown'>Module</th>
+ <th>statements</th>
+ <th>run</th>
+ <th>excluded</th>
+
+ <th>branches</th>
+ <th>br exec</th>
+
+ <th class='right'>coverage</th>
+ </tr>
+ </thead>
+
+ <tfoot>
+ <tr class='total'>
+ <td class='name left'>Total</td>
+ <td>1326</td>
+ <td>568</td>
+ <td>23</td>
+
+ <td>305</td>
+ <td>104</td>
+
+ <td class='right'>41%</td>
+ </tr>
+ </tfoot>
+ <tbody>
+
+ <tr class='file'>
+ <td class='name left'><a href='_ned_py_path.html'>c:\ned\py\path</a></td>
+ <td>286</td>
+ <td>114</td>
+ <td>0</td>
+
+ <td>104</td>
+ <td>22</td>
+
+ <td class='right'>35%</td>
+ </tr>
+
+ <tr class='file'>
+ <td class='name left'><a href='cogapp_cogapp.html'>cogapp\cogapp</a></td>
+ <td>387</td>
+ <td>219</td>
+ <td>3</td>
+
+ <td>153</td>
+ <td>54</td>
+
+ <td class='right'>51%</td>
+ </tr>
+
+ <tr class='file'>
+ <td class='name left'><a href='cogapp_makefiles.html'>cogapp\makefiles</a></td>
+ <td>29</td>
+ <td>6</td>
+ <td>3</td>
+
+ <td>16</td>
+ <td>0</td>
+
+ <td class='right'>13%</td>
+ </tr>
+
+ <tr class='file'>
+ <td class='name left'><a href='cogapp_test_cogapp.html'>cogapp\test_cogapp</a></td>
+ <td>587</td>
+ <td>195</td>
+ <td>17</td>
+
+ <td>4</td>
+ <td>2</td>
+
+ <td class='right'>33%</td>
+ </tr>
+
+ <tr class='file'>
+ <td class='name left'><a href='cogapp_whiteutils.html'>cogapp\whiteutils</a></td>
+ <td>37</td>
+ <td>34</td>
+ <td>0</td>
+
+ <td>28</td>
+ <td>26</td>
+
+ <td class='right'>92%</td>
+ </tr>
+
+ </tbody>
+ </table>
+ </div>
-<tr>
- <td class='name'><a href='_ned_py_path.html'>c:\ned\py\path</a></td>
- <td>286</td>
- <td>114</td>
- <td>0</td>
- <td>40%</td>
-</tr>
-
-<tr>
- <td class='name'><a href='cogapp_cogapp.html'>cogapp\cogapp</a></td>
- <td>387</td>
- <td>219</td>
- <td>3</td>
- <td>57%</td>
-</tr>
-
-<tr>
- <td class='name'><a href='cogapp_makefiles.html'>cogapp\makefiles</a></td>
- <td>29</td>
- <td>6</td>
- <td>3</td>
- <td>21%</td>
-</tr>
-
-<tr>
- <td class='name'><a href='cogapp_test_cogapp.html'>cogapp\test_cogapp</a></td>
- <td>587</td>
- <td>195</td>
- <td>17</td>
- <td>33%</td>
-</tr>
-
-<tr>
- <td class='name'><a href='cogapp_whiteutils.html'>cogapp\whiteutils</a></td>
- <td>37</td>
- <td>34</td>
- <td>0</td>
- <td>92%</td>
-</tr>
-
-<tr class='total'>
-<td class='name'>Total</td>
-<td>1326</td>
-<td>568</td>
-<td>23</td>
-<td>43%</td>
-</tr>
-</table>
-</div>
-
-<div id='footer'>
- <div class='content'>
- <p>
- <a class='nav' href='http://nedbatchelder.com/code/coverage'>coverage.py v3.1</a>
- </p>
- </div>
-</div>
-
-</body>
+ <div id='footer'>
+ <div class='content'>
+ <p>
+ <a class='nav' href='http://nedbatchelder.com/code/coverage'>coverage.py v3.2</a>
+ </p>
+ </div>
+ </div>
+ </body>
</html>
diff --git a/doc/sample_html/jquery.tablesorter.min.js b/doc/sample_html/jquery.tablesorter.min.js new file mode 100644 index 0000000..64c7007 --- /dev/null +++ b/doc/sample_html/jquery.tablesorter.min.js @@ -0,0 +1,2 @@ + +(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,cells[i]);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,node){var l=parsers.length;for(var i=1;i<l;i++){if(parsers[i].is($.trim(getElementText(table.config,node)),table,node)){return parsers[i];}}return parsers[0];}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=table.tBodies[0].rows[i],cols=[];cache.row.push($(c));for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c.cells[j]),table,c.cells[j]));}cols.push(i);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){if(!node)return"";var t="";if(config.textExtraction=="simple"){if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){t=node.childNodes[0].innerHTML;}else{t=node.innerHTML;}}else{if(typeof(config.textExtraction)=="function"){t=config.textExtraction(node);}else{t=$(node).text();}}return t;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){rows.push(r[n[i][checkCell]]);if(!table.config.appender){var o=r[n[i][checkCell]];var l=o.length;for(var j=0;j<l;j++){tableBody[0].appendChild(o[j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false,tableHeadersRows=[];for(var i=0;i<table.tHead.rows.length;i++){tableHeadersRows[i]=0;};$tableHeaders=$("thead th",table);$tableHeaders.each(function(index){this.count=0;this.column=index;this.order=formatSortingOrder(table.config.sortInitialOrder);if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(!this.sortDisabled){$(this).addClass(table.config.cssHeader);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){i=(v.toLowerCase()=="desc")?1:0;}else{i=(v==(0||1))?v:0;}return i;}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(getCachedSortType(table.config.parsers,c)=="text")?((order==0)?"sortText":"sortTextDesc"):((order==0)?"sortNumeric":"sortNumericDesc");var e="e"+i;dynamicExp+="var "+e+" = "+s+"(a["+c+"],b["+c+"]); ";dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function sortText(a,b){return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){var DECIMAL='\\'+config.decimal;var exp='/(^[+]?0('+DECIMAL+'0+)?$)|(^([-+]?[1-9][0-9]*)$)|(^([-+]?((0?|[1-9][0-9]*)'+DECIMAL+'(0*[1-9][0-9]*)))$)|(^[-+]?[1-9]+[0-9]*'+DECIMAL+'0+$)/';return RegExp(exp).test($.trim(s));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}$("tr:visible",table.tBodies[0]).filter(':even').removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0]).end().filter(':odd').removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
\ No newline at end of file diff --git a/doc/sample_html/style.css b/doc/sample_html/style.css index 34ab10e..b2987ea 100644 --- a/doc/sample_html/style.css +++ b/doc/sample_html/style.css @@ -2,14 +2,14 @@ /* Page-wide styles */ html, body, h1, h2, h3, p, td, th { margin: 0; - padding: 0; - border: 0; - outline: 0; - font-weight: inherit; - font-style: inherit; - font-size: 100%; - font-family: inherit; - vertical-align: baseline; + padding: 0; + border: 0; + outline: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; } /* Set baseline grid to 16 pt. */ @@ -89,9 +89,14 @@ h2.stats { cursor: pointer; border-color: #999 #ccc #ccc #999; } -.stats span.hide { +.stats span.hide_run, .stats span.hide_exc, +.stats span.hide_mis, .stats span.hide_par, +.stats span.par.hide_run.hide_par { border-color: #ccc #999 #999 #ccc; } +.stats span.par.hide_run { + border-color: #999 #ccc #ccc #999; +} /* Source file styles */ .linenos p { @@ -100,7 +105,7 @@ h2.stats { padding: 0 .5em; color: #999999; font-family: verdana, sans-serif; - font-size: .625em; /* 10/16 */ + font-size: .625em; /* 10/16 */ line-height: 1.6em; /* 16/10 */ } td.text { @@ -117,7 +122,7 @@ td.text { background: #ffdddd; border-left: 2px solid #ff0000; } -.text p.run { +.text p.run, .text p.run.hide_par { background: #ddffdd; border-left: 2px solid #00ff00; } @@ -125,40 +130,69 @@ td.text { background: #eeeeee; border-left: 2px solid #808080; } -.text p.hide { +.text p.par, .text p.par.hide_run { + background: #ffffaa; + border-left: 2px solid #eeee99; + } +.text p.hide_run, .text p.hide_exc, .text p.hide_mis, .text p.hide_par, +.text p.hide_run.hide_par { background: inherit; } +.text span.annotate { + font-family: georgia; + font-style: italic; + color: #666; + float: right; + padding-right: .5em; + } +.text p.hide_par span.annotate { + display: none; + } + /* Syntax coloring */ .text .com { - color: green; - font-style: italic; - line-height: 1px; - } + color: green; + font-style: italic; + line-height: 1px; + } .text .key { - font-weight: bold; - line-height: 1px; - } + font-weight: bold; + line-height: 1px; + } .text .str { - color: #000080; - } + color: #000080; + } /* index styles */ #index td, #index th { text-align: right; - width: 6em; - padding: .25em 0; + width: 5em; + padding: .25em .5em; border-bottom: 1px solid #eee; } #index th { font-style: italic; color: #333; border-bottom: 1px solid #ccc; + cursor: pointer; + } +#index th:hover { + background: #eee; + border-bottom: 1px solid #999; + } +#index td.left, #index th.left { + padding-left: 0; + } +#index td.right, #index th.right { + padding-right: 0; + } +#index th.headerSortDown, #index th.headerSortUp { + border-bottom: 1px solid #000; } #index td.name, #index th.name { text-align: left; width: auto; - height: 1.5em; } #index td.name a { text-decoration: none; @@ -169,10 +203,12 @@ td.text { color: #000; } #index tr.total { - font-weight: bold; } #index tr.total td { - padding: .25em 0; + font-weight: bold; border-top: 1px solid #ccc; border-bottom: none; } +#index tr.file:hover { + background: #eeeeee; + } |