From 21a24c746c4bd1f1cddf1de5f3317cf459b75fdb Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Sun, 29 May 2011 09:24:21 +0200 Subject: Closed [Issue 1]: now default values are printed if no help message is specified --- plac/CHANGES.txt | 2 + plac/doc/example5.help | 4 +- plac/doc/example5.py | 4 +- plac/doc/plac.html | 15 +- plac/doc/plac.pdf | 5394 ++++++++++++++++++++++++------------------------ plac/doc/plac_core.txt | 9 +- plac/doc/test_plac.py | 7 +- plac/plac.py | 5 +- plac/plac_core.py | 4 +- 9 files changed, 2726 insertions(+), 2718 deletions(-) diff --git a/plac/CHANGES.txt b/plac/CHANGES.txt index 3147030..275a7cf 100644 --- a/plac/CHANGES.txt +++ b/plac/CHANGES.txt @@ -1,6 +1,8 @@ HISTORY ---------- +0.8.2 Default values are now displayed in the help message if no + help is specified (2011-05-29) 0.8.1 Removed a stray newline in the output of plac, as signaled by Daniele Pighin; fixed a bug in the doctest method raising non-existing exceptions; turned the notification messages into diff --git a/plac/doc/example5.help b/plac/doc/example5.help index 0d6a630..ff57733 100644 --- a/plac/doc/example5.help +++ b/plac/doc/example5.help @@ -4,8 +4,8 @@ Do something on the database positional arguments: dsn - table - today + table [product] + today [YYYY-MM-DD] optional arguments: -h, --help show this help message and exit diff --git a/plac/doc/example5.py b/plac/doc/example5.py index 30c1d87..a2de37c 100644 --- a/plac/doc/example5.py +++ b/plac/doc/example5.py @@ -1,7 +1,7 @@ # example5.py -from datetime import datetime +from datetime import date -def main(dsn, table='product', today=datetime.today()): +def main(dsn, table='product', today=date.today()): "Do something on the database" print(dsn, table, today) diff --git a/plac/doc/plac.html b/plac/doc/plac.html index 76e6935..b470ffe 100644 --- a/plac/doc/plac.html +++ b/plac/doc/plac.html @@ -579,10 +579,7 @@ if __name__ == '__main__': main(arg.dsn) -

However saving three lines does not justify introducing the external -dependency: most people will not switch to Python 2.7, which at the time of -this writing is just about to be released, for many years. -Moreover, it just feels too complex to instantiate a class and to +

However, it just feels too complex to instantiate a class and to define a parser by hand for such a trivial task.

The plac module is designed to manage well such use cases, and it is able to reduce the original nine lines of boiler plate to two lines. With the @@ -661,14 +658,16 @@ Do something on the database positional arguments: dsn - table - today + table [product] + today [YYYY-MM-DD] optional arguments: -h, --help show this help message and exit -

plac manages transparently even the case when you want to pass a +

Notice that by default plac prints the string representation +of the default values (with square brackets) in the usage message. +plac manages transparently even the case when you want to pass a variable number of arguments. Here is an example, a script running on a database a series of SQL scripts:

@@ -703,7 +702,7 @@ optional arguments:
 the command-line arguments parser to use from the signature of the main
 function. This is the whole idea behind plac: if the intent is clear,
 let's the machine take care of the details.

-

plac is inspired to an old Python Cookbook recipe (optionparse), in +

plac is inspired to an old Python Cookbook recipe of mine (optionparse), in the sense that it delivers the programmer from the burden of writing the parser, but is less of a hack: instead of extracting the parser from the docstring of the module, it extracts it from the signature of diff --git a/plac/doc/plac.pdf b/plac/doc/plac.pdf index 5ba982c..86a9e54 100644 --- a/plac/doc/plac.pdf +++ b/plac/doc/plac.pdf @@ -86,12 +86,12 @@ endobj << /Annots [ 4 0 R 5 0 R 6 0 R ] - /Contents 346 0 R + /Contents 347 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -216,7 +216,7 @@ endobj 0 0 ] /Contents () - /Dest [ 111 0 R + /Dest [ 112 0 R /XYZ 62.69291 765.0236 @@ -234,7 +234,7 @@ endobj 0 0 ] /Contents () - /Dest [ 111 0 R + /Dest [ 112 0 R /XYZ 62.69291 765.0236 @@ -252,10 +252,10 @@ endobj 0 0 ] /Contents () - /Dest [ 121 0 R + /Dest [ 122 0 R /XYZ 62.69291 - 741.0236 + 707.8236 0 ] /Rect [ 82.69291 651.7736 @@ -270,10 +270,10 @@ endobj 0 0 ] /Contents () - /Dest [ 121 0 R + /Dest [ 122 0 R /XYZ 62.69291 - 741.0236 + 707.8236 0 ] /Rect [ 527.0227 651.7736 @@ -288,10 +288,10 @@ endobj 0 0 ] /Contents () - /Dest [ 125 0 R + /Dest [ 126 0 R /XYZ 62.69291 - 765.0236 + 715.8236 0 ] /Rect [ 82.69291 633.7736 @@ -306,10 +306,10 @@ endobj 0 0 ] /Contents () - /Dest [ 125 0 R + /Dest [ 126 0 R /XYZ 62.69291 - 765.0236 + 715.8236 0 ] /Rect [ 527.0227 633.7736 @@ -324,10 +324,10 @@ endobj 0 0 ] /Contents () - /Dest [ 125 0 R + /Dest [ 126 0 R /XYZ 62.69291 - 265.7299 + 216.5299 0 ] /Rect [ 82.69291 615.7736 @@ -342,10 +342,10 @@ endobj 0 0 ] /Contents () - /Dest [ 125 0 R + /Dest [ 126 0 R /XYZ 62.69291 - 265.7299 + 216.5299 0 ] /Rect [ 527.0227 615.7736 @@ -360,10 +360,10 @@ endobj 0 0 ] /Contents () - /Dest [ 133 0 R + /Dest [ 134 0 R /XYZ 62.69291 - 522.6236 + 457.4236 0 ] /Rect [ 82.69291 597.7736 @@ -378,10 +378,10 @@ endobj 0 0 ] /Contents () - /Dest [ 133 0 R + /Dest [ 134 0 R /XYZ 62.69291 - 522.6236 + 457.4236 0 ] /Rect [ 521.4627 597.7736 @@ -396,10 +396,10 @@ endobj 0 0 ] /Contents () - /Dest [ 138 0 R + /Dest [ 139 0 R /XYZ 62.69291 - 552.6236 + 478.6236 0 ] /Rect [ 82.69291 579.7736 @@ -414,10 +414,10 @@ endobj 0 0 ] /Contents () - /Dest [ 138 0 R + /Dest [ 139 0 R /XYZ 62.69291 - 552.6236 + 478.6236 0 ] /Rect [ 521.4627 579.7736 @@ -432,10 +432,10 @@ endobj 0 0 ] /Contents () - /Dest [ 141 0 R + /Dest [ 142 0 R /XYZ 62.69291 - 513.8236 + 420.6236 0 ] /Rect [ 82.69291 561.7736 @@ -450,10 +450,10 @@ endobj 0 0 ] /Contents () - /Dest [ 141 0 R + /Dest [ 142 0 R /XYZ 62.69291 - 513.8236 + 420.6236 0 ] /Rect [ 521.4627 561.7736 @@ -468,10 +468,10 @@ endobj 0 0 ] /Contents () - /Dest [ 143 0 R + /Dest [ 144 0 R /XYZ 62.69291 - 493.4236 + 409.4236 0 ] /Rect [ 82.69291 543.7736 @@ -486,10 +486,10 @@ endobj 0 0 ] /Contents () - /Dest [ 143 0 R + /Dest [ 144 0 R /XYZ 62.69291 - 493.4236 + 409.4236 0 ] /Rect [ 521.4627 543.7736 @@ -504,10 +504,10 @@ endobj 0 0 ] /Contents () - /Dest [ 162 0 R + /Dest [ 159 0 R /XYZ 62.69291 - 422.6236 + 357.4236 0 ] /Rect [ 82.69291 525.7736 @@ -522,10 +522,10 @@ endobj 0 0 ] /Contents () - /Dest [ 162 0 R + /Dest [ 159 0 R /XYZ 62.69291 - 422.6236 + 357.4236 0 ] /Rect [ 521.4627 525.7736 @@ -540,10 +540,10 @@ endobj 0 0 ] /Contents () - /Dest [ 213 0 R + /Dest [ 211 0 R /XYZ 62.69291 - 765.0236 + 705.0236 0 ] /Rect [ 82.69291 507.7736 @@ -558,10 +558,10 @@ endobj 0 0 ] /Contents () - /Dest [ 213 0 R + /Dest [ 211 0 R /XYZ 62.69291 - 765.0236 + 705.0236 0 ] /Rect [ 521.4627 507.7736 @@ -576,10 +576,10 @@ endobj 0 0 ] /Contents () - /Dest [ 213 0 R + /Dest [ 211 0 R /XYZ 62.69291 - 495.0236 + 435.0236 0 ] /Rect [ 82.69291 489.7736 @@ -594,10 +594,10 @@ endobj 0 0 ] /Contents () - /Dest [ 213 0 R + /Dest [ 211 0 R /XYZ 62.69291 - 495.0236 + 435.0236 0 ] /Rect [ 521.4627 489.7736 @@ -612,10 +612,10 @@ endobj 0 0 ] /Contents () - /Dest [ 213 0 R + /Dest [ 211 0 R /XYZ 62.69291 - 291.0236 + 231.0236 0 ] /Rect [ 82.69291 471.7736 @@ -630,10 +630,10 @@ endobj 0 0 ] /Contents () - /Dest [ 213 0 R + /Dest [ 211 0 R /XYZ 62.69291 - 291.0236 + 231.0236 0 ] /Rect [ 521.4627 471.7736 @@ -648,10 +648,10 @@ endobj 0 0 ] /Contents () - /Dest [ 227 0 R + /Dest [ 228 0 R /XYZ 62.69291 - 681.0236 + 597.0236 0 ] /Rect [ 62.69291 453.7736 @@ -666,10 +666,10 @@ endobj 0 0 ] /Contents () - /Dest [ 227 0 R + /Dest [ 228 0 R /XYZ 62.69291 - 681.0236 + 597.0236 0 ] /Rect [ 521.4627 453.7736 @@ -684,10 +684,10 @@ endobj 0 0 ] /Contents () - /Dest [ 227 0 R + /Dest [ 228 0 R /XYZ 62.69291 - 648.0236 + 564.0236 0 ] /Rect [ 82.69291 435.7736 @@ -702,10 +702,10 @@ endobj 0 0 ] /Contents () - /Dest [ 227 0 R + /Dest [ 228 0 R /XYZ 62.69291 - 648.0236 + 564.0236 0 ] /Rect [ 521.4627 435.7736 @@ -720,10 +720,10 @@ endobj 0 0 ] /Contents () - /Dest [ 227 0 R + /Dest [ 228 0 R /XYZ 62.69291 - 426.0236 + 342.0236 0 ] /Rect [ 82.69291 417.7736 @@ -738,10 +738,10 @@ endobj 0 0 ] /Contents () - /Dest [ 227 0 R + /Dest [ 228 0 R /XYZ 62.69291 - 426.0236 + 342.0236 0 ] /Rect [ 521.4627 417.7736 @@ -756,10 +756,10 @@ endobj 0 0 ] /Contents () - /Dest [ 230 0 R + /Dest [ 231 0 R /XYZ 62.69291 - 629.8236 + 545.8236 0 ] /Rect [ 82.69291 399.7736 @@ -774,10 +774,10 @@ endobj 0 0 ] /Contents () - /Dest [ 230 0 R + /Dest [ 231 0 R /XYZ 62.69291 - 629.8236 + 545.8236 0 ] /Rect [ 521.4627 399.7736 @@ -792,10 +792,10 @@ endobj 0 0 ] /Contents () - /Dest [ 233 0 R + /Dest [ 234 0 R /XYZ 62.69291 - 609.0236 + 509.8236 0 ] /Rect [ 82.69291 381.7736 @@ -810,10 +810,10 @@ endobj 0 0 ] /Contents () - /Dest [ 233 0 R + /Dest [ 234 0 R /XYZ 62.69291 - 609.0236 + 509.8236 0 ] /Rect [ 521.4627 381.7736 @@ -828,10 +828,10 @@ endobj 0 0 ] /Contents () - /Dest [ 244 0 R + /Dest [ 245 0 R /XYZ 62.69291 - 299.8485 + 215.8485 0 ] /Rect [ 82.69291 363.7736 @@ -846,10 +846,10 @@ endobj 0 0 ] /Contents () - /Dest [ 244 0 R + /Dest [ 245 0 R /XYZ 62.69291 - 299.8485 + 215.8485 0 ] /Rect [ 521.4627 363.7736 @@ -864,10 +864,10 @@ endobj 0 0 ] /Contents () - /Dest [ 249 0 R + /Dest [ 250 0 R /XYZ 62.69291 - 378.6236 + 322.6236 0 ] /Rect [ 82.69291 345.7736 @@ -882,10 +882,10 @@ endobj 0 0 ] /Contents () - /Dest [ 249 0 R + /Dest [ 250 0 R /XYZ 62.69291 - 378.6236 + 322.6236 0 ] /Rect [ 521.4627 345.7736 @@ -900,10 +900,10 @@ endobj 0 0 ] /Contents () - /Dest [ 254 0 R + /Dest [ 255 0 R /XYZ 62.69291 - 330.0679 + 310.0679 0 ] /Rect [ 82.69291 327.7736 @@ -918,10 +918,10 @@ endobj 0 0 ] /Contents () - /Dest [ 254 0 R + /Dest [ 255 0 R /XYZ 62.69291 - 330.0679 + 310.0679 0 ] /Rect [ 521.4627 327.7736 @@ -936,10 +936,10 @@ endobj 0 0 ] /Contents () - /Dest [ 260 0 R + /Dest [ 258 0 R /XYZ 62.69291 - 717.0236 + 681.0236 0 ] /Rect [ 82.69291 309.7736 @@ -954,10 +954,10 @@ endobj 0 0 ] /Contents () - /Dest [ 260 0 R + /Dest [ 258 0 R /XYZ 62.69291 - 717.0236 + 681.0236 0 ] /Rect [ 521.4627 309.7736 @@ -972,10 +972,10 @@ endobj 0 0 ] /Contents () - /Dest [ 273 0 R + /Dest [ 275 0 R /XYZ 62.69291 - 204.6236 + 765.0236 0 ] /Rect [ 82.69291 291.7736 @@ -990,10 +990,10 @@ endobj 0 0 ] /Contents () - /Dest [ 273 0 R + /Dest [ 275 0 R /XYZ 62.69291 - 204.6236 + 765.0236 0 ] /Rect [ 521.4627 291.7736 @@ -1008,10 +1008,10 @@ endobj 0 0 ] /Contents () - /Dest [ 277 0 R + /Dest [ 278 0 R /XYZ 62.69291 - 371.4236 + 242.2236 0 ] /Rect [ 82.69291 273.7736 @@ -1026,10 +1026,10 @@ endobj 0 0 ] /Contents () - /Dest [ 277 0 R + /Dest [ 278 0 R /XYZ 62.69291 - 371.4236 + 242.2236 0 ] /Rect [ 521.4627 273.7736 @@ -1044,10 +1044,10 @@ endobj 0 0 ] /Contents () - /Dest [ 280 0 R + /Dest [ 281 0 R /XYZ 62.69291 - 348.6236 + 229.4236 0 ] /Rect [ 82.69291 255.7736 @@ -1062,10 +1062,10 @@ endobj 0 0 ] /Contents () - /Dest [ 280 0 R + /Dest [ 281 0 R /XYZ 62.69291 - 348.6236 + 229.4236 0 ] /Rect [ 521.4627 255.7736 @@ -1080,10 +1080,10 @@ endobj 0 0 ] /Contents () - /Dest [ 284 0 R + /Dest [ 287 0 R /XYZ 62.69291 - 175.4236 + 729.0236 0 ] /Rect [ 82.69291 237.7736 @@ -1098,10 +1098,10 @@ endobj 0 0 ] /Contents () - /Dest [ 284 0 R + /Dest [ 287 0 R /XYZ 62.69291 - 175.4236 + 729.0236 0 ] /Rect [ 521.4627 237.7736 @@ -1119,7 +1119,7 @@ endobj /Dest [ 287 0 R /XYZ 62.69291 - 282.6236 + 178.6236 0 ] /Rect [ 82.69291 219.7736 @@ -1137,7 +1137,7 @@ endobj /Dest [ 287 0 R /XYZ 62.69291 - 282.6236 + 178.6236 0 ] /Rect [ 521.4627 219.7736 @@ -1152,10 +1152,10 @@ endobj 0 0 ] /Contents () - /Dest [ 291 0 R + /Dest [ 292 0 R /XYZ 62.69291 - 383.8236 + 290.6236 0 ] /Rect [ 82.69291 201.7736 @@ -1170,10 +1170,10 @@ endobj 0 0 ] /Contents () - /Dest [ 291 0 R + /Dest [ 292 0 R /XYZ 62.69291 - 383.8236 + 290.6236 0 ] /Rect [ 521.4627 201.7736 @@ -1188,10 +1188,10 @@ endobj 0 0 ] /Contents () - /Dest [ 293 0 R + /Dest [ 294 0 R /XYZ 62.69291 - 575.8236 + 479.8236 0 ] /Rect [ 82.69291 183.7736 @@ -1206,10 +1206,10 @@ endobj 0 0 ] /Contents () - /Dest [ 293 0 R + /Dest [ 294 0 R /XYZ 62.69291 - 575.8236 + 479.8236 0 ] /Rect [ 521.4627 183.7736 @@ -1224,10 +1224,10 @@ endobj 0 0 ] /Contents () - /Dest [ 296 0 R + /Dest [ 297 0 R /XYZ 62.69291 - 703.8236 + 607.8236 0 ] /Rect [ 82.69291 165.7736 @@ -1242,10 +1242,10 @@ endobj 0 0 ] /Contents () - /Dest [ 296 0 R + /Dest [ 297 0 R /XYZ 62.69291 - 703.8236 + 607.8236 0 ] /Rect [ 521.4627 165.7736 @@ -1260,10 +1260,10 @@ endobj 0 0 ] /Contents () - /Dest [ 296 0 R + /Dest [ 297 0 R /XYZ 62.69291 - 338.6236 + 242.6236 0 ] /Rect [ 82.69291 147.7736 @@ -1278,10 +1278,10 @@ endobj 0 0 ] /Contents () - /Dest [ 296 0 R + /Dest [ 297 0 R /XYZ 62.69291 - 338.6236 + 242.6236 0 ] /Rect [ 521.4627 147.7736 @@ -1296,7 +1296,7 @@ endobj 0 0 ] /Contents () - /Dest [ 302 0 R + /Dest [ 303 0 R /XYZ 62.69291 765.0236 @@ -1314,7 +1314,7 @@ endobj 0 0 ] /Contents () - /Dest [ 302 0 R + /Dest [ 303 0 R /XYZ 62.69291 765.0236 @@ -1332,7 +1332,7 @@ endobj 0 0 ] /Contents () - /Dest [ 302 0 R + /Dest [ 303 0 R /XYZ 62.69291 294.6236 @@ -1350,7 +1350,7 @@ endobj 0 0 ] /Contents () - /Dest [ 302 0 R + /Dest [ 303 0 R /XYZ 62.69291 294.6236 @@ -1368,7 +1368,7 @@ endobj 0 0 ] /Contents () - /Dest [ 304 0 R + /Dest [ 305 0 R /XYZ 62.69291 652.6772 @@ -1386,7 +1386,7 @@ endobj 0 0 ] /Contents () - /Dest [ 304 0 R + /Dest [ 305 0 R /XYZ 62.69291 652.6772 @@ -1473,12 +1473,12 @@ endobj 78 0 R 79 0 R 80 0 R ] - /Contents 347 0 R + /Contents 348 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -1725,12 +1725,12 @@ endobj 93 0 R 94 0 R 95 0 R ] - /Contents 348 0 R + /Contents 349 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -1795,9 +1795,9 @@ endobj 0 0 ] /Rect [ 83.82606 - 454.5736 + 478.5736 106.0692 - 466.5736 ] + 490.5736 ] /Subtype /Link /Type /Annot >> endobj @@ -1810,9 +1810,9 @@ endobj 0 0 ] /Rect [ 243.8829 - 442.5736 + 466.5736 265.0029 - 454.5736 ] + 478.5736 ] /Subtype /Link /Type /Annot >> endobj @@ -1825,9 +1825,9 @@ endobj 0 0 ] /Rect [ 83.6329 - 305.3736 + 329.3736 105.6829 - 317.3736 ] + 341.3736 ] /Subtype /Link /Type /Annot >> endobj @@ -1840,9 +1840,9 @@ endobj 0 0 ] /Rect [ 421.9727 - 305.3736 + 329.3736 465.1427 - 317.3736 ] + 341.3736 ] /Subtype /Link /Type /Annot >> endobj @@ -1855,9 +1855,9 @@ endobj 0 0 ] /Rect [ 107.8707 - 110.9736 + 134.9736 129.1584 - 122.9736 ] + 146.9736 ] /Subtype /Link /Type /Annot >> endobj @@ -1870,9 +1870,9 @@ endobj 0 0 ] /Rect [ 117.7229 - 98.97362 + 122.9736 138.8429 - 110.9736 ] + 134.9736 ] /Subtype /Link /Type /Annot >> endobj @@ -1888,12 +1888,12 @@ endobj 104 0 R 105 0 R 106 0 R ] - /Contents 349 0 R + /Contents 350 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -1942,25 +1942,41 @@ endobj /Border [ 0 0 0 ] - /Rect [ 62.69291 + /Rect [ 162.6654 210.1736 - 84.20915 + 184.5985 222.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Page5': class PDFPage +% 'Annot.NUMBER102': class PDFDictionary 111 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://pypi.python.org/pypi/plac) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 155.8754 + 198.1736 + 177.1129 + 210.1736 ] + /Subtype /Link + /Type /Annot >> +endobj +% 'Page5': class PDFPage +112 0 obj % Page dictionary << /Annots [ 108 0 R 109 0 R - 110 0 R ] - /Contents 350 0 R + 110 0 R + 111 0 R ] + /Contents 351 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -1971,8 +1987,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER102': class PDFDictionary -112 0 obj +% 'Annot.NUMBER103': class PDFDictionary +113 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -1980,14 +1996,14 @@ endobj 0 0 ] /Rect [ 446.1627 - 511.3736 + 499.3736 464.5027 - 523.3736 ] + 511.3736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER103': class PDFDictionary -113 0 obj +% 'Annot.NUMBER104': class PDFDictionary +114 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -1995,39 +2011,39 @@ endobj 0 0 ] /Rect [ 62.69291 - 481.3736 - 86.84915 - 493.3736 ] + 469.3736 + 84.53568 + 481.3736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER104': class PDFDictionary -114 0 obj +% 'Annot.NUMBER105': class PDFDictionary +115 0 obj << /A << /S /URI /Type /Action /URI (http://code.activestate.com/recipes/278844-parsing-the-command-line/) >> /Border [ 0 0 0 ] - /Rect [ 315.119 - 481.3736 - 367.369 - 493.3736 ] + /Rect [ 331.3133 + 469.3736 + 383.5633 + 481.3736 ] /Subtype /Link /Type /Annot >> endobj % 'Page6': class PDFPage -115 0 obj +116 0 obj % Page dictionary -<< /Annots [ 112 0 R - 113 0 R - 114 0 R ] - /Contents 351 0 R +<< /Annots [ 113 0 R + 114 0 R + 115 0 R ] + /Contents 352 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -2038,8 +2054,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER105': class PDFDictionary -116 0 obj +% 'Annot.NUMBER106': class PDFDictionary +117 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2047,14 +2063,14 @@ endobj 0 0 ] /Rect [ 62.69291 - 753.7736 + 720.5736 83.81291 - 765.7736 ] + 732.5736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER106': class PDFDictionary -117 0 obj +% 'Annot.NUMBER107': class PDFDictionary +118 0 obj << /A << /S /URI /Type /Action /URI (http://code.activestate.com/recipes/278844-parsing-the-command-line/) >> @@ -2062,14 +2078,14 @@ endobj 0 0 ] /Rect [ 240.1228 - 657.7736 + 624.5736 297.7099 - 669.7736 ] + 636.5736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER107': class PDFDictionary -118 0 obj +% 'Annot.NUMBER108': class PDFDictionary +119 0 obj << /A << /S /URI /Type /Action /URI (http://code.activestate.com/recipes/278844-parsing-the-command-line/) >> @@ -2077,14 +2093,14 @@ endobj 0 0 ] /Rect [ 62.69291 - 645.7736 + 612.5736 114.9429 - 657.7736 ] + 624.5736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER108': class PDFDictionary -119 0 obj +% 'Annot.NUMBER109': class PDFDictionary +120 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2092,14 +2108,14 @@ endobj 0 0 ] /Rect [ 496.4721 - 645.7736 + 612.5736 518.6827 - 657.7736 ] + 624.5736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER109': class PDFDictionary -120 0 obj +% 'Annot.NUMBER110': class PDFDictionary +121 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2107,26 +2123,26 @@ endobj 0 0 ] /Rect [ 494.1558 - 484.5736 + 451.3736 515.9027 - 496.5736 ] + 463.3736 ] /Subtype /Link /Type /Annot >> endobj % 'Page7': class PDFPage -121 0 obj +122 0 obj % Page dictionary -<< /Annots [ 116 0 R - 117 0 R +<< /Annots [ 117 0 R 118 0 R 119 0 R - 120 0 R ] - /Contents 352 0 R + 120 0 R + 121 0 R ] + /Contents 353 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -2138,14 +2154,14 @@ endobj /Type /Page >> endobj % 'Page8': class PDFPage -122 0 obj +123 0 obj % Page dictionary -<< /Contents 353 0 R +<< /Contents 354 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -2156,8 +2172,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER110': class PDFDictionary -123 0 obj +% 'Annot.NUMBER111': class PDFDictionary +124 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2165,14 +2181,14 @@ endobj 0 0 ] /Rect [ 62.69291 - 729.7736 + 680.5736 84.62846 - 741.7736 ] + 692.5736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER111': class PDFDictionary -124 0 obj +% 'Annot.NUMBER112': class PDFDictionary +125 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2180,23 +2196,23 @@ endobj 0 0 ] /Rect [ 110.2829 - 206.4799 + 157.2799 132.8629 - 218.4799 ] + 169.2799 ] /Subtype /Link /Type /Annot >> endobj % 'Page9': class PDFPage -125 0 obj +126 0 obj % Page dictionary -<< /Annots [ 123 0 R - 124 0 R ] - /Contents 354 0 R +<< /Annots [ 124 0 R + 125 0 R ] + /Contents 355 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -2207,8 +2223,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER112': class PDFDictionary -126 0 obj +% 'Annot.NUMBER113': class PDFDictionary +127 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2216,14 +2232,14 @@ endobj 0 0 ] /Rect [ 392.5829 - 535.3736 + 470.1736 413.7029 - 547.3736 ] + 482.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER113': class PDFDictionary -127 0 obj +% 'Annot.NUMBER114': class PDFDictionary +128 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2231,14 +2247,14 @@ endobj 0 0 ] /Rect [ 157.3904 - 487.3736 + 422.1736 179.9938 - 499.3736 ] + 434.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER114': class PDFDictionary -128 0 obj +% 'Annot.NUMBER115': class PDFDictionary +129 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -2246,14 +2262,14 @@ endobj 0 0 ] /Rect [ 184.0634 - 475.3736 + 410.1736 223.5234 - 487.3736 ] + 422.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER115': class PDFDictionary -129 0 obj +% 'Annot.NUMBER116': class PDFDictionary +130 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -2261,14 +2277,14 @@ endobj 0 0 ] /Rect [ 62.69291 - 463.3736 + 398.1736 102.1529 - 475.3736 ] + 410.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER116': class PDFDictionary -130 0 obj +% 'Annot.NUMBER117': class PDFDictionary +131 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -2276,14 +2292,14 @@ endobj 0 0 ] /Rect [ 192.7997 - 463.3736 + 398.1736 237.9391 - 475.3736 ] + 410.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER117': class PDFDictionary -131 0 obj +% 'Annot.NUMBER118': class PDFDictionary +132 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2291,14 +2307,14 @@ endobj 0 0 ] /Rect [ 324.4372 - 463.3736 + 398.1736 342.7772 - 475.3736 ] + 410.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER118': class PDFDictionary -132 0 obj +% 'Annot.NUMBER119': class PDFDictionary +133 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -2306,28 +2322,28 @@ endobj 0 0 ] /Rect [ 360.0429 - 235.3736 + 170.1736 402.2829 - 247.3736 ] + 182.1736 ] /Subtype /Link /Type /Annot >> endobj % 'Page10': class PDFPage -133 0 obj +134 0 obj % Page dictionary -<< /Annots [ 126 0 R - 127 0 R +<< /Annots [ 127 0 R 128 0 R 129 0 R 130 0 R 131 0 R - 132 0 R ] - /Contents 355 0 R + 132 0 R + 133 0 R ] + /Contents 356 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -2339,14 +2355,14 @@ endobj /Type /Page >> endobj % 'Page11': class PDFPage -134 0 obj +135 0 obj % Page dictionary -<< /Contents 356 0 R +<< /Contents 357 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -2357,8 +2373,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER119': class PDFDictionary -135 0 obj +% 'Annot.NUMBER120': class PDFDictionary +136 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2366,14 +2382,14 @@ endobj 0 0 ] /Rect [ 338.1568 - 517.3736 + 443.3736 360.5113 - 529.3736 ] + 455.3736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER120': class PDFDictionary -136 0 obj +% 'Annot.NUMBER121': class PDFDictionary +137 0 obj << /A << /S /URI /Type /Action /URI (http://www.sqlalchemy.org/) >> @@ -2381,14 +2397,14 @@ endobj 0 0 ] /Rect [ 110.6843 - 505.3736 + 431.3736 169.0343 - 517.3736 ] + 443.3736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER121': class PDFDictionary -137 0 obj +% 'Annot.NUMBER122': class PDFDictionary +138 0 obj << /A << /S /URI /Type /Action /URI (http://www.sqlalchemy.org/docs/reference/ext/sqlsoup.html) >> @@ -2396,24 +2412,24 @@ endobj 0 0 ] /Rect [ 168.3029 - 493.3736 + 419.3736 208.8829 - 505.3736 ] + 431.3736 ] /Subtype /Link /Type /Annot >> endobj % 'Page12': class PDFPage -138 0 obj +139 0 obj % Page dictionary -<< /Annots [ 135 0 R - 136 0 R - 137 0 R ] - /Contents 357 0 R +<< /Annots [ 136 0 R + 137 0 R + 138 0 R ] + /Contents 358 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -2424,8 +2440,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER122': class PDFDictionary -139 0 obj +% 'Annot.NUMBER123': class PDFDictionary +140 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2433,14 +2449,14 @@ endobj 0 0 ] /Rect [ 185.0709 - 478.5736 + 385.3736 208.0228 - 490.5736 ] + 397.3736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER123': class PDFDictionary -140 0 obj +% 'Annot.NUMBER124': class PDFDictionary +141 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2448,23 +2464,23 @@ endobj 0 0 ] /Rect [ 220.5998 - 466.5736 + 373.3736 243.819 - 478.5736 ] + 385.3736 ] /Subtype /Link /Type /Annot >> endobj % 'Page13': class PDFPage -141 0 obj +142 0 obj % Page dictionary -<< /Annots [ 139 0 R - 140 0 R ] - /Contents 358 0 R +<< /Annots [ 140 0 R + 141 0 R ] + /Contents 359 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -2475,8 +2491,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER124': class PDFDictionary -142 0 obj +% 'Annot.NUMBER125': class PDFDictionary +143 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2484,22 +2500,22 @@ endobj 0 0 ] /Rect [ 374.4929 - 434.1736 + 350.1736 395.6129 - 446.1736 ] + 362.1736 ] /Subtype /Link /Type /Annot >> endobj % 'Page14': class PDFPage -143 0 obj +144 0 obj % Page dictionary -<< /Annots [ 142 0 R ] - /Contents 359 0 R +<< /Annots [ 143 0 R ] + /Contents 360 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -2510,8 +2526,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER125': class PDFDictionary -144 0 obj +% 'Annot.NUMBER126': class PDFDictionary +145 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -2519,14 +2535,14 @@ endobj 0 0 ] /Rect [ 304.0655 - 375.5736 + 312.0481 348.3808 - 387.5736 ] + 324.0481 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER126': class PDFDictionary -145 0 obj +% 'Annot.NUMBER127': class PDFDictionary +146 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2534,23 +2550,23 @@ endobj 0 0 ] /Rect [ 293.7749 - 201.5736 + 138.0481 316.2402 - 213.5736 ] + 150.0481 ] /Subtype /Link /Type /Annot >> endobj % 'Page15': class PDFPage -146 0 obj +147 0 obj % Page dictionary -<< /Annots [ 144 0 R - 145 0 R ] - /Contents 360 0 R +<< /Annots [ 145 0 R + 146 0 R ] + /Contents 361 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -2561,8 +2577,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER127': class PDFDictionary -147 0 obj +% 'Annot.NUMBER128': class PDFDictionary +148 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2570,14 +2586,14 @@ endobj 0 0 ] /Rect [ 62.69291 - 387.3736 + 322.1736 84.8789 - 399.3736 ] + 334.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER128': class PDFDictionary -148 0 obj +% 'Annot.NUMBER129': class PDFDictionary +149 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -2585,14 +2601,14 @@ endobj 0 0 ] /Rect [ 466.5307 - 387.3736 + 322.1736 509.8367 - 399.3736 ] + 334.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER129': class PDFDictionary -149 0 obj +% 'Annot.NUMBER130': class PDFDictionary +150 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -2600,14 +2616,14 @@ endobj 0 0 ] /Rect [ 124.3929 - 363.3736 + 298.1736 163.8529 - 375.3736 ] + 310.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER130': class PDFDictionary -150 0 obj +% 'Annot.NUMBER131': class PDFDictionary +151 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -2615,14 +2631,14 @@ endobj 0 0 ] /Rect [ 85.69291 - 282.3736 + 217.1736 127.9329 - 294.3736 ] + 229.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER131': class PDFDictionary -151 0 obj +% 'Annot.NUMBER132': class PDFDictionary +152 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2630,14 +2646,14 @@ endobj 0 0 ] /Rect [ 85.69291 - 264.3736 + 199.1736 107.9337 - 276.3736 ] + 211.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER132': class PDFDictionary -152 0 obj +% 'Annot.NUMBER133': class PDFDictionary +153 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -2645,14 +2661,14 @@ endobj 0 0 ] /Rect [ 308.5389 - 264.3736 + 199.1736 351.8997 - 276.3736 ] + 211.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER133': class PDFDictionary -153 0 obj +% 'Annot.NUMBER134': class PDFDictionary +154 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -2660,14 +2676,14 @@ endobj 0 0 ] /Rect [ 380.6856 - 240.3736 + 175.1736 423.7999 - 252.3736 ] + 187.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER134': class PDFDictionary -154 0 obj +% 'Annot.NUMBER135': class PDFDictionary +155 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2675,14 +2691,14 @@ endobj 0 0 ] /Rect [ 494.4684 - 240.3736 + 175.1736 516.4627 - 252.3736 ] + 187.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER135': class PDFDictionary -155 0 obj +% 'Annot.NUMBER136': class PDFDictionary +156 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2690,14 +2706,14 @@ endobj 0 0 ] /Rect [ 85.69291 - 210.3736 + 145.1736 108.3529 - 222.3736 ] + 157.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER136': class PDFDictionary -156 0 obj +% 'Annot.NUMBER137': class PDFDictionary +157 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -2705,24 +2721,9 @@ endobj 0 0 ] /Rect [ 277.2428 - 210.3736 + 145.1736 321.0228 - 222.3736 ] - /Subtype /Link - /Type /Annot >> -endobj -% 'Annot.NUMBER137': class PDFDictionary -157 0 obj -<< /A << /S /URI - /Type /Action - /URI (http://pypi.python.org/pypi/plac) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 404.5839 - 198.3736 - 426.0657 - 210.3736 ] + 157.1736 ] /Subtype /Link /Type /Annot >> endobj @@ -2734,63 +2735,17 @@ endobj /Border [ 0 0 0 ] - /Rect [ 85.69291 - 144.3736 - 108.61 - 156.3736 ] + /Rect [ 404.5839 + 133.1736 + 426.0657 + 145.1736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER139': class PDFDictionary +% 'Page16': class PDFPage 159 0 obj -<< /A << /S /URI - /Type /Action - /URI (http://pypi.python.org/pypi/plac) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 459.2622 - 132.3736 - 481.289 - 144.3736 ] - /Subtype /Link - /Type /Annot >> -endobj -% 'Annot.NUMBER140': class PDFDictionary -160 0 obj -<< /A << /S /URI - /Type /Action - /URI (http://pypi.python.org/pypi/plac) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 85.69291 - 102.3736 - 108.9242 - 114.3736 ] - /Subtype /Link - /Type /Annot >> -endobj -% 'Annot.NUMBER141': class PDFDictionary -161 0 obj -<< /A << /S /URI - /Type /Action - /URI (file:///home/micheles/Dropbox/md/gcodedev/plac/doc/in-writing) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 340.9248 - 102.3736 - 470.1087 - 114.3736 ] - /Subtype /Link - /Type /Annot >> -endobj -% 'Page16': class PDFPage -162 0 obj % Page dictionary -<< /Annots [ 147 0 R - 148 0 R +<< /Annots [ 148 0 R 149 0 R 150 0 R 151 0 R @@ -2800,16 +2755,13 @@ endobj 155 0 R 156 0 R 157 0 R - 158 0 R - 159 0 R - 160 0 R - 161 0 R ] - /Contents 361 0 R + 158 0 R ] + /Contents 362 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -2820,8 +2772,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER142': class PDFDictionary -163 0 obj +% 'Annot.NUMBER139': class PDFDictionary +160 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -2830,11 +2782,56 @@ endobj 0 ] /Rect [ 85.69291 750.7736 - 107.9247 + 108.61 762.7736 ] /Subtype /Link /Type /Annot >> endobj +% 'Annot.NUMBER140': class PDFDictionary +161 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://pypi.python.org/pypi/plac) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 459.2622 + 738.7736 + 481.289 + 750.7736 ] + /Subtype /Link + /Type /Annot >> +endobj +% 'Annot.NUMBER141': class PDFDictionary +162 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://pypi.python.org/pypi/plac) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 85.69291 + 708.7736 + 108.9242 + 720.7736 ] + /Subtype /Link + /Type /Annot >> +endobj +% 'Annot.NUMBER142': class PDFDictionary +163 0 obj +<< /A << /S /URI + /Type /Action + /URI (file:///home/micheles/Dropbox/md/gcodedev/plac/doc/in-writing) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 340.9248 + 708.7736 + 470.1087 + 720.7736 ] + /Subtype /Link + /Type /Annot >> +endobj % 'Annot.NUMBER143': class PDFDictionary 164 0 obj << /A << /S /URI @@ -2844,9 +2841,9 @@ endobj 0 0 ] /Rect [ 85.69291 - 738.7736 - 104.0329 - 750.7736 ] + 678.7736 + 107.9247 + 690.7736 ] /Subtype /Link /Type /Annot >> endobj @@ -2854,14 +2851,14 @@ endobj 165 0 obj << /A << /S /URI /Type /Action - /URI (file:///home/micheles/Dropbox/md/gcodedev/plac/doc/in-writing) >> + /URI (http://pypi.python.org/pypi/plac) >> /Border [ 0 0 0 ] - /Rect [ 489.2227 - 738.7736 - 532.176 - 750.7736 ] + /Rect [ 85.69291 + 666.7736 + 104.0329 + 678.7736 ] /Subtype /Link /Type /Annot >> endobj @@ -2873,10 +2870,10 @@ endobj /Border [ 0 0 0 ] - /Rect [ 85.69291 - 726.7736 - 159.6229 - 738.7736 ] + /Rect [ 489.2227 + 666.7736 + 532.176 + 678.7736 ] /Subtype /Link /Type /Annot >> endobj @@ -2884,14 +2881,14 @@ endobj 167 0 obj << /A << /S /URI /Type /Action - /URI (http://pypi.python.org/pypi/plac) >> + /URI (file:///home/micheles/Dropbox/md/gcodedev/plac/doc/in-writing) >> /Border [ 0 0 0 ] - /Rect [ 62.69291 - 711.7736 - 83.81291 - 723.7736 ] + /Rect [ 85.69291 + 654.7736 + 159.6229 + 666.7736 ] /Subtype /Link /Type /Annot >> endobj @@ -2899,14 +2896,14 @@ endobj 168 0 obj << /A << /S /URI /Type /Action - /URI (http://argparse.googlecode.com) >> + /URI (http://pypi.python.org/pypi/plac) >> /Border [ 0 0 0 ] - /Rect [ 219.4229 - 711.7736 - 261.6629 - 723.7736 ] + /Rect [ 62.69291 + 639.7736 + 83.81291 + 651.7736 ] /Subtype /Link /Type /Annot >> endobj @@ -2914,14 +2911,14 @@ endobj 169 0 obj << /A << /S /URI /Type /Action - /URI (http://argparse.googlecode.com/svn/tags/r11/doc/other-utilities.html?highlight=filetype#FileType) >> + /URI (http://argparse.googlecode.com) >> /Border [ 0 0 0 ] - /Rect [ 455.2227 - 681.7736 - 534.3667 - 693.7736 ] + /Rect [ 219.4229 + 639.7736 + 261.6629 + 651.7736 ] /Subtype /Link /Type /Annot >> endobj @@ -2929,14 +2926,14 @@ endobj 170 0 obj << /A << /S /URI /Type /Action - /URI (http://pypi.python.org/pypi/plac) >> + /URI (http://argparse.googlecode.com/svn/tags/r11/doc/other-utilities.html?highlight=filetype#FileType) >> /Border [ 0 0 0 ] - /Rect [ 325.7268 - 514.5736 - 347.4138 - 526.5736 ] + /Rect [ 455.2227 + 609.7736 + 534.3667 + 621.7736 ] /Subtype /Link /Type /Annot >> endobj @@ -2944,14 +2941,14 @@ endobj 171 0 obj << /A << /S /URI /Type /Action - /URI (http://argparse.googlecode.com/svn/tags/r11/doc/ArgumentParser.html) >> + /URI (http://pypi.python.org/pypi/plac) >> /Border [ 0 0 0 ] - /Rect [ 327.2261 - 347.3736 - 410.5152 - 359.3736 ] + /Rect [ 325.7268 + 442.5736 + 347.4138 + 454.5736 ] /Subtype /Link /Type /Annot >> endobj @@ -2959,14 +2956,14 @@ endobj 172 0 obj << /A << /S /URI /Type /Action - /URI (http://argparse.googlecode.com) >> + /URI (http://argparse.googlecode.com/svn/tags/r11/doc/ArgumentParser.html) >> /Border [ 0 0 0 ] - /Rect [ 275.5829 - 168.1736 - 317.8229 - 180.1736 ] + /Rect [ 327.2261 + 275.3736 + 410.5152 + 287.3736 ] /Subtype /Link /Type /Annot >> endobj @@ -2978,32 +2975,20 @@ endobj /Border [ 0 0 0 ] - /Rect [ 307.9178 - 150.1736 - 351.5999 - 162.1736 ] - /Subtype /Link - /Type /Annot >> -endobj -% 'Annot.NUMBER153': class PDFDictionary -174 0 obj -<< /A << /S /URI - /Type /Action - /URI (http://pypi.python.org/pypi/plac) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 329.8034 - 126.1736 - 352.1804 - 138.1736 ] + /Rect [ 275.5829 + 96.17362 + 317.8229 + 108.1736 ] /Subtype /Link /Type /Annot >> endobj % 'Page17': class PDFPage -175 0 obj +174 0 obj % Page dictionary -<< /Annots [ 163 0 R +<< /Annots [ 160 0 R + 161 0 R + 162 0 R + 163 0 R 164 0 R 165 0 R 166 0 R @@ -3013,14 +2998,13 @@ endobj 170 0 R 171 0 R 172 0 R - 173 0 R - 174 0 R ] - /Contents 362 0 R + 173 0 R ] + /Contents 363 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -3031,6 +3015,21 @@ endobj /Trans << >> /Type /Page >> endobj +% 'Annot.NUMBER153': class PDFDictionary +175 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://argparse.googlecode.com) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 307.9178 + 753.7736 + 351.5999 + 765.7736 ] + /Subtype /Link + /Type /Annot >> +endobj % 'Annot.NUMBER154': class PDFDictionary 176 0 obj << /A << /S /URI @@ -3039,9 +3038,9 @@ endobj /Border [ 0 0 0 ] - /Rect [ 109.0098 + /Rect [ 329.8034 729.7736 - 131.9967 + 352.1804 741.7736 ] /Subtype /Link /Type /Annot >> @@ -3054,15 +3053,30 @@ endobj /Border [ 0 0 0 ] - /Rect [ 397.2929 - 705.7736 - 415.6329 - 717.7736 ] + /Rect [ 109.0098 + 669.7736 + 131.9967 + 681.7736 ] /Subtype /Link /Type /Annot >> endobj % 'Annot.NUMBER156': class PDFDictionary 178 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://pypi.python.org/pypi/plac) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 397.2929 + 645.7736 + 415.6329 + 657.7736 ] + /Subtype /Link + /Type /Annot >> +endobj +% 'Annot.NUMBER157': class PDFDictionary +179 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/opterator) >> @@ -3070,14 +3084,14 @@ endobj 0 0 ] /Rect [ 85.69291 - 684.7736 + 624.7736 128.4929 - 696.7736 ] + 636.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER157': class PDFDictionary -179 0 obj +% 'Annot.NUMBER158': class PDFDictionary +180 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/CLIArgs) >> @@ -3085,14 +3099,14 @@ endobj 0 0 ] /Rect [ 85.69291 - 666.7736 + 606.7736 124.5929 - 678.7736 ] + 618.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER158': class PDFDictionary -180 0 obj +% 'Annot.NUMBER159': class PDFDictionary +181 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/commandline) >> @@ -3100,14 +3114,14 @@ endobj 0 0 ] /Rect [ 85.69291 - 648.7736 + 588.7736 147.9329 - 660.7736 ] + 600.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER159': class PDFDictionary -181 0 obj +% 'Annot.NUMBER160': class PDFDictionary +182 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -3115,14 +3129,14 @@ endobj 0 0 ] /Rect [ 464.3898 - 633.7736 + 573.7736 503.8498 - 645.7736 ] + 585.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER160': class PDFDictionary -182 0 obj +% 'Annot.NUMBER161': class PDFDictionary +183 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3130,14 +3144,14 @@ endobj 0 0 ] /Rect [ 305.0429 - 621.7736 + 561.7736 323.3829 - 633.7736 ] + 573.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER161': class PDFDictionary -183 0 obj +% 'Annot.NUMBER162': class PDFDictionary +184 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/Clap/0.7) >> @@ -3145,14 +3159,14 @@ endobj 0 0 ] /Rect [ 455.0104 - 603.7736 + 543.7736 479.9015 - 615.7736 ] + 555.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER162': class PDFDictionary -184 0 obj +% 'Annot.NUMBER163': class PDFDictionary +185 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3160,14 +3174,14 @@ endobj 0 0 ] /Rect [ 303.707 - 591.7736 + 531.7736 322.047 - 603.7736 ] + 543.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER163': class PDFDictionary -185 0 obj +% 'Annot.NUMBER164': class PDFDictionary +186 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/Clap/0.7) >> @@ -3175,14 +3189,14 @@ endobj 0 0 ] /Rect [ 328.8186 - 591.7736 + 531.7736 353.3701 - 603.7736 ] + 543.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER164': class PDFDictionary -186 0 obj +% 'Annot.NUMBER165': class PDFDictionary +187 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3190,14 +3204,14 @@ endobj 0 0 ] /Rect [ 62.69291 - 579.7736 + 519.7736 81.03291 - 591.7736 ] + 531.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER165': class PDFDictionary -187 0 obj +% 'Annot.NUMBER166': class PDFDictionary +188 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3205,14 +3219,14 @@ endobj 0 0 ] /Rect [ 62.69291 - 561.7736 + 501.7736 84.4354 - 573.7736 ] + 513.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER166': class PDFDictionary -188 0 obj +% 'Annot.NUMBER167': class PDFDictionary +189 0 obj << /A << /S /URI /Type /Action /URI (http://docs.python.org/library/cmd.html) >> @@ -3220,14 +3234,14 @@ endobj 0 0 ] /Rect [ 275.6978 - 561.7736 + 501.7736 297.9903 - 573.7736 ] + 513.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER167': class PDFDictionary -189 0 obj +% 'Annot.NUMBER168': class PDFDictionary +190 0 obj << /A << /S /URI /Type /Action /URI (http://packages.python.org/cmd2/) >> @@ -3235,14 +3249,14 @@ endobj 0 0 ] /Rect [ 203.5285 - 549.7736 + 489.7736 231.1357 - 561.7736 ] + 501.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER168': class PDFDictionary -190 0 obj +% 'Annot.NUMBER169': class PDFDictionary +191 0 obj << /A << /S /URI /Type /Action /URI (http://packages.python.org/cmd2/) >> @@ -3250,14 +3264,14 @@ endobj 0 0 ] /Rect [ 164.4129 - 537.7736 + 477.7736 191.6429 - 549.7736 ] + 489.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER169': class PDFDictionary -191 0 obj +% 'Annot.NUMBER170': class PDFDictionary +192 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3265,14 +3279,14 @@ endobj 0 0 ] /Rect [ 302.7929 - 537.7736 + 477.7736 321.1329 - 549.7736 ] + 489.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER170': class PDFDictionary -192 0 obj +% 'Annot.NUMBER171': class PDFDictionary +193 0 obj << /A << /S /URI /Type /Action /URI (https://github.com/pulp/marrow.script) >> @@ -3280,14 +3294,14 @@ endobj 0 0 ] /Rect [ 458.7927 - 519.7736 + 459.7736 522.0227 - 531.7736 ] + 471.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER171': class PDFDictionary -193 0 obj +% 'Annot.NUMBER172': class PDFDictionary +194 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3295,14 +3309,14 @@ endobj 0 0 ] /Rect [ 274.4129 - 507.7736 + 447.7736 295.5329 - 519.7736 ] + 459.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER172': class PDFDictionary -194 0 obj +% 'Annot.NUMBER173': class PDFDictionary +195 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -3310,14 +3324,14 @@ endobj 0 0 ] /Rect [ 423.3729 - 507.7736 + 447.7736 465.6129 - 519.7736 ] + 459.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER173': class PDFDictionary -195 0 obj +% 'Annot.NUMBER174': class PDFDictionary +196 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3325,14 +3339,14 @@ endobj 0 0 ] /Rect [ 156.6051 - 459.7736 + 399.7736 177.8606 - 471.7736 ] + 411.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER174': class PDFDictionary -196 0 obj +% 'Annot.NUMBER175': class PDFDictionary +197 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -3340,14 +3354,14 @@ endobj 0 0 ] /Rect [ 186.6535 - 435.7736 + 375.7736 226.1135 - 447.7736 ] + 387.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER175': class PDFDictionary -197 0 obj +% 'Annot.NUMBER176': class PDFDictionary +198 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -3355,14 +3369,14 @@ endobj 0 0 ] /Rect [ 493.1227 - 435.7736 + 375.7736 532.4646 - 447.7736 ] + 387.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER176': class PDFDictionary -198 0 obj +% 'Annot.NUMBER177': class PDFDictionary +199 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3370,14 +3384,14 @@ endobj 0 0 ] /Rect [ 72.7804 - 423.7736 + 363.7736 96.20788 - 435.7736 ] + 375.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER177': class PDFDictionary -199 0 obj +% 'Annot.NUMBER178': class PDFDictionary +200 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3385,14 +3399,14 @@ endobj 0 0 ] /Rect [ 149.2229 - 393.7736 + 333.7736 171.2704 - 405.7736 ] + 345.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER178': class PDFDictionary -200 0 obj +% 'Annot.NUMBER179': class PDFDictionary +201 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3400,14 +3414,14 @@ endobj 0 0 ] /Rect [ 128.0309 - 351.7736 + 291.7736 149.4369 - 363.7736 ] + 303.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER179': class PDFDictionary -201 0 obj +% 'Annot.NUMBER180': class PDFDictionary +202 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3415,14 +3429,14 @@ endobj 0 0 ] /Rect [ 502.8367 - 351.7736 + 291.7736 524.2427 - 363.7736 ] + 303.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER180': class PDFDictionary -202 0 obj +% 'Annot.NUMBER181': class PDFDictionary +203 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3430,14 +3444,14 @@ endobj 0 0 ] /Rect [ 187.4797 - 327.7736 + 267.7736 209.0991 - 339.7736 ] + 279.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER181': class PDFDictionary -203 0 obj +% 'Annot.NUMBER182': class PDFDictionary +204 0 obj << /A << /S /URI /Type /Action /URI (file:///home/micheles/Dropbox/md/gcodedev/plac/doc/in-writing) >> @@ -3445,14 +3459,14 @@ endobj 0 0 ] /Rect [ 301.6965 - 327.7736 + 267.7736 426.0446 - 339.7736 ] + 279.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER182': class PDFDictionary -204 0 obj +% 'Annot.NUMBER183': class PDFDictionary +205 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3460,14 +3474,14 @@ endobj 0 0 ] /Rect [ 83.6829 - 255.7736 + 195.7736 105.7829 - 267.7736 ] + 207.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER183': class PDFDictionary -205 0 obj +% 'Annot.NUMBER184': class PDFDictionary +206 0 obj << /A << /S /URI /Type /Action /URI (http://code.activestate.com/recipes/278844-parsing-the-command-line/) >> @@ -3475,14 +3489,14 @@ endobj 0 0 ] /Rect [ 446.5627 - 255.7736 + 195.7736 502.5727 - 267.7736 ] + 207.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER184': class PDFDictionary -206 0 obj +% 'Annot.NUMBER185': class PDFDictionary +207 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3490,14 +3504,14 @@ endobj 0 0 ] /Rect [ 275.6828 - 243.7736 + 183.7736 297.3688 - 255.7736 ] + 195.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER185': class PDFDictionary -207 0 obj +% 'Annot.NUMBER186': class PDFDictionary +208 0 obj << /A << /S /URI /Type /Action /URI (http://docs.python.org/library/optparse.html?highlight=optionparser#optparse.OptionParser) >> @@ -3505,24 +3519,9 @@ endobj 0 0 ] /Rect [ 77.19665 - 231.7736 + 171.7736 139.4904 - 243.7736 ] - /Subtype /Link - /Type /Annot >> -endobj -% 'Annot.NUMBER186': class PDFDictionary -208 0 obj -<< /A << /S /URI - /Type /Action - /URI (http://argparse.googlecode.com) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 96.54131 - 219.7736 - 139.0255 - 231.7736 ] + 183.7736 ] /Subtype /Link /Type /Annot >> endobj @@ -3534,62 +3533,33 @@ endobj /Border [ 0 0 0 ] - /Rect [ 203.5016 - 186.7736 - 245.8453 - 198.7736 ] + /Rect [ 96.54131 + 159.7736 + 139.0255 + 171.7736 ] /Subtype /Link /Type /Annot >> endobj % 'Annot.NUMBER188': class PDFDictionary 210 0 obj -<< /A << /S /URI - /Type /Action - /URI (http://argparse.googlecode.com/svn/tags/r11/doc/ArgumentParser.html) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 62.69291 - 117.7736 - 138.7898 - 129.7736 ] - /Subtype /Link - /Type /Annot >> -endobj -% 'Annot.NUMBER189': class PDFDictionary -211 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> /Border [ 0 0 0 ] - /Rect [ 114.6649 - 105.7736 - 154.1249 - 117.7736 ] - /Subtype /Link - /Type /Annot >> -endobj -% 'Annot.NUMBER190': class PDFDictionary -212 0 obj -<< /A << /S /URI - /Type /Action - /URI (http://argparse.googlecode.com) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 191.6329 - 93.77362 - 233.8729 - 105.7736 ] + /Rect [ 203.5016 + 126.7736 + 245.8453 + 138.7736 ] /Subtype /Link /Type /Annot >> endobj % 'Page18': class PDFPage -213 0 obj +211 0 obj % Page dictionary -<< /Annots [ 176 0 R +<< /Annots [ 175 0 R + 176 0 R 177 0 R 178 0 R 179 0 R @@ -3623,15 +3593,13 @@ endobj 207 0 R 208 0 R 209 0 R - 210 0 R - 211 0 R - 212 0 R ] - /Contents 363 0 R + 210 0 R ] + /Contents 364 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -3642,8 +3610,53 @@ endobj /Trans << >> /Type /Page >> endobj +% 'Annot.NUMBER189': class PDFDictionary +212 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://argparse.googlecode.com/svn/tags/r11/doc/ArgumentParser.html) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 62.69291 + 711.7736 + 138.7898 + 723.7736 ] + /Subtype /Link + /Type /Annot >> +endobj +% 'Annot.NUMBER190': class PDFDictionary +213 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://argparse.googlecode.com) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 114.6649 + 699.7736 + 154.1249 + 711.7736 ] + /Subtype /Link + /Type /Annot >> +endobj % 'Annot.NUMBER191': class PDFDictionary 214 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://argparse.googlecode.com) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 191.6329 + 687.7736 + 233.8729 + 699.7736 ] + /Subtype /Link + /Type /Annot >> +endobj +% 'Annot.NUMBER192': class PDFDictionary +215 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/Clap/0.7) >> @@ -3651,14 +3664,14 @@ endobj 0 0 ] /Rect [ 263.3429 - 741.7736 + 657.7736 286.6829 - 753.7736 ] + 669.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER192': class PDFDictionary -215 0 obj +% 'Annot.NUMBER193': class PDFDictionary +216 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3666,14 +3679,14 @@ endobj 0 0 ] /Rect [ 258.5629 - 693.7736 + 609.7736 276.9029 - 705.7736 ] + 621.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER193': class PDFDictionary -216 0 obj +% 'Annot.NUMBER194': class PDFDictionary +217 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3681,14 +3694,14 @@ endobj 0 0 ] /Rect [ 185.4471 - 612.7736 + 528.7736 207.1062 - 624.7736 ] + 540.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER194': class PDFDictionary -217 0 obj +% 'Annot.NUMBER195': class PDFDictionary +218 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3696,14 +3709,14 @@ endobj 0 0 ] /Rect [ 177.6784 - 600.7736 + 516.7736 199.6123 - 612.7736 ] + 528.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER195': class PDFDictionary -218 0 obj +% 'Annot.NUMBER196': class PDFDictionary +219 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3711,14 +3724,14 @@ endobj 0 0 ] /Rect [ 62.69291 - 546.7736 + 462.7736 83.81291 - 558.7736 ] + 474.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER196': class PDFDictionary -219 0 obj +% 'Annot.NUMBER197': class PDFDictionary +220 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3726,14 +3739,14 @@ endobj 0 0 ] /Rect [ 278.4678 - 528.7736 + 444.7736 300.0328 - 540.7736 ] + 456.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER197': class PDFDictionary -220 0 obj +% 'Annot.NUMBER198': class PDFDictionary +221 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3741,14 +3754,14 @@ endobj 0 0 ] /Rect [ 117.3573 - 516.7736 + 432.7736 138.5845 - 528.7736 ] + 444.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER198': class PDFDictionary -221 0 obj +% 'Annot.NUMBER199': class PDFDictionary +222 0 obj << /A << /S /URI /Type /Action /URI (http://twill.idyll.org/) >> @@ -3756,14 +3769,14 @@ endobj 0 0 ] /Rect [ 82.74466 - 474.7736 + 390.7736 104.4564 - 486.7736 ] + 402.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER199': class PDFDictionary -222 0 obj +% 'Annot.NUMBER200': class PDFDictionary +223 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3771,14 +3784,14 @@ endobj 0 0 ] /Rect [ 127.2882 - 474.7736 + 390.7736 145.6282 - 486.7736 ] + 402.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER200': class PDFDictionary -223 0 obj +% 'Annot.NUMBER201': class PDFDictionary +224 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3786,14 +3799,14 @@ endobj 0 0 ] /Rect [ 410.1674 - 474.7736 + 390.7736 433.5592 - 486.7736 ] + 402.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER201': class PDFDictionary -224 0 obj +% 'Annot.NUMBER202': class PDFDictionary +225 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3801,14 +3814,14 @@ endobj 0 0 ] /Rect [ 265.9578 - 450.7736 + 366.7736 284.2978 - 462.7736 ] + 378.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER202': class PDFDictionary -225 0 obj +% 'Annot.NUMBER203': class PDFDictionary +226 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3816,14 +3829,14 @@ endobj 0 0 ] /Rect [ 487.7492 - 450.7736 + 366.7736 506.0892 - 462.7736 ] + 378.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER203': class PDFDictionary -226 0 obj +% 'Annot.NUMBER204': class PDFDictionary +227 0 obj << /A << /S /URI /Type /Action /URI (http://plac.googlecode.com/hg/doc/plac.html) >> @@ -3831,16 +3844,18 @@ endobj 0 0 ] /Rect [ 62.69291 - 294.7736 + 210.7736 157.1829 - 306.7736 ] + 222.7736 ] /Subtype /Link /Type /Annot >> endobj % 'Page19': class PDFPage -227 0 obj +228 0 obj % Page dictionary -<< /Annots [ 214 0 R +<< /Annots [ 212 0 R + 213 0 R + 214 0 R 215 0 R 216 0 R 217 0 R @@ -3852,13 +3867,14 @@ endobj 223 0 R 224 0 R 225 0 R - 226 0 R ] - /Contents 364 0 R + 226 0 R + 227 0 R ] + /Contents 365 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -3870,14 +3886,14 @@ endobj /Type /Page >> endobj % 'Page20': class PDFPage -228 0 obj +229 0 obj % Page dictionary -<< /Contents 365 0 R +<< /Contents 366 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -3888,8 +3904,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER204': class PDFDictionary -229 0 obj +% 'Annot.NUMBER205': class PDFDictionary +230 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3897,22 +3913,22 @@ endobj 0 0 ] /Rect [ 383.9329 - 672.5736 + 588.5736 405.0529 - 684.5736 ] + 600.5736 ] /Subtype /Link /Type /Annot >> endobj % 'Page21': class PDFPage -230 0 obj +231 0 obj % Page dictionary -<< /Annots [ 229 0 R ] - /Contents 366 0 R +<< /Annots [ 230 0 R ] + /Contents 367 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -3923,8 +3939,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER205': class PDFDictionary -231 0 obj +% 'Annot.NUMBER206': class PDFDictionary +232 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3932,14 +3948,14 @@ endobj 0 0 ] /Rect [ 370.6785 - 310.5736 + 211.3736 392.4956 - 322.5736 ] + 223.3736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER206': class PDFDictionary -232 0 obj +% 'Annot.NUMBER207': class PDFDictionary +233 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3947,23 +3963,23 @@ endobj 0 0 ] /Rect [ 455.8742 - 310.5736 + 211.3736 477.6913 - 322.5736 ] + 223.3736 ] /Subtype /Link /Type /Annot >> endobj % 'Page22': class PDFPage -233 0 obj +234 0 obj % Page dictionary -<< /Annots [ 231 0 R - 232 0 R ] - /Contents 367 0 R +<< /Annots [ 232 0 R + 233 0 R ] + /Contents 368 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -3974,8 +3990,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER207': class PDFDictionary -234 0 obj +% 'Annot.NUMBER208': class PDFDictionary +235 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -3983,14 +3999,14 @@ endobj 0 0 ] /Rect [ 185.9351 - 753.7736 + 669.7736 207.4695 - 765.7736 ] + 681.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER208': class PDFDictionary -235 0 obj +% 'Annot.NUMBER209': class PDFDictionary +236 0 obj << /A << /S /URI /Type /Action /URI (http://docs.python.org/library/shlex.html) >> @@ -3998,14 +4014,14 @@ endobj 0 0 ] /Rect [ 369.8905 - 753.7736 + 669.7736 396.425 - 765.7736 ] + 681.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER209': class PDFDictionary -236 0 obj +% 'Annot.NUMBER210': class PDFDictionary +237 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4013,14 +4029,14 @@ endobj 0 0 ] /Rect [ 408.8916 - 741.7736 + 657.7736 427.2316 - 753.7736 ] + 669.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER210': class PDFDictionary -237 0 obj +% 'Annot.NUMBER211': class PDFDictionary +238 0 obj << /A << /S /URI /Type /Action /URI (http://docs.python.org/library/shlex.html) >> @@ -4028,14 +4044,14 @@ endobj 0 0 ] /Rect [ 62.69291 - 729.7736 + 645.7736 86.03291 - 741.7736 ] + 657.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER211': class PDFDictionary -238 0 obj +% 'Annot.NUMBER212': class PDFDictionary +239 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4043,14 +4059,14 @@ endobj 0 0 ] /Rect [ 92.4689 - 729.7736 + 645.7736 114.4649 - 741.7736 ] + 657.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER212': class PDFDictionary -239 0 obj +% 'Annot.NUMBER213': class PDFDictionary +240 0 obj << /A << /S /URI /Type /Action /URI (http://docs.python.org/library/shlex.html) >> @@ -4058,14 +4074,14 @@ endobj 0 0 ] /Rect [ 149.3204 - 717.7736 + 633.7736 176.9472 - 729.7736 ] + 645.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER213': class PDFDictionary -240 0 obj +% 'Annot.NUMBER214': class PDFDictionary +241 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4073,14 +4089,14 @@ endobj 0 0 ] /Rect [ 129.6923 - 621.7736 + 537.7736 151.4655 - 633.7736 ] + 549.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER214': class PDFDictionary -241 0 obj +% 'Annot.NUMBER215': class PDFDictionary +242 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4088,14 +4104,14 @@ endobj 0 0 ] /Rect [ 173.8529 - 609.7736 + 525.7736 194.9729 - 621.7736 ] + 537.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER215': class PDFDictionary -242 0 obj +% 'Annot.NUMBER216': class PDFDictionary +243 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4103,14 +4119,14 @@ endobj 0 0 ] /Rect [ 460.388 - 252.5985 + 168.5985 482.0127 - 264.5985 ] + 180.5985 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER216': class PDFDictionary -243 0 obj +% 'Annot.NUMBER217': class PDFDictionary +244 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4118,17 +4134,16 @@ endobj 0 0 ] /Rect [ 95.32996 - 186.5985 + 102.5985 116.857 - 198.5985 ] + 114.5985 ] /Subtype /Link /Type /Annot >> endobj % 'Page23': class PDFPage -244 0 obj +245 0 obj % Page dictionary -<< /Annots [ 234 0 R - 235 0 R +<< /Annots [ 235 0 R 236 0 R 237 0 R 238 0 R @@ -4136,13 +4151,14 @@ endobj 240 0 R 241 0 R 242 0 R - 243 0 R ] - /Contents 368 0 R + 243 0 R + 244 0 R ] + /Contents 369 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4153,8 +4169,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER217': class PDFDictionary -245 0 obj +% 'Annot.NUMBER218': class PDFDictionary +246 0 obj << /A << /S /URI /Type /Action /URI (http://plac.googlecode.com/hg/doc/plac.html) >> @@ -4162,14 +4178,14 @@ endobj 0 0 ] /Rect [ 316.3528 - 343.3736 + 287.3736 409.2453 - 355.3736 ] + 299.3736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER218': class PDFDictionary -246 0 obj +% 'Annot.NUMBER219': class PDFDictionary +247 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4177,14 +4193,14 @@ endobj 0 0 ] /Rect [ 419.1694 - 331.3736 + 275.3736 440.4061 - 343.3736 ] + 287.3736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER219': class PDFDictionary -247 0 obj +% 'Annot.NUMBER220': class PDFDictionary +248 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4192,14 +4208,14 @@ endobj 0 0 ] /Rect [ 62.69291 - 301.3736 + 245.3736 84.70395 - 313.3736 ] + 257.3736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER220': class PDFDictionary -248 0 obj +% 'Annot.NUMBER221': class PDFDictionary +249 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4207,25 +4223,25 @@ endobj 0 0 ] /Rect [ 293.2359 - 223.3736 + 167.3736 316.4697 - 235.3736 ] + 179.3736 ] /Subtype /Link /Type /Annot >> endobj % 'Page24': class PDFPage -249 0 obj +250 0 obj % Page dictionary -<< /Annots [ 245 0 R - 246 0 R +<< /Annots [ 246 0 R 247 0 R - 248 0 R ] - /Contents 369 0 R + 248 0 R + 249 0 R ] + /Contents 370 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4236,8 +4252,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER221': class PDFDictionary -250 0 obj +% 'Annot.NUMBER222': class PDFDictionary +251 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4245,14 +4261,14 @@ endobj 0 0 ] /Rect [ 431.7904 - 228.5736 + 180.5736 453.7245 - 240.5736 ] + 192.5736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER222': class PDFDictionary -251 0 obj +% 'Annot.NUMBER223': class PDFDictionary +252 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4260,14 +4276,14 @@ endobj 0 0 ] /Rect [ 255.5885 - 198.5736 + 150.5736 278.2757 - 210.5736 ] + 162.5736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER223': class PDFDictionary -252 0 obj +% 'Annot.NUMBER224': class PDFDictionary +253 0 obj << /A << /S /URI /Type /Action /URI (http://docs.python.org/library/cmd.html) >> @@ -4275,24 +4291,24 @@ endobj 0 0 ] /Rect [ 513.6927 - 174.5736 + 126.5736 532.1846 - 186.5736 ] + 138.5736 ] /Subtype /Link /Type /Annot >> endobj % 'Page25': class PDFPage -253 0 obj +254 0 obj % Page dictionary -<< /Annots [ 250 0 R - 251 0 R - 252 0 R ] - /Contents 370 0 R +<< /Annots [ 251 0 R + 252 0 R + 253 0 R ] + /Contents 371 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4304,14 +4320,14 @@ endobj /Type /Page >> endobj % 'Page26': class PDFPage -254 0 obj +255 0 obj % Page dictionary -<< /Contents 371 0 R +<< /Contents 372 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4323,14 +4339,14 @@ endobj /Type /Page >> endobj % 'Page27': class PDFPage -255 0 obj +256 0 obj % Page dictionary -<< /Contents 372 0 R +<< /Contents 373 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4341,8 +4357,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER224': class PDFDictionary -256 0 obj +% 'Annot.NUMBER225': class PDFDictionary +257 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4350,14 +4366,34 @@ endobj 0 0 ] /Rect [ 179.0529 - 681.7736 + 645.7736 201.1953 - 693.7736 ] + 657.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER225': class PDFDictionary -257 0 obj +% 'Page28': class PDFPage +258 0 obj +% Page dictionary +<< /Annots [ 257 0 R ] + /Contents 374 0 R + /MediaBox [ 0 + 0 + 595.2756 + 841.8898 ] + /Parent 346 0 R + /Resources << /Font 1 0 R + /ProcSet [ /PDF + /Text + /ImageB + /ImageC + /ImageI ] >> + /Rotate 0 + /Trans << >> + /Type /Page >> +endobj +% 'Annot.NUMBER226': class PDFDictionary +259 0 obj << /A << /S /URI /Type /Action /URI (http://freshmeat.net/projects/rlwrap/) >> @@ -4365,14 +4401,14 @@ endobj 0 0 ] /Rect [ 377.8504 - 101.7807 + 735.7736 409.861 - 113.7807 ] + 747.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER226': class PDFDictionary -258 0 obj +% 'Annot.NUMBER227': class PDFDictionary +260 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4380,14 +4416,14 @@ endobj 0 0 ] /Rect [ 242.4466 - 89.78071 + 723.7736 263.7922 - 101.7807 ] + 735.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER227': class PDFDictionary -259 0 obj +% 'Annot.NUMBER228': class PDFDictionary +261 0 obj << /A << /S /URI /Type /Action /URI (http://ipython.scipy.org/moin/PyReadline/Intro) >> @@ -4395,37 +4431,14 @@ endobj 0 0 ] /Rect [ 456.2271 - 89.78071 + 723.7736 505.3627 - 101.7807 ] + 735.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Page28': class PDFPage -260 0 obj -% Page dictionary -<< /Annots [ 256 0 R - 257 0 R - 258 0 R - 259 0 R ] - /Contents 373 0 R - /MediaBox [ 0 - 0 - 595.2756 - 841.8898 ] - /Parent 345 0 R - /Resources << /Font 1 0 R - /ProcSet [ /PDF - /Text - /ImageB - /ImageC - /ImageI ] >> - /Rotate 0 - /Trans << >> - /Type /Page >> -endobj -% 'Annot.NUMBER228': class PDFDictionary -261 0 obj +% 'Annot.NUMBER229': class PDFDictionary +262 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4433,14 +4446,14 @@ endobj 0 0 ] /Rect [ 363.1739 - 741.7736 + 699.7736 386.5004 - 753.7736 ] + 711.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER229': class PDFDictionary -262 0 obj +% 'Annot.NUMBER230': class PDFDictionary +263 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4448,14 +4461,14 @@ endobj 0 0 ] /Rect [ 479.7508 - 729.7736 + 687.7736 501.4627 - 741.7736 ] + 699.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER230': class PDFDictionary -263 0 obj +% 'Annot.NUMBER231': class PDFDictionary +264 0 obj << /A << /S /URI /Type /Action /URI (http://docs.python.org/library/cmd.html) >> @@ -4463,14 +4476,14 @@ endobj 0 0 ] /Rect [ 366.9454 - 699.7736 + 657.7736 388.8033 - 711.7736 ] + 669.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER231': class PDFDictionary -264 0 obj +% 'Annot.NUMBER232': class PDFDictionary +265 0 obj << /A << /S /URI /Type /Action /URI (http://docs.python.org/library/cmd.html) >> @@ -4478,14 +4491,14 @@ endobj 0 0 ] /Rect [ 170.8855 - 687.7736 + 645.7736 189.7755 - 699.7736 ] + 657.7736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER232': class PDFDictionary -265 0 obj +% 'Annot.NUMBER233': class PDFDictionary +266 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -4493,14 +4506,14 @@ endobj 0 0 ] /Rect [ 390.8027 - 346.5736 + 304.5736 435.0027 - 358.5736 ] + 316.5736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER233': class PDFDictionary -266 0 obj +% 'Annot.NUMBER234': class PDFDictionary +267 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4508,14 +4521,14 @@ endobj 0 0 ] /Rect [ 213.451 - 334.5736 + 292.5736 237.5255 - 346.5736 ] + 304.5736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER234': class PDFDictionary -267 0 obj +% 'Annot.NUMBER235': class PDFDictionary +268 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -4523,24 +4536,9 @@ endobj 0 0 ] /Rect [ 114.9429 - 310.5736 + 268.5736 157.1829 - 322.5736 ] - /Subtype /Link - /Type /Annot >> -endobj -% 'Annot.NUMBER235': class PDFDictionary -268 0 obj -<< /A << /S /URI - /Type /Action - /URI (http://pypi.python.org/pypi/plac) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 385.0429 - 310.5736 - 403.3829 - 322.5736 ] + 280.5736 ] /Subtype /Link /Type /Annot >> endobj @@ -4552,10 +4550,10 @@ endobj /Border [ 0 0 0 ] - /Rect [ 350.6129 - 280.5736 - 371.7329 - 292.5736 ] + /Rect [ 385.0429 + 268.5736 + 403.3829 + 280.5736 ] /Subtype /Link /Type /Annot >> endobj @@ -4567,10 +4565,10 @@ endobj /Border [ 0 0 0 ] - /Rect [ 256.6729 - 262.5736 - 277.7929 - 274.5736 ] + /Rect [ 350.6129 + 238.5736 + 371.7329 + 250.5736 ] /Subtype /Link /Type /Annot >> endobj @@ -4582,32 +4580,19 @@ endobj /Border [ 0 0 0 ] - /Rect [ 149.5469 - 169.3736 - 172.1982 - 181.3736 ] - /Subtype /Link - /Type /Annot >> -endobj -% 'Annot.NUMBER239': class PDFDictionary -272 0 obj -<< /A << /S /URI - /Type /Action - /URI (http://docs.python.org/distutils/) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 224.3178 - 157.3736 - 260.8853 - 169.3736 ] + /Rect [ 256.6729 + 220.5736 + 277.7929 + 232.5736 ] /Subtype /Link /Type /Annot >> endobj % 'Page29': class PDFPage -273 0 obj +272 0 obj % Page dictionary -<< /Annots [ 261 0 R +<< /Annots [ 259 0 R + 260 0 R + 261 0 R 262 0 R 263 0 R 264 0 R @@ -4617,14 +4602,13 @@ endobj 268 0 R 269 0 R 270 0 R - 271 0 R - 272 0 R ] - /Contents 374 0 R + 271 0 R ] + /Contents 375 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4635,15 +4619,47 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Page30': class PDFPage +% 'Annot.NUMBER239': class PDFDictionary +273 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://pypi.python.org/pypi/plac) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 149.5469 + 729.7736 + 172.1982 + 741.7736 ] + /Subtype /Link + /Type /Annot >> +endobj +% 'Annot.NUMBER240': class PDFDictionary 274 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://docs.python.org/distutils/) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 224.3178 + 717.7736 + 260.8853 + 729.7736 ] + /Subtype /Link + /Type /Annot >> +endobj +% 'Page30': class PDFPage +275 0 obj % Page dictionary -<< /Contents 375 0 R +<< /Annots [ 273 0 R + 274 0 R ] + /Contents 376 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4654,8 +4670,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER240': class PDFDictionary -275 0 obj +% 'Annot.NUMBER241': class PDFDictionary +276 0 obj << /A << /S /URI /Type /Action /URI (http://argparse.googlecode.com) >> @@ -4663,14 +4679,14 @@ endobj 0 0 ] /Rect [ 381.1529 - 741.7736 + 612.5736 423.3929 - 753.7736 ] + 624.5736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER241': class PDFDictionary -276 0 obj +% 'Annot.NUMBER242': class PDFDictionary +277 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4678,23 +4694,23 @@ endobj 0 0 ] /Rect [ 62.69291 - 336.1736 + 206.9736 84.72012 - 348.1736 ] + 218.9736 ] /Subtype /Link /Type /Annot >> endobj % 'Page31': class PDFPage -277 0 obj +278 0 obj % Page dictionary -<< /Annots [ 275 0 R - 276 0 R ] - /Contents 376 0 R +<< /Annots [ 276 0 R + 277 0 R ] + /Contents 377 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4706,14 +4722,14 @@ endobj /Type /Page >> endobj % 'Page32': class PDFPage -278 0 obj +279 0 obj % Page dictionary -<< /Contents 377 0 R +<< /Contents 378 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4724,8 +4740,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER242': class PDFDictionary -279 0 obj +% 'Annot.NUMBER243': class PDFDictionary +280 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4733,22 +4749,22 @@ endobj 0 0 ] /Rect [ 182.479 - 313.3736 + 194.1736 203.7662 - 325.3736 ] + 206.1736 ] /Subtype /Link /Type /Annot >> endobj % 'Page33': class PDFPage -280 0 obj +281 0 obj % Page dictionary -<< /Annots [ 279 0 R ] - /Contents 378 0 R +<< /Annots [ 280 0 R ] + /Contents 379 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4759,63 +4775,31 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER243': class PDFDictionary -281 0 obj -<< /A << /S /URI - /Type /Action - /URI (http://pypi.python.org/pypi/plac) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 255.1228 - 343.3736 - 276.5028 - 355.3736 ] - /Subtype /Link - /Type /Annot >> -endobj % 'Annot.NUMBER244': class PDFDictionary 282 0 obj -<< /A << /S /URI - /Type /Action - /URI (http://docs.python.org/library/multiprocessing.html) >> - /Border [ 0 - 0 - 0 ] - /Rect [ 295.0229 - 188.1736 - 367.2629 - 200.1736 ] - /Subtype /Link - /Type /Annot >> -endobj -% 'Annot.NUMBER245': class PDFDictionary -283 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> /Border [ 0 0 0 ] - /Rect [ 179.1295 - 140.1736 - 201.6839 - 152.1736 ] + /Rect [ 255.1228 + 239.3736 + 276.5028 + 251.3736 ] /Subtype /Link /Type /Annot >> endobj % 'Page34': class PDFPage -284 0 obj +283 0 obj % Page dictionary -<< /Annots [ 281 0 R - 282 0 R - 283 0 R ] - /Contents 379 0 R +<< /Annots [ 282 0 R ] + /Contents 380 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4826,6 +4810,21 @@ endobj /Trans << >> /Type /Page >> endobj +% 'Annot.NUMBER245': class PDFDictionary +284 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://docs.python.org/library/multiprocessing.html) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 295.0229 + 741.7736 + 367.2629 + 753.7736 ] + /Subtype /Link + /Type /Annot >> +endobj % 'Annot.NUMBER246': class PDFDictionary 285 0 obj << /A << /S /URI @@ -4834,10 +4833,10 @@ endobj /Border [ 0 0 0 ] - /Rect [ 414.8874 - 307.3736 - 436.9487 - 319.3736 ] + /Rect [ 179.1295 + 693.7736 + 201.6839 + 705.7736 ] /Subtype /Link /Type /Annot >> endobj @@ -4849,24 +4848,25 @@ endobj /Border [ 0 0 0 ] - /Rect [ 122.7054 - 163.3736 - 145.2085 - 175.3736 ] + /Rect [ 414.8874 + 203.3736 + 436.9487 + 215.3736 ] /Subtype /Link /Type /Annot >> endobj % 'Page35': class PDFPage 287 0 obj % Page dictionary -<< /Annots [ 285 0 R +<< /Annots [ 284 0 R + 285 0 R 286 0 R ] - /Contents 380 0 R + /Contents 381 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4877,15 +4877,31 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Page36': class PDFPage +% 'Annot.NUMBER248': class PDFDictionary 288 0 obj +<< /A << /S /URI + /Type /Action + /URI (http://pypi.python.org/pypi/plac) >> + /Border [ 0 + 0 + 0 ] + /Rect [ 122.7054 + 735.7736 + 145.2085 + 747.7736 ] + /Subtype /Link + /Type /Annot >> +endobj +% 'Page36': class PDFPage +289 0 obj % Page dictionary -<< /Contents 381 0 R +<< /Annots [ 288 0 R ] + /Contents 382 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4896,8 +4912,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER248': class PDFDictionary -289 0 obj +% 'Annot.NUMBER249': class PDFDictionary +290 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4905,14 +4921,14 @@ endobj 0 0 ] /Rect [ 183.3657 - 336.5736 + 243.3736 207.8364 - 348.5736 ] + 255.3736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER249': class PDFDictionary -290 0 obj +% 'Annot.NUMBER250': class PDFDictionary +291 0 obj << /A << /S /URI /Type /Action /URI (http://docs.python.org/library/multiprocessing.html) >> @@ -4920,23 +4936,23 @@ endobj 0 0 ] /Rect [ 254.9929 - 312.5736 + 219.3736 327.2329 - 324.5736 ] + 231.3736 ] /Subtype /Link /Type /Annot >> endobj % 'Page37': class PDFPage -291 0 obj +292 0 obj % Page dictionary -<< /Annots [ 289 0 R - 290 0 R ] - /Contents 382 0 R +<< /Annots [ 290 0 R + 291 0 R ] + /Contents 383 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4947,8 +4963,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER250': class PDFDictionary -292 0 obj +% 'Annot.NUMBER251': class PDFDictionary +293 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4956,22 +4972,22 @@ endobj 0 0 ] /Rect [ 62.69291 - 540.5736 + 444.5736 85.70846 - 552.5736 ] + 456.5736 ] /Subtype /Link /Type /Annot >> endobj % 'Page38': class PDFPage -293 0 obj +294 0 obj % Page dictionary -<< /Annots [ 292 0 R ] - /Contents 383 0 R +<< /Annots [ 293 0 R ] + /Contents 384 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -4982,8 +4998,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER251': class PDFDictionary -294 0 obj +% 'Annot.NUMBER252': class PDFDictionary +295 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -4991,14 +5007,14 @@ endobj 0 0 ] /Rect [ 176.9371 - 668.5736 + 572.5736 198.5507 - 680.5736 ] + 584.5736 ] /Subtype /Link /Type /Annot >> endobj -% 'Annot.NUMBER252': class PDFDictionary -295 0 obj +% 'Annot.NUMBER253': class PDFDictionary +296 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -5006,23 +5022,23 @@ endobj 0 0 ] /Rect [ 62.69291 - 303.3736 + 207.3736 84.98766 - 315.3736 ] + 219.3736 ] /Subtype /Link /Type /Annot >> endobj % 'Page39': class PDFPage -296 0 obj +297 0 obj % Page dictionary -<< /Annots [ 294 0 R - 295 0 R ] - /Contents 384 0 R +<< /Annots [ 295 0 R + 296 0 R ] + /Contents 385 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -5034,14 +5050,14 @@ endobj /Type /Page >> endobj % 'Page40': class PDFPage -297 0 obj +298 0 obj % Page dictionary -<< /Contents 385 0 R +<< /Contents 386 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -5052,8 +5068,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER253': class PDFDictionary -298 0 obj +% 'Annot.NUMBER254': class PDFDictionary +299 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -5061,22 +5077,22 @@ endobj 0 0 ] /Rect [ 473.5049 - 319.3736 + 211.3736 494.7927 - 331.3736 ] + 223.3736 ] /Subtype /Link /Type /Annot >> endobj % 'Page41': class PDFPage -299 0 obj +300 0 obj % Page dictionary -<< /Annots [ 298 0 R ] - /Contents 386 0 R +<< /Annots [ 299 0 R ] + /Contents 387 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -5087,8 +5103,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER254': class PDFDictionary -300 0 obj +% 'Annot.NUMBER255': class PDFDictionary +301 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -5101,9 +5117,9 @@ endobj 657.7736 ] /Subtype /Link /Type /Annot >> -endobj -% 'Annot.NUMBER255': class PDFDictionary -301 0 obj +endobj +% 'Annot.NUMBER256': class PDFDictionary +302 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -5118,16 +5134,16 @@ endobj /Type /Annot >> endobj % 'Page42': class PDFPage -302 0 obj +303 0 obj % Page dictionary -<< /Annots [ 300 0 R - 301 0 R ] - /Contents 387 0 R +<< /Annots [ 301 0 R + 302 0 R ] + /Contents 388 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -5138,8 +5154,8 @@ endobj /Trans << >> /Type /Page >> endobj -% 'Annot.NUMBER256': class PDFDictionary -303 0 obj +% 'Annot.NUMBER257': class PDFDictionary +304 0 obj << /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/plac) >> @@ -5154,15 +5170,15 @@ endobj /Type /Annot >> endobj % 'Page43': class PDFPage -304 0 obj +305 0 obj % Page dictionary -<< /Annots [ 303 0 R ] - /Contents 388 0 R +<< /Annots [ 304 0 R ] + /Contents 389 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -5174,14 +5190,14 @@ endobj /Type /Page >> endobj % 'Page44': class PDFPage -305 0 obj +306 0 obj % Page dictionary -<< /Contents 389 0 R +<< /Contents 390 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 345 0 R + /Parent 346 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -5192,516 +5208,516 @@ endobj /Trans << >> /Type /Page >> endobj -% 'R306': class PDFCatalog -306 0 obj +% 'R307': class PDFCatalog +307 0 obj % Document Root -<< /Outlines 308 0 R - /PageLabels 390 0 R +<< /Outlines 309 0 R + /PageLabels 391 0 R /PageMode /UseNone - /Pages 345 0 R + /Pages 346 0 R /Type /Catalog >> endobj -% 'R307': class PDFInfo -307 0 obj +% 'R308': class PDFInfo +308 0 obj << /Author () - /CreationDate (D:20110529082056-01'00') + /CreationDate (D:20110529090657-01'00') /Creator (\(unspecified\)) /Keywords () /Producer (ReportLab PDF Library - www.reportlab.com) /Subject (\(unspecified\)) /Title () >> endobj -% 'R308': class PDFOutlines -308 0 obj +% 'R309': class PDFOutlines +309 0 obj << /Count 38 - /First 309 0 R - /Last 324 0 R + /First 310 0 R + /Last 325 0 R /Type /Outlines >> endobj % 'Outline.0': class OutlineEntryObject -309 0 obj +310 0 obj << /Count 14 /Dest [ 8 0 R /XYZ 62.69291 765.0236 0 ] - /First 310 0 R - /Last 323 0 R - /Next 324 0 R - /Parent 308 0 R + /First 311 0 R + /Last 324 0 R + /Next 325 0 R + /Parent 309 0 R /Title (Plac: Parsing the Command Line the Easy Way) >> endobj % 'Outline.37.0': class OutlineEntryObject -310 0 obj +311 0 obj << /Dest [ 97 0 R /XYZ 62.69291 765.0236 0 ] - /Next 311 0 R - /Parent 309 0 R + /Next 312 0 R + /Parent 310 0 R /Title (The importance of scaling down) >> endobj % 'Outline.37.1': class OutlineEntryObject -311 0 obj +312 0 obj << /Dest [ 97 0 R /XYZ 62.69291 411.0236 0 ] - /Next 312 0 R - /Parent 309 0 R - /Prev 310 0 R - /Title (Scripts with required arguments) >> -endobj -% 'Outline.37.2': class OutlineEntryObject -312 0 obj -<< /Dest [ 111 0 R - /XYZ - 62.69291 - 765.0236 - 0 ] /Next 313 0 R - /Parent 309 0 R + /Parent 310 0 R /Prev 311 0 R - /Title (Scripts with default arguments) >> + /Title (Scripts with required arguments) >> endobj -% 'Outline.37.3': class OutlineEntryObject +% 'Outline.37.2': class OutlineEntryObject 313 0 obj -<< /Dest [ 121 0 R +<< /Dest [ 112 0 R /XYZ 62.69291 - 741.0236 + 765.0236 0 ] /Next 314 0 R - /Parent 309 0 R + /Parent 310 0 R /Prev 312 0 R - /Title (Scripts with options \(and smart options\)) >> + /Title (Scripts with default arguments) >> endobj -% 'Outline.37.4': class OutlineEntryObject +% 'Outline.37.3': class OutlineEntryObject 314 0 obj -<< /Dest [ 125 0 R +<< /Dest [ 122 0 R /XYZ 62.69291 - 765.0236 + 707.8236 0 ] /Next 315 0 R - /Parent 309 0 R + /Parent 310 0 R /Prev 313 0 R - /Title (Scripts with flags) >> + /Title (Scripts with options \(and smart options\)) >> endobj -% 'Outline.37.5': class OutlineEntryObject +% 'Outline.37.4': class OutlineEntryObject 315 0 obj -<< /Dest [ 125 0 R +<< /Dest [ 126 0 R /XYZ 62.69291 - 265.7299 + 715.8236 0 ] /Next 316 0 R - /Parent 309 0 R + /Parent 310 0 R /Prev 314 0 R - /Title (plac for Python 2.X users) >> + /Title (Scripts with flags) >> endobj -% 'Outline.37.6': class OutlineEntryObject +% 'Outline.37.5': class OutlineEntryObject 316 0 obj -<< /Dest [ 133 0 R +<< /Dest [ 126 0 R /XYZ 62.69291 - 522.6236 + 216.5299 0 ] /Next 317 0 R - /Parent 309 0 R + /Parent 310 0 R /Prev 315 0 R - /Title (More features) >> + /Title (plac for Python 2.X users) >> endobj -% 'Outline.37.7': class OutlineEntryObject +% 'Outline.37.6': class OutlineEntryObject 317 0 obj -<< /Dest [ 138 0 R +<< /Dest [ 134 0 R /XYZ 62.69291 - 552.6236 + 457.4236 0 ] /Next 318 0 R - /Parent 309 0 R + /Parent 310 0 R /Prev 316 0 R - /Title (A realistic example) >> + /Title (More features) >> endobj -% 'Outline.37.8': class OutlineEntryObject +% 'Outline.37.7': class OutlineEntryObject 318 0 obj -<< /Dest [ 141 0 R +<< /Dest [ 139 0 R /XYZ 62.69291 - 513.8236 + 478.6236 0 ] /Next 319 0 R - /Parent 309 0 R + /Parent 310 0 R /Prev 317 0 R - /Title (Keyword arguments) >> + /Title (A realistic example) >> endobj -% 'Outline.37.9': class OutlineEntryObject +% 'Outline.37.8': class OutlineEntryObject 319 0 obj -<< /Dest [ 143 0 R +<< /Dest [ 142 0 R /XYZ 62.69291 - 493.4236 + 420.6236 0 ] /Next 320 0 R - /Parent 309 0 R + /Parent 310 0 R /Prev 318 0 R - /Title (Final example: a shelve interface) >> + /Title (Keyword arguments) >> endobj -% 'Outline.37.10': class OutlineEntryObject +% 'Outline.37.9': class OutlineEntryObject 320 0 obj -<< /Dest [ 162 0 R +<< /Dest [ 144 0 R /XYZ 62.69291 - 422.6236 + 409.4236 0 ] /Next 321 0 R - /Parent 309 0 R + /Parent 310 0 R /Prev 319 0 R - /Title (plac vs argparse) >> + /Title (Final example: a shelve interface) >> endobj -% 'Outline.37.11': class OutlineEntryObject +% 'Outline.37.10': class OutlineEntryObject 321 0 obj -<< /Dest [ 213 0 R +<< /Dest [ 159 0 R /XYZ 62.69291 - 765.0236 + 357.4236 0 ] /Next 322 0 R - /Parent 309 0 R + /Parent 310 0 R /Prev 320 0 R - /Title (plac vs the rest of the world) >> + /Title (plac vs argparse) >> endobj -% 'Outline.37.12': class OutlineEntryObject +% 'Outline.37.11': class OutlineEntryObject 322 0 obj -<< /Dest [ 213 0 R +<< /Dest [ 211 0 R /XYZ 62.69291 - 495.0236 + 705.0236 0 ] /Next 323 0 R - /Parent 309 0 R + /Parent 310 0 R /Prev 321 0 R - /Title (The future) >> + /Title (plac vs the rest of the world) >> endobj -% 'Outline.37.13': class OutlineEntryObject +% 'Outline.37.12': class OutlineEntryObject 323 0 obj -<< /Dest [ 213 0 R +<< /Dest [ 211 0 R /XYZ 62.69291 - 291.0236 + 435.0236 0 ] - /Parent 309 0 R + /Next 324 0 R + /Parent 310 0 R /Prev 322 0 R - /Title (Trivia: the story behind the name) >> + /Title (The future) >> endobj -% 'Outline.1': class OutlineEntryObject +% 'Outline.37.13': class OutlineEntryObject 324 0 obj -<< /Count 20 - /Dest [ 227 0 R +<< /Dest [ 211 0 R /XYZ 62.69291 - 681.0236 + 231.0236 0 ] - /First 325 0 R - /Last 344 0 R - /Parent 308 0 R - /Prev 309 0 R - /Title (Advanced usages of plac) >> + /Parent 310 0 R + /Prev 323 0 R + /Title (Trivia: the story behind the name) >> endobj -% 'Outline.38.0': class OutlineEntryObject +% 'Outline.1': class OutlineEntryObject 325 0 obj -<< /Dest [ 227 0 R +<< /Count 20 + /Dest [ 228 0 R /XYZ 62.69291 - 648.0236 + 597.0236 0 ] - /Next 326 0 R - /Parent 324 0 R - /Title (Introduction) >> + /First 326 0 R + /Last 345 0 R + /Parent 309 0 R + /Prev 310 0 R + /Title (Advanced usages of plac) >> endobj -% 'Outline.38.1': class OutlineEntryObject +% 'Outline.38.0': class OutlineEntryObject 326 0 obj -<< /Dest [ 227 0 R +<< /Dest [ 228 0 R /XYZ 62.69291 - 426.0236 + 564.0236 0 ] /Next 327 0 R - /Parent 324 0 R - /Prev 325 0 R - /Title (From scripts to interactive applications) >> + /Parent 325 0 R + /Title (Introduction) >> endobj -% 'Outline.38.2': class OutlineEntryObject +% 'Outline.38.1': class OutlineEntryObject 327 0 obj -<< /Dest [ 230 0 R +<< /Dest [ 228 0 R /XYZ 62.69291 - 629.8236 + 342.0236 0 ] /Next 328 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 326 0 R - /Title (Testing a plac application) >> + /Title (From scripts to interactive applications) >> endobj -% 'Outline.38.3': class OutlineEntryObject +% 'Outline.38.2': class OutlineEntryObject 328 0 obj -<< /Dest [ 233 0 R +<< /Dest [ 231 0 R /XYZ 62.69291 - 609.0236 + 545.8236 0 ] /Next 329 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 327 0 R - /Title (Plac easy tests) >> + /Title (Testing a plac application) >> endobj -% 'Outline.38.4': class OutlineEntryObject +% 'Outline.38.3': class OutlineEntryObject 329 0 obj -<< /Dest [ 244 0 R +<< /Dest [ 234 0 R /XYZ 62.69291 - 299.8485 + 509.8236 0 ] /Next 330 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 328 0 R - /Title (Plac batch scripts) >> + /Title (Plac easy tests) >> endobj -% 'Outline.38.5': class OutlineEntryObject +% 'Outline.38.4': class OutlineEntryObject 330 0 obj -<< /Dest [ 249 0 R +<< /Dest [ 245 0 R /XYZ 62.69291 - 378.6236 + 215.8485 0 ] /Next 331 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 329 0 R - /Title (Implementing subcommands) >> + /Title (Plac batch scripts) >> endobj -% 'Outline.38.6': class OutlineEntryObject +% 'Outline.38.5': class OutlineEntryObject 331 0 obj -<< /Dest [ 254 0 R +<< /Dest [ 250 0 R /XYZ 62.69291 - 330.0679 + 322.6236 0 ] /Next 332 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 330 0 R - /Title (plac.Interpreter.call) >> + /Title (Implementing subcommands) >> endobj -% 'Outline.38.7': class OutlineEntryObject +% 'Outline.38.6': class OutlineEntryObject 332 0 obj -<< /Dest [ 260 0 R +<< /Dest [ 255 0 R /XYZ 62.69291 - 717.0236 + 310.0679 0 ] /Next 333 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 331 0 R - /Title (Readline support) >> + /Title (plac.Interpreter.call) >> endobj -% 'Outline.38.8': class OutlineEntryObject +% 'Outline.38.7': class OutlineEntryObject 333 0 obj -<< /Dest [ 273 0 R +<< /Dest [ 258 0 R /XYZ 62.69291 - 204.6236 + 681.0236 0 ] /Next 334 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 332 0 R - /Title (The plac runner) >> + /Title (Readline support) >> endobj -% 'Outline.38.9': class OutlineEntryObject +% 'Outline.38.8': class OutlineEntryObject 334 0 obj -<< /Dest [ 277 0 R +<< /Dest [ 275 0 R /XYZ 62.69291 - 371.4236 + 765.0236 0 ] /Next 335 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 333 0 R - /Title (A non class-based example) >> + /Title (The plac runner) >> endobj -% 'Outline.38.10': class OutlineEntryObject +% 'Outline.38.9': class OutlineEntryObject 335 0 obj -<< /Dest [ 280 0 R +<< /Dest [ 278 0 R /XYZ 62.69291 - 348.6236 + 242.2236 0 ] /Next 336 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 334 0 R - /Title (Writing your own plac runner) >> + /Title (A non class-based example) >> endobj -% 'Outline.38.11': class OutlineEntryObject +% 'Outline.38.10': class OutlineEntryObject 336 0 obj -<< /Dest [ 284 0 R +<< /Dest [ 281 0 R /XYZ 62.69291 - 175.4236 + 229.4236 0 ] /Next 337 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 335 0 R - /Title (Long running commands) >> + /Title (Writing your own plac runner) >> endobj -% 'Outline.38.12': class OutlineEntryObject +% 'Outline.38.11': class OutlineEntryObject 337 0 obj << /Dest [ 287 0 R /XYZ 62.69291 - 282.6236 + 729.0236 0 ] /Next 338 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 336 0 R - /Title (Threaded commands) >> + /Title (Long running commands) >> endobj -% 'Outline.38.13': class OutlineEntryObject +% 'Outline.38.12': class OutlineEntryObject 338 0 obj -<< /Dest [ 291 0 R +<< /Dest [ 287 0 R /XYZ 62.69291 - 383.8236 + 178.6236 0 ] /Next 339 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 337 0 R - /Title (Running commands as external processes) >> + /Title (Threaded commands) >> endobj -% 'Outline.38.14': class OutlineEntryObject +% 'Outline.38.13': class OutlineEntryObject 339 0 obj -<< /Dest [ 293 0 R +<< /Dest [ 292 0 R /XYZ 62.69291 - 575.8236 + 290.6236 0 ] /Next 340 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 338 0 R - /Title (Managing the output of concurrent commands) >> + /Title (Running commands as external processes) >> endobj -% 'Outline.38.15': class OutlineEntryObject +% 'Outline.38.14': class OutlineEntryObject 340 0 obj -<< /Dest [ 296 0 R +<< /Dest [ 294 0 R /XYZ 62.69291 - 703.8236 + 479.8236 0 ] /Next 341 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 339 0 R - /Title (Monitor support) >> + /Title (Managing the output of concurrent commands) >> endobj -% 'Outline.38.16': class OutlineEntryObject +% 'Outline.38.15': class OutlineEntryObject 341 0 obj -<< /Dest [ 296 0 R +<< /Dest [ 297 0 R /XYZ 62.69291 - 338.6236 + 607.8236 0 ] /Next 342 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 340 0 R - /Title (Parallel computing with plac) >> + /Title (Monitor support) >> endobj -% 'Outline.38.17': class OutlineEntryObject +% 'Outline.38.16': class OutlineEntryObject 342 0 obj -<< /Dest [ 302 0 R +<< /Dest [ 297 0 R /XYZ 62.69291 - 765.0236 + 242.6236 0 ] /Next 343 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 341 0 R - /Title (The plac server) >> + /Title (Parallel computing with plac) >> endobj -% 'Outline.38.18': class OutlineEntryObject +% 'Outline.38.17': class OutlineEntryObject 343 0 obj -<< /Dest [ 302 0 R +<< /Dest [ 303 0 R /XYZ 62.69291 - 294.6236 + 765.0236 0 ] /Next 344 0 R - /Parent 324 0 R + /Parent 325 0 R /Prev 342 0 R + /Title (The plac server) >> +endobj +% 'Outline.38.18': class OutlineEntryObject +344 0 obj +<< /Dest [ 303 0 R + /XYZ + 62.69291 + 294.6236 + 0 ] + /Next 345 0 R + /Parent 325 0 R + /Prev 343 0 R /Title (Summary) >> endobj % 'Outline.38.19': class OutlineEntryObject -344 0 obj -<< /Dest [ 304 0 R +345 0 obj +<< /Dest [ 305 0 R /XYZ 62.69291 652.6772 0 ] - /Parent 324 0 R - /Prev 343 0 R + /Parent 325 0 R + /Prev 344 0 R /Title (Appendix: custom annotation objects) >> endobj -% 'R345': class PDFPages -345 0 obj +% 'R346': class PDFPages +346 0 obj % page tree << /Count 44 /Kids [ 8 0 R 81 0 R 97 0 R 107 0 R - 111 0 R - 115 0 R - 121 0 R + 112 0 R + 116 0 R 122 0 R - 125 0 R - 133 0 R + 123 0 R + 126 0 R 134 0 R - 138 0 R - 141 0 R - 143 0 R - 146 0 R - 162 0 R - 175 0 R - 213 0 R - 227 0 R + 135 0 R + 139 0 R + 142 0 R + 144 0 R + 147 0 R + 159 0 R + 174 0 R + 211 0 R 228 0 R - 230 0 R - 233 0 R - 244 0 R - 249 0 R - 253 0 R + 229 0 R + 231 0 R + 234 0 R + 245 0 R + 250 0 R 254 0 R 255 0 R - 260 0 R - 273 0 R - 274 0 R - 277 0 R + 256 0 R + 258 0 R + 272 0 R + 275 0 R 278 0 R - 280 0 R - 284 0 R + 279 0 R + 281 0 R + 283 0 R 287 0 R - 288 0 R - 291 0 R - 293 0 R - 296 0 R + 289 0 R + 292 0 R + 294 0 R 297 0 R - 299 0 R - 302 0 R - 304 0 R - 305 0 R ] + 298 0 R + 300 0 R + 303 0 R + 305 0 R + 306 0 R ] /Type /Pages >> endobj -% 'R346': class PDFStream -346 0 obj +% 'R347': class PDFStream +347 0 obj % page stream << /Length 2935 >> stream @@ -5896,8 +5912,8 @@ Q endstream endobj -% 'R347': class PDFStream -347 0 obj +% 'R348': class PDFStream +348 0 obj % page stream << /Length 9629 >> stream @@ -6259,7 +6275,7 @@ q q 0 0 .501961 rg 0 0 .501961 RG -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 60.88 0 Td (29) Tj T* -60.88 0 Td ET +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 60.88 0 Td (30) Tj T* -60.88 0 Td ET Q Q q @@ -6301,7 +6317,7 @@ q q 0 0 .501961 rg 0 0 .501961 RG -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 60.88 0 Td (34) Tj T* -60.88 0 Td ET +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 60.88 0 Td (35) Tj T* -60.88 0 Td ET Q Q q @@ -6429,8 +6445,8 @@ Q endstream endobj -% 'R348': class PDFStream -348 0 obj +% 'R349': class PDFStream +349 0 obj % page stream << /Length 5956 >> stream @@ -6514,10 +6530,10 @@ Q endstream endobj -% 'R349': class PDFStream -349 0 obj +% 'R350': class PDFStream +350 0 obj % page stream -<< /Length 4418 >> +<< /Length 4163 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q @@ -6548,20 +6564,20 @@ Q Q Q q -1 0 0 1 62.69291 471.8236 cm +1 0 0 1 62.69291 495.8236 cm q 0 0 0 rg -BT 1 0 0 1 0 38 Tm /F1 10 Tf 12 TL 1.644269 Tw (However saving three lines does not justify introducing the external dependency: most people will not) Tj T* 0 Tw 2.206303 Tw (switch to Python 2.7, which at the time of this writing is just about to be released, for many years.) Tj T* 0 Tw .678488 Tw (Moreover, it just feels too complex to instantiate a class and to define a parser by hand for such a trivial) Tj T* 0 Tw (task.) Tj T* ET +BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .817488 Tw (However, it just feels too complex to instantiate a class and to define a parser by hand for such a trivial) Tj T* 0 Tw (task.) Tj T* ET Q Q q -1 0 0 1 62.69291 441.8236 cm +1 0 0 1 62.69291 465.8236 cm q BT 1 0 0 1 0 14 Tm 1.123145 Tw 12 TL /F1 10 Tf 0 0 0 rg (The ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (module is designed to manage well such use cases, and it is able to reduce the original nine) Tj T* 0 Tw (lines of boiler plate to two lines. With the ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (module all you need to write is) Tj T* ET Q Q q -1 0 0 1 62.69291 324.6236 cm +1 0 0 1 62.69291 348.6236 cm q q 1 0 0 1 0 0 cm @@ -6582,13 +6598,13 @@ Q Q Q q -1 0 0 1 62.69291 292.6236 cm +1 0 0 1 62.69291 316.6236 cm q BT 1 0 0 1 0 14 Tm .929986 Tw 12 TL /F1 10 Tf 0 0 0 rg (The ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (module provides for free \(actually the work is done by the underlying ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (module\) a nice) Tj T* 0 Tw (usage message:) Tj T* ET Q Q q -1 0 0 1 62.69291 259.4236 cm +1 0 0 1 62.69291 283.4236 cm q q 1 0 0 1 0 0 cm @@ -6609,7 +6625,7 @@ Q Q Q q -1 0 0 1 62.69291 130.2236 cm +1 0 0 1 62.69291 154.2236 cm q q 1 0 0 1 0 0 cm @@ -6630,7 +6646,7 @@ Q Q Q q -1 0 0 1 62.69291 98.22362 cm +1 0 0 1 62.69291 122.2236 cm q BT 1 0 0 1 0 14 Tm .167765 Tw 12 TL /F1 10 Tf 0 0 0 rg (Moreover ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (manages the case of missing arguments and of too many arguments. This is only the tip of) Tj T* 0 Tw (the iceberg: ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is able to do much more than that.) Tj T* ET Q @@ -6645,10 +6661,10 @@ Q endstream endobj -% 'R350': class PDFStream -350 0 obj +% 'R351': class PDFStream +351 0 obj % page stream -<< /Length 4021 >> +<< /Length 4211 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q @@ -6733,16 +6749,16 @@ n -6 -6 468.6898 144 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 122 Tm /F3 10 Tf 12 TL (usage: example5.py [-h] dsn [table] [today]) Tj T* T* (Do something on the database) Tj T* T* (positional arguments:) Tj T* ( dsn) Tj T* ( table) Tj T* ( today) Tj T* T* (optional arguments:) Tj T* ( -h, --help show this help message and exit) Tj T* ET +BT 1 0 0 1 0 122 Tm /F3 10 Tf 12 TL (usage: example5.py [-h] dsn [table] [today]) Tj T* T* (Do something on the database) Tj T* T* (positional arguments:) Tj T* ( dsn) Tj T* ( table [product]) Tj T* ( today [YYYY-MM-DD]) Tj T* T* (optional arguments:) Tj T* ( -h, --help show this help message and exit) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 197.4236 cm +1 0 0 1 62.69291 185.4236 cm q -BT 1 0 0 1 0 14 Tm .396235 Tw 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (manages transparently even the case when you want to pass a variable number of arguments. Here) Tj T* 0 Tw (is an example, a script running on a database a series of SQL scripts:) Tj T* ET +BT 1 0 0 1 0 26 Tm .81311 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that by default ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (prints the string representation of the default values \(with square brackets\) in) Tj T* 0 Tw .117485 Tw (the usage message. ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (manages transparently even the case when you want to pass a variable number) Tj T* 0 Tw (of arguments. Here is an example, a script running on a database a series of SQL scripts:) Tj T* ET Q Q q @@ -6756,11 +6772,11 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 96 re B* +n -6 -6 468.6898 84 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 74 Tm /F3 10 Tf 12 TL (# example7.py) Tj T* (from datetime import datetime) Tj T* T* (def main\(dsn, *scripts\):) Tj T* ( "Run the given scripts on the database") Tj T* ( for script in scripts:) Tj T* ( print\('executing %s' % script\)) Tj T* ET +BT 1 0 0 1 0 62 Tm /F3 10 Tf 12 TL (# example7.py) Tj T* (from datetime import datetime) Tj T* T* (def main\(dsn, *scripts\):) Tj T* ( "Run the given scripts on the database") Tj T* ( for script in scripts:) Tj T* ET Q Q Q @@ -6776,14 +6792,14 @@ Q endstream endobj -% 'R351': class PDFStream -351 0 obj +% 'R352': class PDFStream +352 0 obj % page stream -<< /Length 3872 >> +<< /Length 3873 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 703.8236 cm +1 0 0 1 62.69291 691.8236 cm q q 1 0 0 1 0 0 cm @@ -6793,25 +6809,25 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 60 re B* +n -6 -6 468.6898 72 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 38 Tm /F3 10 Tf 12 TL ( # ...) Tj T* T* (if __name__ == '__main__':) Tj T* ( import plac; plac.call\(main\)) Tj T* ET +BT 1 0 0 1 0 50 Tm /F3 10 Tf 12 TL ( print\('executing %s' % script\)) Tj T* ( # ...) Tj T* T* (if __name__ == '__main__':) Tj T* ( import plac; plac.call\(main\)) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 683.8236 cm +1 0 0 1 62.69291 671.8236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is the usage message:) Tj T* ET Q Q q -1 0 0 1 62.69291 542.6236 cm +1 0 0 1 62.69291 530.6236 cm q q 1 0 0 1 0 0 cm @@ -6832,25 +6848,25 @@ Q Q Q q -1 0 0 1 62.69291 498.6236 cm +1 0 0 1 62.69291 486.6236 cm q BT 1 0 0 1 0 26 Tm .952485 Tw 12 TL /F1 10 Tf 0 0 0 rg (The examples here should have made clear that ) Tj /F4 10 Tf (plac is able to figure out the command-line arguments) Tj T* 0 Tw .899988 Tw (parser to use from the signature of the main function) Tj /F1 10 Tf (. This is the whole idea behind ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (: if the intent is) Tj T* 0 Tw (clear, let's the machine take care of the details.) Tj T* ET Q Q q -1 0 0 1 62.69291 456.6236 cm +1 0 0 1 62.69291 444.6236 cm q -BT 1 0 0 1 0 26 Tm 3.036235 Tw 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is inspired to an old Python Cookbook recipe \() Tj 0 0 .501961 rg (optionparse) Tj 0 0 0 rg (\), in the sense that it delivers the) Tj T* 0 Tw .847209 Tw (programmer from the burden of writing the parser, but is less of a hack: instead of extracting the parser) Tj T* 0 Tw (from the docstring of the module, it extracts it from the signature of the ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (function.) Tj T* ET +BT 1 0 0 1 0 26 Tm .722765 Tw 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is inspired to an old Python Cookbook recipe of mine \() Tj 0 0 .501961 rg (optionparse) Tj 0 0 0 rg (\), in the sense that it delivers the) Tj T* 0 Tw .847209 Tw (programmer from the burden of writing the parser, but is less of a hack: instead of extracting the parser) Tj T* 0 Tw (from the docstring of the module, it extracts it from the signature of the ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (function.) Tj T* ET Q Q q -1 0 0 1 62.69291 426.6236 cm +1 0 0 1 62.69291 414.6236 cm q BT 1 0 0 1 0 14 Tm .319987 Tw 12 TL /F1 10 Tf 0 0 0 rg (The idea comes from the ) Tj /F4 10 Tf (function annotations ) Tj /F1 10 Tf (concept, a new feature of Python 3. An example is worth a) Tj T* 0 Tw (thousand words, so here it is:) Tj T* ET Q Q q -1 0 0 1 62.69291 273.4236 cm +1 0 0 1 62.69291 261.4236 cm q q 1 0 0 1 0 0 cm @@ -6871,7 +6887,7 @@ Q Q Q q -1 0 0 1 62.69291 241.4236 cm +1 0 0 1 62.69291 229.4236 cm q BT 1 0 0 1 0 14 Tm .17528 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here the arguments of the ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (function have been annotated with strings which are intented to be used) Tj T* 0 Tw (in the help message:) Tj T* ET Q @@ -6887,11 +6903,11 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 132 re B* +n -6 -6 468.6898 120 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 110 Tm /F3 10 Tf 12 TL (usage: example7_.py [-h] dsn [scripts [scripts ...]]) Tj T* T* (Run the given scripts on the database) Tj T* T* (positional arguments:) Tj T* ( dsn Database dsn) Tj T* ( scripts SQL scripts) Tj T* T* (optional arguments:) Tj T* ( -h, --help show this help message and exit) Tj T* ET +BT 1 0 0 1 0 98 Tm /F3 10 Tf 12 TL (usage: example7_.py [-h] dsn [scripts [scripts ...]]) Tj T* T* (Run the given scripts on the database) Tj T* T* (positional arguments:) Tj T* ( dsn Database dsn) Tj T* ( scripts SQL scripts) Tj T* T* (optional arguments:) Tj T* ET Q Q Q @@ -6907,32 +6923,53 @@ Q endstream endobj -% 'R352': class PDFStream -352 0 obj +% 'R353': class PDFStream +353 0 obj % page stream -<< /Length 4986 >> +<< /Length 5179 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 753.0236 cm +1 0 0 1 62.69291 739.8236 cm +q +q +1 0 0 1 0 0 cm +q +1 0 0 1 6.6 6.6 cm +q +.662745 .662745 .662745 RG +.5 w +.960784 .960784 .862745 rg +n -6 -6 468.6898 24 re B* +Q +q +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F3 10 Tf 12 TL ( -h, --help show this help message and exit) Tj T* ET +Q +Q +Q +Q +Q +q +1 0 0 1 62.69291 719.8236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is able to recognize much more complex annotations, as I will show in the next paragraphs.) Tj T* ET Q Q q -1 0 0 1 62.69291 723.0236 cm +1 0 0 1 62.69291 689.8236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Scripts with options \(and smart options\)) Tj T* ET Q Q q -1 0 0 1 62.69291 633.0236 cm +1 0 0 1 62.69291 599.8236 cm q BT 1 0 0 1 0 74 Tm .016457 Tw 12 TL /F1 10 Tf 0 0 0 rg (It is surprising how few command-line scripts with options I have written over the years \(probably less than) Tj T* 0 Tw 1.02311 Tw (a hundred\), compared to the number of scripts with positional arguments I wrote \(certainly more than a) Tj T* 0 Tw .177045 Tw (thousand of them\). Still, this use case cannot be neglected. The standard library modules \(all of them\) are) Tj T* 0 Tw 2.30686 Tw (quite verbose when it comes to specifying the options and frankly I have never used them directly.) Tj T* 0 Tw 2.557126 Tw (Instead, I have always relied on the ) Tj 0 0 .501961 rg (optionparse ) Tj 0 0 0 rg (recipe, which provides a convenient wrapper over) Tj T* 0 Tw 1.09061 Tw 0 0 .501961 rg (optionparse) Tj 0 0 0 rg (. Alternatively, in the simplest cases, I have just performed the parsing by hand. In ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (the) Tj T* 0 Tw (parser is inferred by the function annotations. Here is an example:) Tj T* ET Q Q q -1 0 0 1 62.69291 515.8236 cm +1 0 0 1 62.69291 482.6236 cm q q 1 0 0 1 0 0 cm @@ -6953,13 +6990,13 @@ Q Q Q q -1 0 0 1 62.69291 459.8236 cm +1 0 0 1 62.69291 426.6236 cm q BT 1 0 0 1 0 38 Tm .929213 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here the argument ) Tj /F3 10 Tf (command ) Tj /F1 10 Tf (has been annotated with the tuple ) Tj /F3 10 Tf (\("SQL query", 'option', 'c'\)) Tj /F1 10 Tf (:) Tj T* 0 Tw .62683 Tw (the first string is the help string which will appear in the usage message, the second string tells ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (that) Tj T* 0 Tw .931894 Tw /F3 10 Tf (command ) Tj /F1 10 Tf (is an option and the third string that there is also a short form of the option ) Tj /F3 10 Tf (-c) Tj /F1 10 Tf (, the long form) Tj T* 0 Tw (being ) Tj /F3 10 Tf (--command) Tj /F1 10 Tf (. The usage message is the following:) Tj T* ET Q Q q -1 0 0 1 62.69291 330.6236 cm +1 0 0 1 62.69291 297.4236 cm q q 1 0 0 1 0 0 cm @@ -6980,14 +7017,14 @@ Q Q Q q -1 0 0 1 62.69291 310.6236 cm +1 0 0 1 62.69291 277.4236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here are two examples of usage:) Tj T* ET Q Q q -1 0 0 1 62.69291 229.4236 cm +1 0 0 1 62.69291 196.2236 cm q q 1 0 0 1 0 0 cm @@ -7008,13 +7045,13 @@ Q Q Q q -1 0 0 1 62.69291 173.4236 cm +1 0 0 1 62.69291 140.2236 cm q BT 1 0 0 1 0 38 Tm .268935 Tw 12 TL /F1 10 Tf 0 0 0 rg (The third argument in the function annotation can be omitted: in such case it will be assumed to be ) Tj /F3 10 Tf (None) Tj /F1 10 Tf (.) Tj T* 0 Tw 2.839213 Tw (The consequence is that the usual dichotomy between long and short options \(GNU-style options\)) Tj T* 0 Tw .396235 Tw (disappears: we get ) Tj /F4 10 Tf (smart options) Tj /F1 10 Tf (, which have the single character prefix of short options and behave like) Tj T* 0 Tw (both long and short options, since they can be abbreviated. Here is an example featuring smart options:) Tj T* ET Q Q q -1 0 0 1 62.69291 92.22362 cm +1 0 0 1 62.69291 95.02362 cm q q 1 0 0 1 0 0 cm @@ -7024,11 +7061,11 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 72 re B* +n -6 -6 468.6898 36 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 50 Tm /F3 10 Tf 12 TL (# example6.py) Tj T* (def main\(dsn, command: \("SQL query", 'option'\)\):) Tj T* ( print\('executing %r on %s' % \(command, dsn\)\)) Tj T* T* (if __name__ == '__main__':) Tj T* ET +BT 1 0 0 1 0 14 Tm /F3 10 Tf 12 TL (# example6.py) Tj T* (def main\(dsn, command: \("SQL query", 'option'\)\):) Tj T* ET Q Q Q @@ -7044,14 +7081,14 @@ Q endstream endobj -% 'R353': class PDFStream -353 0 obj +% 'R354': class PDFStream +354 0 obj % page stream -<< /Length 4279 >> +<< /Length 4058 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 739.8236 cm +1 0 0 1 62.69291 703.8236 cm q q 1 0 0 1 0 0 cm @@ -7061,18 +7098,18 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 24 re B* +n -6 -6 468.6898 60 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 2 Tm /F3 10 Tf 12 TL ( import plac; plac.call\(main\)) Tj T* ET +BT 1 0 0 1 0 38 Tm /F3 10 Tf 12 TL ( print\('executing %r on %s' % \(command, dsn\)\)) Tj T* T* (if __name__ == '__main__':) Tj T* ( import plac; plac.call\(main\)) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 622.6236 cm +1 0 0 1 62.69291 586.6236 cm q q 1 0 0 1 0 0 cm @@ -7093,14 +7130,14 @@ Q Q Q q -1 0 0 1 62.69291 602.6236 cm +1 0 0 1 62.69291 566.6236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (The following are all valid invocations ot the script:) Tj T* ET Q Q q -1 0 0 1 62.69291 509.4236 cm +1 0 0 1 62.69291 473.4236 cm q q 1 0 0 1 0 0 cm @@ -7121,13 +7158,13 @@ Q Q Q q -1 0 0 1 62.69291 489.4236 cm +1 0 0 1 62.69291 453.4236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (Notice that the form ) Tj /F3 10 Tf (-command=SQL ) Tj /F1 10 Tf (is recognized only for the full option, not for its abbreviations:) Tj T* ET Q Q q -1 0 0 1 62.69291 432.2236 cm +1 0 0 1 62.69291 396.2236 cm q q 1 0 0 1 0 0 cm @@ -7148,13 +7185,13 @@ Q Q Q q -1 0 0 1 62.69291 400.2236 cm +1 0 0 1 62.69291 364.2236 cm q BT 1 0 0 1 0 14 Tm 1.724987 Tw 12 TL /F1 10 Tf 0 0 0 rg (If the option is not passed, the variable ) Tj /F3 10 Tf (command ) Tj /F1 10 Tf (will get the value ) Tj /F3 10 Tf (None) Tj /F1 10 Tf (. However, it is possible to) Tj T* 0 Tw (specify a non-trivial default. Here is an example:) Tj T* ET Q Q q -1 0 0 1 62.69291 307.0236 cm +1 0 0 1 62.69291 271.0236 cm q q 1 0 0 1 0 0 cm @@ -7175,14 +7212,14 @@ Q Q Q q -1 0 0 1 62.69291 287.0236 cm +1 0 0 1 62.69291 251.0236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Notice that the default value appears in the help message:) Tj T* ET Q Q q -1 0 0 1 62.69291 157.8236 cm +1 0 0 1 62.69291 121.8236 cm q q 1 0 0 1 0 0 cm @@ -7203,13 +7240,29 @@ Q Q Q q -1 0 0 1 62.69291 137.8236 cm +1 0 0 1 62.69291 101.8236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (When you run the script and you do not pass the ) Tj /F3 10 Tf (-command ) Tj /F1 10 Tf (option, the default query will be executed:) Tj T* ET Q Q q -1 0 0 1 62.69291 92.62362 cm +1 0 0 1 56.69291 56.69291 cm +q +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 238.1649 0 Td (8) Tj T* -238.1649 0 Td ET +Q +Q + +endstream +endobj +% 'R355': class PDFStream +355 0 obj +% page stream +<< /Length 4742 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET +q +1 0 0 1 62.69291 727.8236 cm q q 1 0 0 1 0 0 cm @@ -7230,35 +7283,19 @@ Q Q Q q -1 0 0 1 56.69291 56.69291 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 238.1649 0 Td (8) Tj T* -238.1649 0 Td ET -Q -Q - -endstream -endobj -% 'R354': class PDFStream -354 0 obj -% page stream -<< /Length 4877 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET -q -1 0 0 1 62.69291 747.0236 cm +1 0 0 1 62.69291 697.8236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Scripts with flags) Tj T* ET Q Q q -1 0 0 1 62.69291 717.0236 cm +1 0 0 1 62.69291 667.8236 cm q BT 1 0 0 1 0 14 Tm .815542 Tw 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is able to recognize flags, i.e. boolean options which are ) Tj /F3 10 Tf (True ) Tj /F1 10 Tf (if they are passed to the command) Tj T* 0 Tw (line and ) Tj /F3 10 Tf (False ) Tj /F1 10 Tf (if they are absent. Here is an example:) Tj T* ET Q Q q -1 0 0 1 62.69291 592.1299 cm +1 0 0 1 62.69291 542.9299 cm q q .96447 0 0 .96447 0 0 cm @@ -7279,7 +7316,7 @@ Q Q Q q -1 0 0 1 62.69291 474.9299 cm +1 0 0 1 62.69291 425.7299 cm q q 1 0 0 1 0 0 cm @@ -7300,7 +7337,7 @@ Q Q Q q -1 0 0 1 62.69291 429.7299 cm +1 0 0 1 62.69291 380.5299 cm q q 1 0 0 1 0 0 cm @@ -7321,37 +7358,53 @@ Q Q Q q -1 0 0 1 62.69291 385.7299 cm +1 0 0 1 62.69291 336.5299 cm q BT 1 0 0 1 0 26 Tm .31408 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that it is an error trying to specify a default for flags: the default value for a flag is always ) Tj /F3 10 Tf (False) Tj /F1 10 Tf (. If) Tj T* 0 Tw 2.652485 Tw (you feel the need to implement non-boolean flags, you should use an option with two choices, as) Tj T* 0 Tw (explained in the "more features" section.) Tj T* ET Q Q q -1 0 0 1 62.69291 319.7299 cm +1 0 0 1 62.69291 270.5299 cm q BT 1 0 0 1 0 50 Tm 5.832651 Tw 12 TL /F1 10 Tf 0 0 0 rg (For consistency with the way the usage message is printed, I suggest you to follow the) Tj T* 0 Tw 1.895433 Tw (Flag-Option-Required-Default \(FORD\) convention: in the ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (function write first the flag arguments,) Tj T* 0 Tw .881235 Tw (then the option arguments, then the required arguments and finally the default arguments. This is just a) Tj T* 0 Tw .110574 Tw (convention and you are not forced to use it, except for the default arguments \(including the varargs\) which) Tj T* 0 Tw (must stay at the end as it is required by the Python syntax.) Tj T* ET Q Q q -1 0 0 1 62.69291 277.7299 cm +1 0 0 1 62.69291 228.5299 cm q BT 1 0 0 1 0 26 Tm .897045 Tw 12 TL /F1 10 Tf 0 0 0 rg (I also suggests to specify a one-character abbreviation for flags: in this way you can use the GNU-style) Tj T* 0 Tw 2.034431 Tw (composition of flags \(i.e. ) Tj /F3 10 Tf (-zxvf ) Tj /F1 10 Tf (is an abbreviation of ) Tj /F3 10 Tf (-z -x -v -f) Tj /F1 10 Tf (\). I usually do not provide the) Tj T* 0 Tw (one-character abbreviation for options, since it does not make sense to compose them.) Tj T* ET Q Q q -1 0 0 1 62.69291 247.7299 cm +1 0 0 1 62.69291 198.5299 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (plac for Python 2.X users) Tj T* ET Q Q q -1 0 0 1 62.69291 181.7299 cm +1 0 0 1 62.69291 132.5299 cm q BT 1 0 0 1 0 50 Tm .211807 Tw 12 TL /F1 10 Tf 0 0 0 rg (I do not use Python 3. At work we are just starting to think about migrating to Python 2.6. It will take years) Tj T* 0 Tw .304724 Tw (before we think to migrate to Python 3. I am pretty much sure most Pythonistas are in the same situation.) Tj T* 0 Tw 1.459984 Tw (Therefore ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (provides a way to work with function annotations even in Python 2.X \(including Python) Tj T* 0 Tw 2.692339 Tw (2.3\). There is no magic involved; you just need to add the annotations by hand. For instance the) Tj T* 0 Tw (annotated function declaration) Tj T* ET Q Q q -1 0 0 1 62.69291 136.5299 cm +1 0 0 1 56.69291 56.69291 cm +q +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 238.1649 0 Td (9) Tj T* -238.1649 0 Td ET +Q +Q + +endstream +endobj +% 'R356': class PDFStream +356 0 obj +% page stream +<< /Length 6254 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET +q +1 0 0 1 62.69291 727.8236 cm q q 1 0 0 1 0 0 cm @@ -7372,30 +7425,14 @@ Q Q Q q -1 0 0 1 62.69291 116.5299 cm +1 0 0 1 62.69291 707.8236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (is equivalent to the following code:) Tj T* ET Q Q q -1 0 0 1 56.69291 56.69291 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 238.1649 0 Td (9) Tj T* -238.1649 0 Td ET -Q -Q - -endstream -endobj -% 'R355': class PDFStream -355 0 obj -% page stream -<< /Length 6131 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET -q -1 0 0 1 62.69291 691.8236 cm +1 0 0 1 62.69291 626.6236 cm q q 1 0 0 1 0 0 cm @@ -7416,13 +7453,13 @@ Q Q Q q -1 0 0 1 62.69291 647.8236 cm +1 0 0 1 62.69291 582.6236 cm q BT 1 0 0 1 0 26 Tm .536098 Tw 12 TL /F1 10 Tf 0 0 0 rg (One should be careful to match the keys of the annotation dictionary with the names of the arguments in) Tj T* 0 Tw 3.347485 Tw (the annotated function; for lazy people with Python 2.4 available the simplest way is to use the) Tj T* 0 Tw /F3 10 Tf (plac.annotations ) Tj /F1 10 Tf (decorator that performs the check for you:) Tj T* ET Q Q q -1 0 0 1 62.69291 566.6236 cm +1 0 0 1 62.69291 501.4236 cm q q 1 0 0 1 0 0 cm @@ -7443,28 +7480,28 @@ Q Q Q q -1 0 0 1 62.69291 534.6236 cm +1 0 0 1 62.69291 469.4236 cm q BT 1 0 0 1 0 14 Tm 1.846077 Tw 12 TL /F1 10 Tf 0 0 0 rg (In the rest of this article I will assume that you are using Python 2.X with X >) Tj (= 4 and I will use the) Tj T* 0 Tw /F3 10 Tf (plac.annotations ) Tj /F1 10 Tf (decorator. Notice however that the core features of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (run even on Python 2.3.) Tj T* ET Q Q q -1 0 0 1 62.69291 504.6236 cm +1 0 0 1 62.69291 439.4236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (More features) Tj T* ET Q Q q -1 0 0 1 62.69291 450.6236 cm +1 0 0 1 62.69291 385.4236 cm q BT 1 0 0 1 0 38 Tm 1.483488 Tw 12 TL /F1 10 Tf 0 0 0 rg (One of the goals of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is to have a learning curve of ) Tj /F4 10 Tf (minutes ) Tj /F1 10 Tf (for its core features, compared to the) Tj T* 0 Tw 1.152093 Tw (learning curve of ) Tj /F4 10 Tf (hours ) Tj /F1 10 Tf (of ) Tj 0 0 .501961 rg (argparse) Tj 0 0 0 rg (. In order to reach this goal, I have ) Tj /F4 10 Tf (not ) Tj /F1 10 Tf (sacrificed all the features of) Tj T* 0 Tw 2.89936 Tw 0 0 .501961 rg (argparse) Tj 0 0 0 rg (. Actually a lot of ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (power persists in ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (. Until now, I have only showed simple) Tj T* 0 Tw (annotations, but in general an annotation is a 6-tuple of the form) Tj T* ET Q Q q -1 0 0 1 62.69291 444.6236 cm +1 0 0 1 62.69291 379.4236 cm Q q -1 0 0 1 62.69291 432.6236 cm +1 0 0 1 62.69291 367.4236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET BT 1 0 0 1 0 2 Tm T* ET @@ -7479,54 +7516,54 @@ q Q Q q -1 0 0 1 62.69291 432.6236 cm +1 0 0 1 62.69291 367.4236 cm Q q -1 0 0 1 62.69291 390.6236 cm +1 0 0 1 62.69291 325.4236 cm q BT 1 0 0 1 0 26 Tm 1.068735 Tw 12 TL /F1 10 Tf 0 0 0 rg (where ) Tj /F3 10 Tf (help ) Tj /F1 10 Tf (is the help message, ) Tj /F3 10 Tf (kind ) Tj /F1 10 Tf (is a string in the set { ) Tj /F3 10 Tf ("flag") Tj /F1 10 Tf (, ) Tj /F3 10 Tf ("option") Tj /F1 10 Tf (, ) Tj /F3 10 Tf ("positional") Tj /F1 10 Tf (},) Tj T* 0 Tw 1.579431 Tw /F3 10 Tf (abbrev ) Tj /F1 10 Tf (is a one-character string or ) Tj /F3 10 Tf (None) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (type ) Tj /F1 10 Tf (is a callable taking a string in input, ) Tj /F3 10 Tf (choices ) Tj /F1 10 Tf (is a) Tj T* 0 Tw (discrete sequence of values and ) Tj /F3 10 Tf (metavar ) Tj /F1 10 Tf (is a string.) Tj T* ET Q Q q -1 0 0 1 62.69291 360.6236 cm +1 0 0 1 62.69291 295.4236 cm q BT 1 0 0 1 0 14 Tm 1.05061 Tw 12 TL /F3 10 Tf 0 0 0 rg (type ) Tj /F1 10 Tf (is used to automagically convert the command line arguments from the string type to any Python) Tj T* 0 Tw (type; by default there is no conversion and ) Tj /F3 10 Tf (type=None) Tj /F1 10 Tf (.) Tj T* ET Q Q q -1 0 0 1 62.69291 330.6236 cm +1 0 0 1 62.69291 265.4236 cm q BT 1 0 0 1 0 14 Tm 2.904692 Tw 12 TL /F3 10 Tf 0 0 0 rg (choices ) Tj /F1 10 Tf (is used to restrict the number of the valid options; by default there is no restriction i.e.) Tj T* 0 Tw /F3 10 Tf (choices=None) Tj /F1 10 Tf (.) Tj T* ET Q Q q -1 0 0 1 62.69291 252.6236 cm +1 0 0 1 62.69291 187.4236 cm q BT 1 0 0 1 0 62 Tm 1.171163 Tw 12 TL /F3 10 Tf 0 0 0 rg (metavar ) Tj /F1 10 Tf (has two meanings. For a positional argument it is used to change the argument name in the) Tj T* 0 Tw .352209 Tw (usage message \(and only there\). By default the metavar is ) Tj /F3 10 Tf (None ) Tj /F1 10 Tf (and the name in the usage message is) Tj T* 0 Tw .752339 Tw (the same as the argument name. For an option the ) Tj /F3 10 Tf (metavar ) Tj /F1 10 Tf (is used differently in the usage message,) Tj T* 0 Tw .802927 Tw (which has now the form ) Tj /F3 10 Tf ([--option-name METAVAR]) Tj /F1 10 Tf (. If the ) Tj /F3 10 Tf (metavar ) Tj /F1 10 Tf (is ) Tj /F3 10 Tf (None) Tj /F1 10 Tf (, then it is equal to the) Tj T* 0 Tw .50683 Tw (uppercased name of the argument, unless the argument has a default and in such a case is equal to the) Tj T* 0 Tw (stringified form of the default.) Tj T* ET Q Q q -1 0 0 1 62.69291 234.6236 cm +1 0 0 1 62.69291 169.4236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (Here is an example showing many of the features \(copied from the ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (documentation\):) Tj T* ET Q Q q -1 0 0 1 62.69291 96.55439 cm +1 0 0 1 62.69291 100.2236 cm q q -.976496 0 0 .976496 0 0 cm +1 0 0 1 0 0 cm q -1 0 0 1 6.6 6.758862 cm +1 0 0 1 6.6 6.6 cm q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 480 132 re B* +n -6 -6 468.6898 60 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 110 Tm /F3 10 Tf 12 TL (# example10.py) Tj T* (import plac) Tj T* T* (@plac.annotations\() Tj T* (operator=\("The name of an operator", 'positional', None, str, ['add', 'mul']\),) Tj T* (numbers=\("A number", 'positional', None, float, None, "n"\)\)) Tj T* (def main\(operator, *numbers\):) Tj T* ( "A script to add and multiply numbers") Tj T* ( if operator == 'mul':) Tj T* ( op = float.__mul__) Tj T* ET +BT 1 0 0 1 0 38 Tm /F3 10 Tf 12 TL (# example10.py) Tj T* (import plac) Tj T* T* (@plac.annotations\() Tj T* ET Q Q Q @@ -7542,42 +7579,42 @@ Q endstream endobj -% 'R356': class PDFStream -356 0 obj +% 'R357': class PDFStream +357 0 obj % page stream -<< /Length 4220 >> +<< /Length 3696 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 631.8236 cm +1 0 0 1 62.69291 564.6467 cm q q -1 0 0 1 0 0 cm +.976496 0 0 .976496 0 0 cm q -1 0 0 1 6.6 6.6 cm +1 0 0 1 6.6 6.758862 cm q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 132 re B* +n -6 -6 480 204 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 110 Tm /F3 10 Tf 12 TL ( result = 1.0) Tj T* ( else: # operator == 'add') Tj T* ( op = float.__add__) Tj T* ( result = 0.0) Tj T* ( for n in numbers:) Tj T* ( result = op\(result, n\)) Tj T* ( return result) Tj T* T* (if __name__ == '__main__':) Tj T* ( print\(plac.call\(main\)\)) Tj T* ET +BT 1 0 0 1 0 182 Tm /F3 10 Tf 12 TL (operator=\("The name of an operator", 'positional', None, str, ['add', 'mul']\),) Tj T* (numbers=\("A number", 'positional', None, float, None, "n"\)\)) Tj T* (def main\(operator, *numbers\):) Tj T* ( "A script to add and multiply numbers") Tj T* ( if operator == 'mul':) Tj T* ( op = float.__mul__) Tj T* ( result = 1.0) Tj T* ( else: # operator == 'add') Tj T* ( op = float.__add__) Tj T* ( result = 0.0) Tj T* ( for n in numbers:) Tj T* ( result = op\(result, n\)) Tj T* ( return result) Tj T* T* (if __name__ == '__main__':) Tj T* ( print\(plac.call\(main\)\)) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 611.8236 cm +1 0 0 1 62.69291 544.6467 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is the usage:) Tj T* ET Q Q q -1 0 0 1 62.69291 470.6236 cm +1 0 0 1 62.69291 403.4467 cm q q 1 0 0 1 0 0 cm @@ -7598,13 +7635,13 @@ Q Q Q q -1 0 0 1 62.69291 438.6236 cm +1 0 0 1 62.69291 371.4467 cm q BT 1 0 0 1 0 14 Tm .15186 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that the docstring of the ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (function has been automatically added to the usage message. Here) Tj T* 0 Tw (are a couple of examples of use:) Tj T* ET Q Q q -1 0 0 1 62.69291 345.2849 cm +1 0 0 1 62.69291 278.108 cm q q .87797 0 0 .87797 0 0 cm @@ -7625,13 +7662,13 @@ Q Q Q q -1 0 0 1 62.69291 325.2849 cm +1 0 0 1 62.69291 258.108 cm q BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (plac.call ) Tj /F1 10 Tf (can also be used in doctests like this:) Tj T* ET Q Q q -1 0 0 1 62.69291 268.0849 cm +1 0 0 1 62.69291 200.908 cm q q 1 0 0 1 0 0 cm @@ -7651,13 +7688,13 @@ Q Q Q q -1 0 0 1 62.69291 248.0849 cm +1 0 0 1 62.69291 180.908 cm q BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (plac.call ) Tj /F1 10 Tf (works for generators too:) Tj T* ET Q Q q -1 0 0 1 62.69291 166.8849 cm +1 0 0 1 62.69291 99.70797 cm q q 1 0 0 1 0 0 cm @@ -7677,18 +7714,6 @@ Q Q Q q -1 0 0 1 62.69291 122.8849 cm -q -BT 1 0 0 1 0 26 Tm .158409 Tw 12 TL /F1 10 Tf 0 0 0 rg (Internally ) Tj /F3 10 Tf (plac.call ) Tj /F1 10 Tf (tries to convert the output of the main function into a list, if possible. If the output is) Tj T* 0 Tw .725703 Tw (not iterable or it is a string, it is left unchanged, but if it is iterable it is converted. In particular, generator) Tj T* 0 Tw (objects are exhausted by ) Tj /F3 10 Tf (plac.call) Tj /F1 10 Tf (.) Tj T* ET -Q -Q -q -1 0 0 1 62.69291 92.8849 cm -q -BT 1 0 0 1 0 14 Tm 1.450751 Tw 12 TL /F1 10 Tf 0 0 0 rg (This behavior avoids mistakes like forgetting of applying ) Tj /F3 10 Tf (list\(result\) ) Tj /F1 10 Tf (to the result of ) Tj /F3 10 Tf (plac.call) Tj /F1 10 Tf (;) Tj T* 0 Tw (moreover it makes errors visible early, and avoids mistakes in code like the following:) Tj T* ET -Q -Q -q 1 0 0 1 56.69291 56.69291 cm q 0 0 0 rg @@ -7698,14 +7723,26 @@ Q endstream endobj -% 'R357': class PDFStream -357 0 obj +% 'R358': class PDFStream +358 0 obj % page stream -<< /Length 4269 >> +<< /Length 4537 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 703.8236 cm +1 0 0 1 62.69291 729.0236 cm +q +BT 1 0 0 1 0 26 Tm .158409 Tw 12 TL /F1 10 Tf 0 0 0 rg (Internally ) Tj /F3 10 Tf (plac.call ) Tj /F1 10 Tf (tries to convert the output of the main function into a list, if possible. If the output is) Tj T* 0 Tw .725703 Tw (not iterable or it is a string, it is left unchanged, but if it is iterable it is converted. In particular, generator) Tj T* 0 Tw (objects are exhausted by ) Tj /F3 10 Tf (plac.call) Tj /F1 10 Tf (.) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 699.0236 cm +q +BT 1 0 0 1 0 14 Tm 1.450751 Tw 12 TL /F1 10 Tf 0 0 0 rg (This behavior avoids mistakes like forgetting of applying ) Tj /F3 10 Tf (list\(result\) ) Tj /F1 10 Tf (to the result of ) Tj /F3 10 Tf (plac.call) Tj /F1 10 Tf (;) Tj T* 0 Tw (moreover it makes errors visible early, and avoids mistakes in code like the following:) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 629.8236 cm q q 1 0 0 1 0 0 cm @@ -7726,20 +7763,20 @@ Q Q Q q -1 0 0 1 62.69291 671.8236 cm +1 0 0 1 62.69291 597.8236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 3.122126 Tw (Without the "listify" functionality, a main function returning a generator object would not raise any) Tj T* 0 Tw (exception until the generator is iterated over.) Tj T* ET Q Q q -1 0 0 1 62.69291 641.8236 cm +1 0 0 1 62.69291 567.8236 cm q BT 1 0 0 1 0 14 Tm .647262 Tw 12 TL /F1 10 Tf 0 0 0 rg (If you are a fan of lazyness, you can still have it by setting the ) Tj /F3 10 Tf (eager ) Tj /F1 10 Tf (flag to ) Tj /F3 10 Tf (False) Tj /F1 10 Tf (, as in the following) Tj T* 0 Tw (example:) Tj T* ET Q Q q -1 0 0 1 62.69291 596.6236 cm +1 0 0 1 62.69291 522.6236 cm q q 1 0 0 1 0 0 cm @@ -7760,25 +7797,25 @@ Q Q Q q -1 0 0 1 62.69291 564.6236 cm +1 0 0 1 62.69291 490.6236 cm q BT 1 0 0 1 0 14 Tm 1.35528 Tw 12 TL /F1 10 Tf 0 0 0 rg (If ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (returns a generator object this example will print each line as soon as available, whereas the) Tj T* 0 Tw (default behaviour is to print all the lines together and the end of the computation.) Tj T* ET Q Q q -1 0 0 1 62.69291 534.6236 cm +1 0 0 1 62.69291 460.6236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (A realistic example) Tj T* ET Q Q q -1 0 0 1 62.69291 492.6236 cm +1 0 0 1 62.69291 418.6236 cm q BT 1 0 0 1 0 26 Tm 1.234488 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here is a more realistic script using most of the features of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (to run SQL queries on a database by) Tj T* 0 Tw .930697 Tw (relying on ) Tj 0 0 .501961 rg (SQLAlchemy) Tj 0 0 0 rg (. Notice the usage of the ) Tj /F3 10 Tf (type ) Tj /F1 10 Tf (feature to automagically convert a SQLAlchemy) Tj T* 0 Tw (connection string into a ) Tj 0 0 .501961 rg (SqlSoup ) Tj 0 0 0 rg (object:) Tj T* ET Q Q q -1 0 0 1 62.69291 123.4236 cm +1 0 0 1 62.69291 97.42362 cm q q 1 0 0 1 0 0 cm @@ -7788,23 +7825,17 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 360 re B* +n -6 -6 468.6898 312 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 338 Tm /F3 10 Tf 12 TL (# dbcli.py) Tj T* (import plac) Tj T* (from sqlalchemy.ext.sqlsoup import SqlSoup) Tj T* T* (@plac.annotations\() Tj T* ( db=\("Connection string", 'positional', None, SqlSoup\),) Tj T* ( header=\("Header", 'flag', 'H'\),) Tj T* ( sqlcmd=\("SQL command", 'option', 'c', str, None, "SQL"\),) Tj T* ( delimiter=\("Column separator", 'option', 'd'\),) Tj T* ( scripts="SQL scripts",) Tj T* ( \)) Tj T* (def main\(db, header, sqlcmd, delimiter="|", *scripts\):) Tj T* ( "A script to run queries and SQL scripts on a database") Tj T* ( yield 'Working on %s' % db.bind.url) Tj T* T* ( if sqlcmd:) Tj T* ( result = db.bind.execute\(sqlcmd\)) Tj T* ( if header: # print the header) Tj T* ( yield delimiter.join\(result.keys\(\)\)) Tj T* ( for row in result: # print the rows) Tj T* ( yield delimiter.join\(map\(str, row\)\)) Tj T* T* ( for script in scripts:) Tj T* ( db.bind.execute\(file\(script\).read\(\)\)) Tj T* ( yield 'executed %s' % script) Tj T* T* (if __name__ == '__main__':) Tj T* ( for output in plac.call\(main\):) Tj T* ( print\(output\)) Tj T* ET +BT 1 0 0 1 0 290 Tm /F3 10 Tf 12 TL (# dbcli.py) Tj T* (import plac) Tj T* (from sqlalchemy.ext.sqlsoup import SqlSoup) Tj T* T* (@plac.annotations\() Tj T* ( db=\("Connection string", 'positional', None, SqlSoup\),) Tj T* ( header=\("Header", 'flag', 'H'\),) Tj T* ( sqlcmd=\("SQL command", 'option', 'c', str, None, "SQL"\),) Tj T* ( delimiter=\("Column separator", 'option', 'd'\),) Tj T* ( scripts="SQL scripts",) Tj T* ( \)) Tj T* (def main\(db, header, sqlcmd, delimiter="|", *scripts\):) Tj T* ( "A script to run queries and SQL scripts on a database") Tj T* ( yield 'Working on %s' % db.bind.url) Tj T* T* ( if sqlcmd:) Tj T* ( result = db.bind.execute\(sqlcmd\)) Tj T* ( if header: # print the header) Tj T* ( yield delimiter.join\(result.keys\(\)\)) Tj T* ( for row in result: # print the rows) Tj T* ( yield delimiter.join\(map\(str, row\)\)) Tj T* T* ( for script in scripts:) Tj T* ( db.bind.execute\(file\(script\).read\(\)\)) Tj T* ( yield 'executed %s' % script) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 91.42362 cm -q -BT 1 0 0 1 0 14 Tm .049987 Tw 12 TL /F1 10 Tf 0 0 0 rg (You can see the ) Tj /F4 10 Tf (yield-is-print ) Tj /F1 10 Tf (pattern here: instead of using ) Tj /F3 10 Tf (print ) Tj /F1 10 Tf (in the main function, I use ) Tj /F3 10 Tf (yield) Tj /F1 10 Tf (, and ) Tj T* 0 Tw 3.55061 Tw (I perform the print in the ) Tj /F3 10 Tf (__main__ ) Tj /F1 10 Tf (block. The advantage of the pattern is that tests invoking) Tj T* 0 Tw ET -Q -Q -q 1 0 0 1 56.69291 56.69291 cm q 0 0 0 rg @@ -7814,27 +7845,48 @@ Q endstream endobj -% 'R358': class PDFStream -358 0 obj +% 'R359': class PDFStream +359 0 obj % page stream -<< /Length 3533 >> +<< /Length 3815 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 741.0236 cm +1 0 0 1 62.69291 703.8236 cm +q +q +1 0 0 1 0 0 cm +q +1 0 0 1 6.6 6.6 cm +q +.662745 .662745 .662745 RG +.5 w +.960784 .960784 .862745 rg +n -6 -6 468.6898 60 re B* +Q +q +0 0 0 rg +BT 1 0 0 1 0 38 Tm /F3 10 Tf 12 TL T* (if __name__ == '__main__':) Tj T* ( for output in plac.call\(main\):) Tj T* ( print\(output\)) Tj T* ET +Q +Q +Q +Q +Q +q +1 0 0 1 62.69291 647.8236 cm q -BT 1 0 0 1 0 14 Tm .52936 Tw 12 TL /F3 10 Tf 0 0 0 rg (plac.call ) Tj /F1 10 Tf (and checking the result become trivial: had I performed the printing in the main function, the) Tj T* 0 Tw (test would have involved an ugly hack like redirecting ) Tj /F3 10 Tf (sys.stdout ) Tj /F1 10 Tf (to a ) Tj /F3 10 Tf (StringIO ) Tj /F1 10 Tf (object.) Tj T* ET +BT 1 0 0 1 0 38 Tm .049987 Tw 12 TL /F1 10 Tf 0 0 0 rg (You can see the ) Tj /F4 10 Tf (yield-is-print ) Tj /F1 10 Tf (pattern here: instead of using ) Tj /F3 10 Tf (print ) Tj /F1 10 Tf (in the main function, I use ) Tj /F3 10 Tf (yield) Tj /F1 10 Tf (, and) Tj T* 0 Tw 3.55061 Tw (I perform the print in the ) Tj /F3 10 Tf (__main__ ) Tj /F1 10 Tf (block. The advantage of the pattern is that tests invoking) Tj T* 0 Tw .52936 Tw /F3 10 Tf (plac.call ) Tj /F1 10 Tf (and checking the result become trivial: had I performed the printing in the main function, the) Tj T* 0 Tw (test would have involved an ugly hack like redirecting ) Tj /F3 10 Tf (sys.stdout ) Tj /F1 10 Tf (to a ) Tj /F3 10 Tf (StringIO ) Tj /F1 10 Tf (object.) Tj T* ET Q Q q -1 0 0 1 62.69291 723.0236 cm +1 0 0 1 62.69291 629.8236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is the usage message:) Tj T* ET Q Q q -1 0 0 1 62.69291 545.8236 cm +1 0 0 1 62.69291 452.6236 cm q q 1 0 0 1 0 0 cm @@ -7855,26 +7907,26 @@ Q Q Q q -1 0 0 1 62.69291 525.8236 cm +1 0 0 1 62.69291 432.6236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (You can check for yourself that the script works.) Tj T* ET Q Q q -1 0 0 1 62.69291 495.8236 cm +1 0 0 1 62.69291 402.6236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Keyword arguments) Tj T* ET Q Q q -1 0 0 1 62.69291 453.8236 cm +1 0 0 1 62.69291 360.6236 cm q BT 1 0 0 1 0 26 Tm 1.831984 Tw 12 TL /F1 10 Tf 0 0 0 rg (Starting from release 0.4, ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (supports keyword arguments. In practice that means that if your main) Tj T* 0 Tw 2.099213 Tw (function has keyword arguments, ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (treats specially arguments of the form ) Tj /F3 10 Tf ("name=value" ) Tj /F1 10 Tf (in the) Tj T* 0 Tw (command line. Here is an example:) Tj T* ET Q Q q -1 0 0 1 62.69291 216.6236 cm +1 0 0 1 62.69291 123.4236 cm q q 1 0 0 1 0 0 cm @@ -7895,34 +7947,13 @@ Q Q Q q -1 0 0 1 62.69291 196.6236 cm +1 0 0 1 62.69291 103.4236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is the generated usage message:) Tj T* ET Q Q q -1 0 0 1 62.69291 91.42362 cm -q -q -1 0 0 1 0 0 cm -q -1 0 0 1 6.6 6.6 cm -q -.662745 .662745 .662745 RG -.5 w -.960784 .960784 .862745 rg -n -6 -6 468.6898 96 re B* -Q -q -0 0 0 rg -BT 1 0 0 1 0 74 Tm /F3 10 Tf 12 TL (usage: example12.py [-h] [-opt OPT] [args [args ...]] [kw [kw ...]]) Tj T* T* (positional arguments:) Tj T* ( args default arguments) Tj T* ( kw keyword arguments) Tj T* T* (optional arguments:) Tj T* ET -Q -Q -Q -Q -Q -q 1 0 0 1 56.69291 56.69291 cm q 0 0 0 rg @@ -7932,14 +7963,14 @@ Q endstream endobj -% 'R359': class PDFStream -359 0 obj +% 'R360': class PDFStream +360 0 obj % page stream -<< /Length 4268 >> +<< /Length 4073 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 727.8236 cm +1 0 0 1 62.69291 643.8236 cm q q 1 0 0 1 0 0 cm @@ -7949,25 +7980,25 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 36 re B* +n -6 -6 468.6898 120 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 14 Tm /F3 10 Tf 12 TL ( -h, --help show this help message and exit) Tj T* ( -opt OPT some option) Tj T* ET +BT 1 0 0 1 0 98 Tm /F3 10 Tf 12 TL (usage: example12.py [-h] [-opt OPT] [args [args ...]] [kw [kw ...]]) Tj T* T* (positional arguments:) Tj T* ( args default arguments) Tj T* ( kw keyword arguments) Tj T* T* (optional arguments:) Tj T* ( -h, --help show this help message and exit) Tj T* ( -opt OPT some option) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 707.8236 cm +1 0 0 1 62.69291 623.8236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is how you call the script:) Tj T* ET Q Q q -1 0 0 1 62.69291 638.6236 cm +1 0 0 1 62.69291 554.6236 cm q q 1 0 0 1 0 0 cm @@ -7988,13 +8019,13 @@ Q Q Q q -1 0 0 1 62.69291 606.6236 cm +1 0 0 1 62.69291 522.6236 cm q BT 1 0 0 1 0 14 Tm 2.133735 Tw 12 TL /F1 10 Tf 0 0 0 rg (When using keyword arguments, one must be careful to use names which are not alreay taken; for) Tj T* 0 Tw (instance in this examples the name ) Tj /F3 10 Tf (opt ) Tj /F1 10 Tf (is taken:) Tj T* ET Q Q q -1 0 0 1 62.69291 549.4236 cm +1 0 0 1 62.69291 465.4236 cm q q 1 0 0 1 0 0 cm @@ -8015,39 +8046,39 @@ Q Q Q q -1 0 0 1 62.69291 505.4236 cm +1 0 0 1 62.69291 421.4236 cm q 0 0 0 rg BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL 1.024104 Tw (The names taken are the names of the flags, of the options, and of the positional arguments, excepted) Tj T* 0 Tw .60561 Tw (varargs and keywords. This limitation is a consequence of the way the argument names are managed in) Tj T* 0 Tw (function calls by the Python language.) Tj T* ET Q Q q -1 0 0 1 62.69291 475.4236 cm +1 0 0 1 62.69291 391.4236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Final example: a shelve interface) Tj T* ET Q Q q -1 0 0 1 62.69291 433.4236 cm +1 0 0 1 62.69291 349.4236 cm q BT 1 0 0 1 0 26 Tm .603516 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here is a less trivial example for the keyword arguments feature. The use case is the following: suppose) Tj T* 0 Tw .82881 Tw (we have stored the configuration parameters of a given application into a Python shelve and we need a) Tj T* 0 Tw (command-line tool to edit the shelve. A possible implementation using ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (could be the following:) Tj T* ET Q Q q -1 0 0 1 62.69291 115.5936 cm +1 0 0 1 62.69291 105.8928 cm q q -.952737 0 0 .952737 0 0 cm +.976496 0 0 .976496 0 0 cm q -1 0 0 1 6.6 6.927412 cm +1 0 0 1 6.6 6.758862 cm q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 492 324 re B* +n -6 -6 480 240 re B* Q q -BT 1 0 0 1 0 302 Tm 12 TL /F3 10 Tf 0 0 0 rg (# ishelve.py) Tj T* (import os, shelve, plac) Tj T* T* (DEFAULT_SHELVE = os.path.expanduser\('~/conf.shelve'\)) Tj T* T* (@plac.annotations\() Tj T* ( help=\('show help', 'flag'\),) Tj T* ( showall=\('show all parameters in the shelve', 'flag'\),) Tj T* ( clear=\('clear the shelve', 'flag'\),) Tj T* ( delete=\('delete an element', 'option'\),) Tj T* ( filename=\('filename of the shelve', 'option'\),) Tj T* ( params='names of the parameters in the shelve',) Tj T* ( setters='setters param=value'\)) Tj T* (def main\(help, showall, clear, delete, filename=DEFAULT_SHELVE,) Tj T* ( *params, **setters\):) Tj T* ( "A simple interface to a shelve. Use .help to see the available commands.") Tj T* ( sh = shelve.open\(filename\)) Tj T* ( try:) Tj T* ( if not any\([help, showall, clear, delete, params, setters]\):) Tj T* ( yield 'no arguments passed, use .help to see the available commands') Tj T* ( elif help: # custom help) Tj T* ( yield 'Commands: .help, .showall, .clear, .delete') Tj T* ( yield ') Tj (<) Tj (param) Tj (>) Tj ( ...') Tj T* ( yield ') Tj (<) Tj (param=value) Tj (>) Tj ( ...') Tj T* ( elif showall:) Tj T* ( for param, name in sh.items\(\):) Tj T* ET +BT 1 0 0 1 0 218 Tm 12 TL /F3 10 Tf 0 0 0 rg (# ishelve.py) Tj T* (import os, shelve, plac) Tj T* T* (DEFAULT_SHELVE = os.path.expanduser\('~/conf.shelve'\)) Tj T* T* (@plac.annotations\() Tj T* ( help=\('show help', 'flag'\),) Tj T* ( showall=\('show all parameters in the shelve', 'flag'\),) Tj T* ( clear=\('clear the shelve', 'flag'\),) Tj T* ( delete=\('delete an element', 'option'\),) Tj T* ( filename=\('filename of the shelve', 'option'\),) Tj T* ( params='names of the parameters in the shelve',) Tj T* ( setters='setters param=value'\)) Tj T* (def main\(help, showall, clear, delete, filename=DEFAULT_SHELVE,) Tj T* ( *params, **setters\):) Tj T* ( "A simple interface to a shelve. Use .help to see the available commands.") Tj T* ( sh = shelve.open\(filename\)) Tj T* ( try:) Tj T* ( if not any\([help, showall, clear, delete, params, setters]\):) Tj T* ET Q Q Q @@ -8063,47 +8094,47 @@ Q endstream endobj -% 'R360': class PDFStream -360 0 obj +% 'R361': class PDFStream +361 0 obj % page stream -<< /Length 6251 >> +<< /Length 6068 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 415.8236 cm +1 0 0 1 62.69291 352.2981 cm q q -1 0 0 1 0 0 cm +.952737 0 0 .952737 0 0 cm q -1 0 0 1 6.6 6.6 cm +1 0 0 1 6.6 6.927412 cm q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 348 re B* +n -6 -6 492 432 re B* Q q -BT 1 0 0 1 0 326 Tm 12 TL /F3 10 Tf 0 0 0 rg ( yield '%s=%s' % \(param, name\)) Tj T* ( elif clear:) Tj T* ( sh.clear\(\)) Tj T* ( yield 'cleared the shelve') Tj T* ( elif delete:) Tj T* ( try:) Tj T* ( del sh[delete]) Tj T* ( except KeyError:) Tj T* ( yield '%s: not found' % delete) Tj T* ( else:) Tj T* ( yield 'deleted %s' % delete) Tj T* ( for param in params:) Tj T* ( try:) Tj T* ( yield sh[param]) Tj T* ( except KeyError:) Tj T* ( yield '%s: not found' % param ) Tj T* ( for param, value in setters.items\(\):) Tj T* ( sh[param] = value) Tj T* ( yield 'setting %s=%s' % \(param, value\)) Tj T* ( finally:) Tj T* ( sh.close\(\)) Tj T* T* (main.add_help = False # there is a custom help, remove the default one) Tj T* (main.prefix_chars = '.' # use dot-prefixed commands) Tj T* T* (if __name__ == '__main__':) Tj T* ( for output in plac.call\(main\):) Tj T* ( print\(output\)) Tj T* ET +BT 1 0 0 1 0 410 Tm 12 TL /F3 10 Tf 0 0 0 rg ( yield 'no arguments passed, use .help to see the available commands') Tj T* ( elif help: # custom help) Tj T* ( yield 'Commands: .help, .showall, .clear, .delete') Tj T* ( yield ') Tj (<) Tj (param) Tj (>) Tj ( ...') Tj T* ( yield ') Tj (<) Tj (param=value) Tj (>) Tj ( ...') Tj T* ( elif showall:) Tj T* ( for param, name in sh.items\(\):) Tj T* ( yield '%s=%s' % \(param, name\)) Tj T* ( elif clear:) Tj T* ( sh.clear\(\)) Tj T* ( yield 'cleared the shelve') Tj T* ( elif delete:) Tj T* ( try:) Tj T* ( del sh[delete]) Tj T* ( except KeyError:) Tj T* ( yield '%s: not found' % delete) Tj T* ( else:) Tj T* ( yield 'deleted %s' % delete) Tj T* ( for param in params:) Tj T* ( try:) Tj T* ( yield sh[param]) Tj T* ( except KeyError:) Tj T* ( yield '%s: not found' % param ) Tj T* ( for param, value in setters.items\(\):) Tj T* ( sh[param] = value) Tj T* ( yield 'setting %s=%s' % \(param, value\)) Tj T* ( finally:) Tj T* ( sh.close\(\)) Tj T* T* (main.add_help = False # there is a custom help, remove the default one) Tj T* (main.prefix_chars = '.' # use dot-prefixed commands) Tj T* T* (if __name__ == '__main__':) Tj T* ( for output in plac.call\(main\):) Tj T* ( print\(output\)) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 395.8236 cm +1 0 0 1 62.69291 332.2981 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (A few notes are in order:) Tj T* ET Q Q q -1 0 0 1 62.69291 389.8236 cm +1 0 0 1 62.69291 326.2981 cm Q q -1 0 0 1 62.69291 389.8236 cm +1 0 0 1 62.69291 326.2981 cm Q q -1 0 0 1 62.69291 365.8236 cm +1 0 0 1 62.69291 302.2981 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8123,10 +8154,10 @@ q Q Q q -1 0 0 1 62.69291 359.8236 cm +1 0 0 1 62.69291 296.2981 cm Q q -1 0 0 1 62.69291 347.8236 cm +1 0 0 1 62.69291 284.2981 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8147,10 +8178,10 @@ q Q Q q -1 0 0 1 62.69291 341.8236 cm +1 0 0 1 62.69291 278.2981 cm Q q -1 0 0 1 62.69291 317.8236 cm +1 0 0 1 62.69291 254.2981 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8170,10 +8201,10 @@ q Q Q q -1 0 0 1 62.69291 311.8236 cm +1 0 0 1 62.69291 248.2981 cm Q q -1 0 0 1 62.69291 287.8236 cm +1 0 0 1 62.69291 224.2981 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8193,10 +8224,10 @@ q Q Q q -1 0 0 1 62.69291 281.8236 cm +1 0 0 1 62.69291 218.2981 cm Q q -1 0 0 1 62.69291 269.8236 cm +1 0 0 1 62.69291 206.2981 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8216,10 +8247,10 @@ q Q Q q -1 0 0 1 62.69291 263.8236 cm +1 0 0 1 62.69291 200.2981 cm Q q -1 0 0 1 62.69291 251.8236 cm +1 0 0 1 62.69291 188.2981 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8239,10 +8270,10 @@ q Q Q q -1 0 0 1 62.69291 245.8236 cm +1 0 0 1 62.69291 182.2981 cm Q q -1 0 0 1 62.69291 233.8236 cm +1 0 0 1 62.69291 170.2981 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8262,10 +8293,10 @@ q Q Q q -1 0 0 1 62.69291 227.8236 cm +1 0 0 1 62.69291 164.2981 cm Q q -1 0 0 1 62.69291 191.8236 cm +1 0 0 1 62.69291 128.2981 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8285,16 +8316,32 @@ q Q Q q -1 0 0 1 62.69291 191.8236 cm +1 0 0 1 62.69291 128.2981 cm +Q +q +1 0 0 1 62.69291 110.2981 cm +q +BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (If you run ) Tj /F3 10 Tf (ishelve.py ) Tj /F1 10 Tf (without arguments you get the following message:) Tj T* ET +Q Q q -1 0 0 1 62.69291 173.8236 cm +1 0 0 1 56.69291 56.69291 cm q -BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (If you run ) Tj /F3 10 Tf (ishelve.py ) Tj /F1 10 Tf (without arguments you get the following message:) Tj T* ET +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (15) Tj T* -235.3849 0 Td ET Q Q + +endstream +endobj +% 'R362': class PDFStream +362 0 obj +% page stream +<< /Length 5938 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 128.6236 cm +1 0 0 1 62.69291 727.8236 cm q q 1 0 0 1 0 0 cm @@ -8315,29 +8362,13 @@ Q Q Q q -1 0 0 1 62.69291 108.6236 cm +1 0 0 1 62.69291 707.8236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (If you run ) Tj /F3 10 Tf (ishelve.py ) Tj /F1 10 Tf (with the option ) Tj /F3 10 Tf (.h ) Tj /F1 10 Tf (\(or any abbreviation of ) Tj /F3 10 Tf (.help) Tj /F1 10 Tf (\) you get:) Tj T* ET Q Q q -1 0 0 1 56.69291 56.69291 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (15) Tj T* -235.3849 0 Td ET -Q -Q - -endstream -endobj -% 'R361': class PDFStream -361 0 obj -% page stream -<< /Length 6569 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET -q -1 0 0 1 62.69291 703.8236 cm +1 0 0 1 62.69291 638.6236 cm q q 1 0 0 1 0 0 cm @@ -8357,14 +8388,14 @@ Q Q Q q -1 0 0 1 62.69291 683.8236 cm +1 0 0 1 62.69291 618.6236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (You can check by hand that the tool work:) Tj T* ET Q Q q -1 0 0 1 62.69291 434.6236 cm +1 0 0 1 62.69291 369.4236 cm q q 1 0 0 1 0 0 cm @@ -8385,25 +8416,25 @@ Q Q Q q -1 0 0 1 62.69291 404.6236 cm +1 0 0 1 62.69291 339.4236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (plac vs argparse) Tj T* ET Q Q q -1 0 0 1 62.69291 362.6236 cm +1 0 0 1 62.69291 297.4236 cm q BT 1 0 0 1 0 26 Tm 1.065988 Tw 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is opinionated and by design it does not try to make available all of the features of ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (in an) Tj T* 0 Tw .177126 Tw (easy way. In particular you should be aware of the following limitations/differences \(the following assumes) Tj T* 0 Tw (knowledge of ) Tj 0 0 .501961 rg (argparse) Tj 0 0 0 rg (\):) Tj T* ET Q Q q -1 0 0 1 62.69291 356.6236 cm +1 0 0 1 62.69291 291.4236 cm Q q -1 0 0 1 62.69291 356.6236 cm +1 0 0 1 62.69291 291.4236 cm Q q -1 0 0 1 62.69291 284.6236 cm +1 0 0 1 62.69291 219.4236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8423,10 +8454,10 @@ q Q Q q -1 0 0 1 62.69291 278.6236 cm +1 0 0 1 62.69291 213.4236 cm Q q -1 0 0 1 62.69291 230.6236 cm +1 0 0 1 62.69291 165.4236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8446,10 +8477,10 @@ q Q Q q -1 0 0 1 62.69291 224.6236 cm +1 0 0 1 62.69291 159.4236 cm Q q -1 0 0 1 62.69291 164.6236 cm +1 0 0 1 62.69291 99.42362 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8469,10 +8500,26 @@ q Q Q q -1 0 0 1 62.69291 158.6236 cm +1 0 0 1 62.69291 93.42362 cm Q q -1 0 0 1 62.69291 122.6236 cm +1 0 0 1 56.69291 56.69291 cm +q +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (16) Tj T* -235.3849 0 Td ET +Q +Q + +endstream +endobj +% 'R363': class PDFStream +363 0 obj +% page stream +<< /Length 7614 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET +q +1 0 0 1 62.69291 729.0236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8492,10 +8539,10 @@ q Q Q q -1 0 0 1 62.69291 116.6236 cm +1 0 0 1 62.69291 723.0236 cm Q q -1 0 0 1 62.69291 92.62362 cm +1 0 0 1 62.69291 699.0236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8515,26 +8562,10 @@ q Q Q q -1 0 0 1 62.69291 88.86614 cm -Q -q -1 0 0 1 56.69291 56.69291 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (16) Tj T* -235.3849 0 Td ET -Q +1 0 0 1 62.69291 693.0236 cm Q - -endstream -endobj -% 'R362': class PDFStream -362 0 obj -% page stream -<< /Length 7017 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 729.0236 cm +1 0 0 1 62.69291 657.0236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8554,28 +8585,28 @@ q Q Q q -1 0 0 1 62.69291 729.0236 cm +1 0 0 1 62.69291 657.0236 cm Q q -1 0 0 1 62.69291 711.0236 cm +1 0 0 1 62.69291 639.0236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (can leverage directly on many ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (features.) Tj T* ET Q Q q -1 0 0 1 62.69291 669.0236 cm +1 0 0 1 62.69291 597.0236 cm q BT 1 0 0 1 0 26 Tm 5.575697 Tw 12 TL /F1 10 Tf 0 0 0 rg (For instance, you can make invisible an argument in the usage message simply by using) Tj T* 0 Tw 1.435976 Tw /F3 10 Tf ('==SUPPRESS==' ) Tj /F1 10 Tf (as help string \(or ) Tj /F3 10 Tf (argparse.SUPPRESS) Tj /F1 10 Tf (\). Similarly, you can use ) Tj 0 0 .501961 rg (argparse.FileType) Tj T* 0 Tw 0 0 0 rg (directly.) Tj T* ET Q Q q -1 0 0 1 62.69291 615.0236 cm +1 0 0 1 62.69291 543.0236 cm q BT 1 0 0 1 0 38 Tm 1.639213 Tw 12 TL /F1 10 Tf 0 0 0 rg (It is also possible to pass options to the underlying ) Tj /F3 10 Tf (argparse.ArgumentParser ) Tj /F1 10 Tf (object \(currently it) Tj T* 0 Tw .285529 Tw (accepts the default arguments ) Tj /F3 10 Tf (description) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (epilog) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (prog) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (usage) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (add_help) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (argument_default) Tj /F1 10 Tf (,) Tj T* 0 Tw 1.439953 Tw /F3 10 Tf (parents) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (prefix_chars) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (fromfile_prefix_chars) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (conflict_handler) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (formatter_class) Tj /F1 10 Tf (\). It) Tj T* 0 Tw (is enough to set such attributes on the ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (function. For instance) Tj T* ET Q Q q -1 0 0 1 62.69291 545.8236 cm +1 0 0 1 62.69291 473.8236 cm q q 1 0 0 1 0 0 cm @@ -8596,26 +8627,26 @@ Q Q Q q -1 0 0 1 62.69291 501.8236 cm +1 0 0 1 62.69291 429.8236 cm q BT 1 0 0 1 0 26 Tm .239318 Tw 12 TL /F1 10 Tf 0 0 0 rg (disables the recognition of the help flag ) Tj /F3 10 Tf (-h, --help) Tj /F1 10 Tf (. This mechanism does not look particularly elegant,) Tj T* 0 Tw .566988 Tw (but it works well enough. I assume that the typical user of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (will be happy with the defaults and would) Tj T* 0 Tw (not want to change them; still it is possible if she wants to.) Tj T* ET Q Q q -1 0 0 1 62.69291 471.8236 cm +1 0 0 1 62.69291 399.8236 cm q BT 1 0 0 1 0 14 Tm 2.391235 Tw 12 TL /F1 10 Tf 0 0 0 rg (For instance, by setting the ) Tj /F3 10 Tf (description ) Tj /F1 10 Tf (attribute, it is possible to add a comment to the usage) Tj T* 0 Tw (message \(by default the docstring of the ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (function is used as description\).) Tj T* ET Q Q q -1 0 0 1 62.69291 441.8236 cm +1 0 0 1 62.69291 369.8236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .392619 Tw (It is also possible to change the option prefix; for instance if your script must run under Windows and you) Tj T* 0 Tw (want to use "/" as option prefix you can add the line:) Tj T* ET Q Q q -1 0 0 1 62.69291 408.6236 cm +1 0 0 1 62.69291 336.6236 cm q q 1 0 0 1 0 0 cm @@ -8636,19 +8667,19 @@ Q Q Q q -1 0 0 1 62.69291 364.6236 cm +1 0 0 1 62.69291 292.6236 cm q BT 1 0 0 1 0 26 Tm .924198 Tw 12 TL /F1 10 Tf 0 0 0 rg (The first prefix char \() Tj /F3 10 Tf (/) Tj /F1 10 Tf (\) is used as the default for the recognition of options and flags; the second prefix) Tj T* 0 Tw .26832 Tw (char \() Tj /F3 10 Tf (-) Tj /F1 10 Tf (\) is kept to keep the ) Tj /F3 10 Tf (-h/--help ) Tj /F1 10 Tf (option working: however you can disable it and reimplement it, if) Tj T* 0 Tw (you like, as seen in the ) Tj /F3 10 Tf (ishelve ) Tj /F1 10 Tf (example.) Tj T* ET Q Q q -1 0 0 1 62.69291 334.6236 cm +1 0 0 1 62.69291 262.6236 cm q BT 1 0 0 1 0 14 Tm 7.709147 Tw 12 TL /F1 10 Tf 0 0 0 rg (It is possible to access directly the underlying ) Tj 0 0 .501961 rg (ArgumentParser ) Tj 0 0 0 rg (object, by invoking the) Tj T* 0 Tw /F3 10 Tf (plac.parser_from ) Tj /F1 10 Tf (utility function:) Tj T* ET Q Q q -1 0 0 1 62.69291 241.4236 cm +1 0 0 1 62.69291 169.4236 cm q q 1 0 0 1 0 0 cm @@ -8668,24 +8699,18 @@ Q Q Q q -1 0 0 1 62.69291 197.4236 cm +1 0 0 1 62.69291 125.4236 cm q BT 1 0 0 1 0 26 Tm 2.646905 Tw 12 TL /F1 10 Tf 0 0 0 rg (Internally ) Tj /F3 10 Tf (plac.call ) Tj /F1 10 Tf (uses ) Tj /F3 10 Tf (plac.parser_from ) Tj /F1 10 Tf (and adds the parser to the main function as an) Tj T* 0 Tw .982126 Tw (attribute. When ) Tj /F3 10 Tf (plac.call\(func\) ) Tj /F1 10 Tf (is invoked multiple time, the parser is re-used and not rebuilt from) Tj T* 0 Tw (scratch again.) Tj T* ET Q Q q -1 0 0 1 62.69291 167.4236 cm +1 0 0 1 62.69291 95.42362 cm q BT 1 0 0 1 0 14 Tm .982765 Tw 12 TL /F1 10 Tf 0 0 0 rg (I use ) Tj /F3 10 Tf (plac.parser_from ) Tj /F1 10 Tf (in the unit tests of the module, but regular users should not need to use it,) Tj T* 0 Tw (unless they want to access ) Tj /F4 10 Tf (all ) Tj /F1 10 Tf (of the features of ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (directly without calling the main function.) Tj T* ET Q Q q -1 0 0 1 62.69291 113.4236 cm -q -BT 1 0 0 1 0 38 Tm 1.442126 Tw 12 TL /F1 10 Tf 0 0 0 rg (Interested readers should read the documentation of ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (to understand the meaning of the other) Tj T* 0 Tw .771567 Tw (options. If there is a set of options that you use very often, you may consider writing a decorator adding) Tj T* 0 Tw 1.257045 Tw (such options to the ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (function for you. For simplicity, ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (does not perform any magic except the) Tj T* 0 Tw (addition of the ) Tj /F3 10 Tf (.p ) Tj /F1 10 Tf (attribute.) Tj T* ET -Q -Q -q 1 0 0 1 56.69291 56.69291 cm q 0 0 0 rg @@ -8695,32 +8720,38 @@ Q endstream endobj -% 'R363': class PDFStream -363 0 obj +% 'R364': class PDFStream +364 0 obj % page stream -<< /Length 8625 >> +<< /Length 8150 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 747.0236 cm +1 0 0 1 62.69291 717.0236 cm +q +BT 1 0 0 1 0 38 Tm 1.442126 Tw 12 TL /F1 10 Tf 0 0 0 rg (Interested readers should read the documentation of ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (to understand the meaning of the other) Tj T* 0 Tw .771567 Tw (options. If there is a set of options that you use very often, you may consider writing a decorator adding) Tj T* 0 Tw 1.257045 Tw (such options to the ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (function for you. For simplicity, ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (does not perform any magic except the) Tj T* 0 Tw (addition of the ) Tj /F3 10 Tf (.p ) Tj /F1 10 Tf (attribute.) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 687.0236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (plac vs the rest of the world) Tj T* ET Q Q q -1 0 0 1 62.69291 705.0236 cm +1 0 0 1 62.69291 645.0236 cm q BT 1 0 0 1 0 26 Tm 1.866905 Tw 12 TL /F1 10 Tf 0 0 0 rg (Originally ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (boasted about being "the easiest command-line arguments parser in the world". Since) Tj T* 0 Tw .306457 Tw (then, people started pointing out to me various projects which are based on the same idea \(extracting the) Tj T* 0 Tw (parser from the main function signature\) and are arguably even easier than ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (:) Tj T* ET Q Q q -1 0 0 1 62.69291 699.0236 cm +1 0 0 1 62.69291 639.0236 cm Q q -1 0 0 1 62.69291 699.0236 cm +1 0 0 1 62.69291 639.0236 cm Q q -1 0 0 1 62.69291 687.0236 cm +1 0 0 1 62.69291 627.0236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8740,10 +8771,10 @@ q Q Q q -1 0 0 1 62.69291 681.0236 cm +1 0 0 1 62.69291 621.0236 cm Q q -1 0 0 1 62.69291 669.0236 cm +1 0 0 1 62.69291 609.0236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8763,10 +8794,10 @@ q Q Q q -1 0 0 1 62.69291 663.0236 cm +1 0 0 1 62.69291 603.0236 cm Q q -1 0 0 1 62.69291 651.0236 cm +1 0 0 1 62.69291 591.0236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8786,76 +8817,76 @@ q Q Q q -1 0 0 1 62.69291 651.0236 cm +1 0 0 1 62.69291 591.0236 cm Q q -1 0 0 1 62.69291 621.0236 cm +1 0 0 1 62.69291 561.0236 cm q BT 1 0 0 1 0 14 Tm 2.136457 Tw 12 TL /F1 10 Tf 0 0 0 rg (Luckily for me none of such projects had the idea of using function annotations and ) Tj 0 0 .501961 rg (argparse) Tj 0 0 0 rg (; as a) Tj T* 0 Tw (consequence, they are no match for the capabilities of ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (.) Tj T* ET Q Q q -1 0 0 1 62.69291 579.0236 cm +1 0 0 1 62.69291 519.0236 cm q BT 1 0 0 1 0 26 Tm 1.551163 Tw 12 TL /F1 10 Tf 0 0 0 rg (Of course, there are tons of other libraries to parse the command line. For instance ) Tj 0 0 .501961 rg (Clap ) Tj 0 0 0 rg (by Matthew) Tj T* 0 Tw 1.211567 Tw (Frazier which appeared on PyPI just the day before ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (; ) Tj 0 0 .501961 rg (Clap ) Tj 0 0 0 rg (is fine but it is certainly not easier than) Tj T* 0 Tw 0 0 .501961 rg (plac) Tj 0 0 0 rg (.) Tj T* ET Q Q q -1 0 0 1 62.69291 537.0236 cm +1 0 0 1 62.69291 477.0236 cm q BT 1 0 0 1 0 26 Tm .622488 Tw 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (can also be used as a replacement of the ) Tj 0 0 .501961 rg (cmd ) Tj 0 0 0 rg (module in the standard library and as such it shares) Tj T* 0 Tw .377126 Tw (many features with the module ) Tj 0 0 .501961 rg (cmd2 ) Tj 0 0 0 rg (by Catherine Devlin. However, this is completely coincidental, since) Tj T* 0 Tw (I became aware of the ) Tj 0 0 .501961 rg (cmd2 ) Tj 0 0 0 rg (module only after writing ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (.) Tj T* ET Q Q q -1 0 0 1 62.69291 507.0236 cm +1 0 0 1 62.69291 447.0236 cm q BT 1 0 0 1 0 14 Tm .449982 Tw 12 TL /F1 10 Tf 0 0 0 rg (Command-line argument parsers keep coming out; between the newcomers I will notice ) Tj 0 0 .501961 rg (marrow.script ) Tj 0 0 0 rg (by) Tj T* 0 Tw (Alice Bevan-McGregor, which is quite similar to ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (in spirit, but does not rely on ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (at all.) Tj T* ET Q Q q -1 0 0 1 62.69291 477.0236 cm +1 0 0 1 62.69291 417.0236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (The future) Tj T* ET Q Q q -1 0 0 1 62.69291 411.0236 cm +1 0 0 1 62.69291 351.0236 cm q BT 1 0 0 1 0 50 Tm .135542 Tw 12 TL /F1 10 Tf 0 0 0 rg (Currently the core of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is around 200 lines of code, not counting blanks, comments and docstrings. I do) Tj T* 0 Tw .968626 Tw (not plan to extend the core much in the future. The idea is to keep the module short: it is and it should) Tj T* 0 Tw .11811 Tw (remain a little wrapper over ) Tj 0 0 .501961 rg (argparse) Tj 0 0 0 rg (. Actually I have thought about contributing the core back to ) Tj 0 0 .501961 rg (argparse) Tj T* 0 Tw 2.307485 Tw 0 0 0 rg (if ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (becomes successfull and gains a reasonable number of users. For the moment it should be) Tj T* 0 Tw (considered in alpha status.) Tj T* ET Q Q q -1 0 0 1 62.69291 369.0236 cm +1 0 0 1 62.69291 309.0236 cm q BT 1 0 0 1 0 26 Tm .927488 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that even if ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (has been designed to be simple to use for simple stuff, its power should not be) Tj T* 0 Tw 1.02186 Tw (underestimated; it is actually a quite advanced tool with a domain of applicability which far exceeds the) Tj T* 0 Tw (realm of command-line arguments parsers.) Tj T* ET Q Q q -1 0 0 1 62.69291 303.0236 cm +1 0 0 1 62.69291 243.0236 cm q BT 1 0 0 1 0 50 Tm .285988 Tw 12 TL /F1 10 Tf 0 0 0 rg (Version 0.5 of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (doubled the code base and the documentation: it is based on the idea of using ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (to) Tj T* 0 Tw .408555 Tw (implement command-line interpreters, i.e. something akin to the ) Tj /F3 10 Tf (cmd ) Tj /F1 10 Tf (module in the standard library, only) Tj T* 0 Tw .49936 Tw (better. The new features of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (are described in the ) Tj 0 0 .501961 rg (advanced usage document ) Tj 0 0 0 rg (. They are implemented) Tj T* 0 Tw .313828 Tw (in a separated module \() Tj /F3 10 Tf (plac_ext.py) Tj /F1 10 Tf (\), since they require Python 2.5 to work, whereas ) Tj /F3 10 Tf (plac_core.py) Tj T* 0 Tw /F1 10 Tf (only requires Python 2.3.) Tj T* ET Q Q q -1 0 0 1 62.69291 273.0236 cm +1 0 0 1 62.69291 213.0236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Trivia: the story behind the name) Tj T* ET Q Q q -1 0 0 1 62.69291 207.0236 cm +1 0 0 1 62.69291 147.0236 cm q BT 1 0 0 1 0 50 Tm .979984 Tw 12 TL /F1 10 Tf 0 0 0 rg (The ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (project started very humbly: I just wanted to make easy_installable my old ) Tj 0 0 .501961 rg (optionparse ) Tj 0 0 0 rg (recipe,) Tj T* 0 Tw .565988 Tw (and to publish it on PyPI. The original name of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (was optionparser and the idea behind it was to build) Tj T* 0 Tw .603735 Tw (an ) Tj 0 0 .501961 rg (OptionParser ) Tj 0 0 0 rg (object from the docstring of the module. However, before doing that, I decided to check) Tj T* 0 Tw .244198 Tw (out the ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (module, since I knew it was going into Python 2.7 and Python 2.7 was coming out. Soon) Tj T* 0 Tw (enough I realized two things:) Tj T* ET Q Q q -1 0 0 1 62.69291 201.0236 cm +1 0 0 1 62.69291 141.0236 cm Q q -1 0 0 1 62.69291 201.0236 cm +1 0 0 1 62.69291 141.0236 cm Q q -1 0 0 1 62.69291 177.0236 cm +1 0 0 1 62.69291 117.0236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8875,10 +8906,26 @@ q Q Q q -1 0 0 1 62.69291 171.0236 cm +1 0 0 1 62.69291 111.0236 cm Q q -1 0 0 1 62.69291 147.0236 cm +1 0 0 1 56.69291 56.69291 cm +q +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (18) Tj T* -235.3849 0 Td ET +Q +Q + +endstream +endobj +% 'R365': class PDFStream +365 0 obj +% page stream +<< /Length 6620 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET +q +1 0 0 1 62.69291 741.0236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -8899,105 +8946,89 @@ q Q Q q -1 0 0 1 62.69291 147.0236 cm +1 0 0 1 62.69291 741.0236 cm Q q -1 0 0 1 62.69291 93.02362 cm +1 0 0 1 62.69291 687.0236 cm q BT 1 0 0 1 0 38 Tm .600574 Tw 12 TL /F1 10 Tf 0 0 0 rg (Putting together these two observations with the original idea of inferring the parser I decided to build an) Tj T* 0 Tw .516905 Tw 0 0 .501961 rg (ArgumentParser ) Tj 0 0 0 rg (object from function annotations. The ) Tj /F3 10 Tf (optionparser ) Tj /F1 10 Tf (name was ruled out, since I was) Tj T* 0 Tw 2.085984 Tw (now using ) Tj 0 0 .501961 rg (argparse) Tj 0 0 0 rg (; a name like ) Tj /F3 10 Tf (argparse_plus ) Tj /F1 10 Tf (was also ruled out, since the typical usage was) Tj T* 0 Tw (completely different from the ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (usage.) Tj T* ET Q Q q -1 0 0 1 56.69291 56.69291 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (18) Tj T* -235.3849 0 Td ET -Q -Q - -endstream -endobj -% 'R364': class PDFStream -364 0 obj -% page stream -<< /Length 5814 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET -q -1 0 0 1 62.69291 741.0236 cm +1 0 0 1 62.69291 657.0236 cm q BT 1 0 0 1 0 14 Tm 1.093876 Tw 12 TL /F1 10 Tf 0 0 0 rg (I made a research on PyPI and the name ) Tj /F4 10 Tf (clap ) Tj /F1 10 Tf (\(Command Line Arguments Parser\) was not taken, so I) Tj T* 0 Tw (renamed everything to clap. After two days a ) Tj 0 0 .501961 rg (Clap ) Tj 0 0 0 rg (module appeared on PyPI <) Tj (expletives deleted) Tj (>) Tj (!) Tj T* ET Q Q q -1 0 0 1 62.69291 711.0236 cm +1 0 0 1 62.69291 627.0236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .877209 Tw (Having little imagination, I decided to rename everything again to plac, an anagram of clap: since it is a) Tj T* 0 Tw (non-existing English name, I hope nobody will steal it from me!) Tj T* ET Q Q q -1 0 0 1 62.69291 693.0236 cm +1 0 0 1 62.69291 609.0236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (That's all, I hope you will enjoy working with ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (!) Tj T* ET Q Q q -1 0 0 1 62.69291 660.0236 cm +1 0 0 1 62.69291 576.0236 cm q BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Advanced usages of plac) Tj T* ET Q Q q -1 0 0 1 62.69291 630.0236 cm +1 0 0 1 62.69291 546.0236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Introduction) Tj T* ET Q Q q -1 0 0 1 62.69291 588.0236 cm +1 0 0 1 62.69291 504.0236 cm q BT 1 0 0 1 0 26 Tm .539036 Tw 12 TL /F1 10 Tf 0 0 0 rg (One of the design goals of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is to make it dead easy to write a scriptable and testable interface for an) Tj T* 0 Tw .813876 Tw (application. You can use ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (whenever you have an API with strings in input and strings in output, and) Tj T* 0 Tw (that includes a ) Tj /F4 10 Tf (huge ) Tj /F1 10 Tf (domain of applications.) Tj T* ET Q Q q -1 0 0 1 62.69291 546.0236 cm +1 0 0 1 62.69291 462.0236 cm q BT 1 0 0 1 0 26 Tm 1.756651 Tw 12 TL /F1 10 Tf 0 0 0 rg (A string-oriented interface is a scriptable interface by construction. That means that you can define a) Tj T* 0 Tw .918735 Tw (command language for your application and that it is possible to write scripts which are interpretable by) Tj T* 0 Tw 0 0 .501961 rg (plac ) Tj 0 0 0 rg (and can be run as batch scripts.) Tj T* ET Q Q q -1 0 0 1 62.69291 504.0236 cm +1 0 0 1 62.69291 420.0236 cm q BT 1 0 0 1 0 26 Tm .444987 Tw 12 TL /F1 10 Tf 0 0 0 rg (Actually, at the most general level, you can see ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (as a generic tool to write domain specific languages) Tj T* 0 Tw .107209 Tw (\(DSL\). With ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (you can test your application interactively as well as with batch scripts, and even with the) Tj T* 0 Tw (analogous of Python doctests for your defined language.) Tj T* ET Q Q q -1 0 0 1 62.69291 438.0236 cm +1 0 0 1 62.69291 354.0236 cm q BT 1 0 0 1 0 50 Tm .694104 Tw 12 TL /F1 10 Tf 0 0 0 rg (You can easily replace the ) Tj /F3 10 Tf (cmd ) Tj /F1 10 Tf (module of the standard library and you could easily write an application) Tj T* 0 Tw 2.271751 Tw (like ) Tj 0 0 .501961 rg (twill ) Tj 0 0 0 rg (with ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (. Or you could use it to script your building procedure. ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (also supports parallel) Tj T* 0 Tw .907765 Tw (execution of multiple commands and can be used as task manager and monitor. It is also quite easy to) Tj T* 0 Tw 1.483488 Tw (build a GUI or a Web application on top of ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (. When speaking of things you can do with ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (, your) Tj T* 0 Tw (imagination is the only limit!) Tj T* ET Q Q q -1 0 0 1 62.69291 408.0236 cm +1 0 0 1 62.69291 324.0236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (From scripts to interactive applications) Tj T* ET Q Q q -1 0 0 1 62.69291 354.0236 cm +1 0 0 1 62.69291 270.0236 cm q BT 1 0 0 1 0 38 Tm 1.300751 Tw 12 TL /F1 10 Tf 0 0 0 rg (Command-line scripts have many advantages, but they are no substitute for interactive applications. In) Tj T* 0 Tw .088171 Tw (particular, if you have a script with a large startup time which must be run multiple times, it is best to turn it) Tj T* 0 Tw 4.582126 Tw (into an interactive application, so that the startup is performed only once. ) Tj /F3 10 Tf (plac ) Tj /F1 10 Tf (provides an) Tj T* 0 Tw /F3 10 Tf (Interpreter ) Tj /F1 10 Tf (class just for this purpose.) Tj T* ET Q Q q -1 0 0 1 62.69291 324.0236 cm +1 0 0 1 62.69291 240.0236 cm q BT 1 0 0 1 0 14 Tm 1.293984 Tw 12 TL /F1 10 Tf 0 0 0 rg (The ) Tj /F3 10 Tf (Interpreter ) Tj /F1 10 Tf (class wraps the main function of a script and provides an ) Tj /F3 10 Tf (.interact ) Tj /F1 10 Tf (method to) Tj T* 0 Tw (start an interactive interpreter reading commands from the console.) Tj T* ET Q Q q -1 0 0 1 62.69291 294.0236 cm +1 0 0 1 62.69291 210.0236 cm q BT 1 0 0 1 0 14 Tm 1.49436 Tw 12 TL /F1 10 Tf 0 0 0 rg (For instance, you can define an interactive interpreter on top of the ) Tj /F3 10 Tf (ishelve ) Tj /F1 10 Tf (script introduced in the) Tj T* 0 Tw 0 0 .501961 rg (basic documentation ) Tj 0 0 0 rg (as follows:) Tj T* ET Q @@ -9013,11 +9044,11 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 192 re B* +n -6 -6 468.6898 108 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 170 Tm /F3 10 Tf 12 TL (# shelve_interpreter.py) Tj T* (import plac, ishelve) Tj T* T* (@plac.annotations\() Tj T* ( interactive=\('start interactive interface', 'flag'\),) Tj T* ( subcommands='the commands of the underlying ishelve interpreter'\)) Tj T* (def main\(interactive, *subcommands\):) Tj T* ( """) Tj T* ( This script works both interactively and non-interactively.) Tj T* ( Use .help to see the internal commands.) Tj T* ( """) Tj T* ( if interactive:) Tj T* ( plac.Interpreter\(ishelve.main\).interact\(\)) Tj T* ( else:) Tj T* ( for out in plac.call\(ishelve.main, subcommands\):) Tj T* ET +BT 1 0 0 1 0 86 Tm /F3 10 Tf 12 TL (# shelve_interpreter.py) Tj T* (import plac, ishelve) Tj T* T* (@plac.annotations\() Tj T* ( interactive=\('start interactive interface', 'flag'\),) Tj T* ( subcommands='the commands of the underlying ishelve interpreter'\)) Tj T* (def main\(interactive, *subcommands\):) Tj T* ( """) Tj T* ET Q Q Q @@ -9033,14 +9064,14 @@ Q endstream endobj -% 'R365': class PDFStream -365 0 obj +% 'R366': class PDFStream +366 0 obj % page stream -<< /Length 3534 >> +<< /Length 3706 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 703.8236 cm +1 0 0 1 62.69291 619.8236 cm q q 1 0 0 1 0 0 cm @@ -9050,24 +9081,24 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 60 re B* +n -6 -6 468.6898 144 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 38 Tm /F3 10 Tf 12 TL ( print\(out\)) Tj T* T* (if __name__ == '__main__':) Tj T* ( plac.call\(main\)) Tj T* ET +BT 1 0 0 1 0 122 Tm /F3 10 Tf 12 TL ( This script works both interactively and non-interactively.) Tj T* ( Use .help to see the internal commands.) Tj T* ( """) Tj T* ( if interactive:) Tj T* ( plac.Interpreter\(ishelve.main\).interact\(\)) Tj T* ( else:) Tj T* ( for out in plac.call\(ishelve.main, subcommands\):) Tj T* ( print\(out\)) Tj T* T* (if __name__ == '__main__':) Tj T* ( plac.call\(main\)) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 659.8236 cm +1 0 0 1 62.69291 575.8236 cm q BT 1 0 0 1 0 26 Tm 2.200651 Tw 12 TL /F1 10 Tf 0 0 0 rg (A trick has been used here: the ishelve command-line interface has been hidden inside an external) Tj T* 0 Tw .917674 Tw (interface. They are distinct: for instance the external interface recognizes the ) Tj /F3 10 Tf (-h/--help ) Tj /F1 10 Tf (flag whereas) Tj T* 0 Tw (the internal interface only recognizes the ) Tj /F3 10 Tf (.help ) Tj /F1 10 Tf (command:) Tj T* ET Q Q q -1 0 0 1 62.69291 626.6236 cm +1 0 0 1 62.69291 542.6236 cm q q 1 0 0 1 0 0 cm @@ -9088,7 +9119,7 @@ Q Q Q q -1 0 0 1 62.69291 449.4236 cm +1 0 0 1 62.69291 365.4236 cm q q 1 0 0 1 0 0 cm @@ -9109,14 +9140,14 @@ Q Q Q q -1 0 0 1 62.69291 429.4236 cm +1 0 0 1 62.69291 345.4236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Thanks to this ingenuous trick, the script can be run both interactively and non-interactively:) Tj T* ET Q Q q -1 0 0 1 62.69291 384.2236 cm +1 0 0 1 62.69291 300.2236 cm q q 1 0 0 1 0 0 cm @@ -9137,7 +9168,7 @@ Q Q Q q -1 0 0 1 62.69291 364.2236 cm +1 0 0 1 62.69291 280.2236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is an usage session:) Tj T* ET @@ -9154,10 +9185,10 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 264 re B* +n -6 -6 468.6898 180 re B* Q q -BT 1 0 0 1 0 242 Tm 12 TL /F3 10 Tf 0 0 0 rg ($ python shelve_interpreter.py -i # interactive use) Tj T* (A simple interface to a shelve. Use .help to see the available commands.) Tj T* (i) Tj (>) Tj ( .help) Tj T* (Commands: .help, .showall, .clear, .delete) Tj T* (<) Tj (param) Tj (>) Tj ( ...) Tj T* (<) Tj (param=value) Tj (>) Tj ( ...) Tj T* (i) Tj (>) Tj ( a=1) Tj T* (setting a=1) Tj T* (i) Tj (>) Tj ( a) Tj T* (1) Tj T* (i) Tj (>) Tj ( b=2) Tj T* (setting b=2) Tj T* (i) Tj (>) Tj ( a b) Tj T* (1) Tj T* (2) Tj T* (i) Tj (>) Tj ( .del a) Tj T* (deleted a) Tj T* (i) Tj (>) Tj ( a) Tj T* (a: not found) Tj T* (i) Tj (>) Tj ( .show) Tj T* (b=2) Tj T* ET +BT 1 0 0 1 0 158 Tm 12 TL /F3 10 Tf 0 0 0 rg ($ python shelve_interpreter.py -i # interactive use) Tj T* (A simple interface to a shelve. Use .help to see the available commands.) Tj T* (i) Tj (>) Tj ( .help) Tj T* (Commands: .help, .showall, .clear, .delete) Tj T* (<) Tj (param) Tj (>) Tj ( ...) Tj T* (<) Tj (param=value) Tj (>) Tj ( ...) Tj T* (i) Tj (>) Tj ( a=1) Tj T* (setting a=1) Tj T* (i) Tj (>) Tj ( a) Tj T* (1) Tj T* (i) Tj (>) Tj ( b=2) Tj T* (setting b=2) Tj T* (i) Tj (>) Tj ( a b) Tj T* (1) Tj T* ET Q Q Q @@ -9173,14 +9204,14 @@ Q endstream endobj -% 'R366': class PDFStream -366 0 obj +% 'R367': class PDFStream +367 0 obj % page stream -<< /Length 5533 >> +<< /Length 4887 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 739.8236 cm +1 0 0 1 62.69291 655.8236 cm q q 1 0 0 1 0 0 cm @@ -9190,48 +9221,48 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 24 re B* +n -6 -6 468.6898 108 re B* Q q -BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (i) Tj (>) Tj ( [CTRL-D]) Tj T* ET +BT 1 0 0 1 0 86 Tm 12 TL /F3 10 Tf 0 0 0 rg (2) Tj T* (i) Tj (>) Tj ( .del a) Tj T* (deleted a) Tj T* (i) Tj (>) Tj ( a) Tj T* (a: not found) Tj T* (i) Tj (>) Tj ( .show) Tj T* (b=2) Tj T* (i) Tj (>) Tj ( [CTRL-D]) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 671.8236 cm +1 0 0 1 62.69291 587.8236 cm q BT 1 0 0 1 0 50 Tm .256412 Tw 12 TL /F1 10 Tf 0 0 0 rg (The ) Tj /F3 10 Tf (.interact ) Tj /F1 10 Tf (method reads commands from the console and send them to the underlying interpreter,) Tj T* 0 Tw .065984 Tw (until the user send a CTRL-D command \(CTRL-Z in Windows\). There is a default argument ) Tj /F3 10 Tf (prompt='i) Tj (>) Tj T* 0 Tw .41832 Tw (' ) Tj /F1 10 Tf (which can be used to change the prompt. The text displayed at the beginning of the interactive session) Tj T* 0 Tw 1.407126 Tw (is the docstring of the main function. ) Tj /F3 10 Tf (plac ) Tj /F1 10 Tf (also understands command abbreviations: in this example) Tj T* 0 Tw /F3 10 Tf (del ) Tj /F1 10 Tf (is an abbreviation for ) Tj /F3 10 Tf (delete) Tj /F1 10 Tf (. In case of ambiguous abbreviations ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (raises a ) Tj /F3 10 Tf (NameError) Tj /F1 10 Tf (.) Tj T* ET Q Q q -1 0 0 1 62.69291 641.8236 cm +1 0 0 1 62.69291 557.8236 cm q BT 1 0 0 1 0 14 Tm .847045 Tw 12 TL /F1 10 Tf 0 0 0 rg (Finally I must notice that the ) Tj /F3 10 Tf (plac.Interpreter ) Tj /F1 10 Tf (is available only if you are using a recent version of) Tj T* 0 Tw (Python \() Tj (>) Tj (= 2.5\), because it is a context manager object which uses extended generators internally.) Tj T* ET Q Q q -1 0 0 1 62.69291 611.8236 cm +1 0 0 1 62.69291 527.8236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Testing a plac application) Tj T* ET Q Q q -1 0 0 1 62.69291 581.8236 cm +1 0 0 1 62.69291 497.8236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 3.034269 Tw (You can conveniently test your application in interactive mode. However manual testing is a poor) Tj T* 0 Tw (substitute for automatic testing.) Tj T* ET Q Q q -1 0 0 1 62.69291 563.8236 cm +1 0 0 1 62.69291 479.8236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (In principle, one could write automatic tests for the ) Tj /F3 10 Tf (ishelve ) Tj /F1 10 Tf (application by using ) Tj /F3 10 Tf (plac.call ) Tj /F1 10 Tf (directly:) Tj T* ET Q Q q -1 0 0 1 62.69291 398.6236 cm +1 0 0 1 62.69291 314.6236 cm q q 1 0 0 1 0 0 cm @@ -9252,19 +9283,19 @@ Q Q Q q -1 0 0 1 62.69291 354.6236 cm +1 0 0 1 62.69291 270.6236 cm q BT 1 0 0 1 0 26 Tm .390651 Tw 12 TL /F1 10 Tf 0 0 0 rg (However, using ) Tj /F3 10 Tf (plac.call ) Tj /F1 10 Tf (is not especially nice. The big issue is that ) Tj /F3 10 Tf (plac.call ) Tj /F1 10 Tf (responds to invalid) Tj T* 0 Tw 1.249987 Tw (input by printing an error message on stderr and by raising a ) Tj /F3 10 Tf (SystemExit) Tj /F1 10 Tf (: this is certainly not a nice) Tj T* 0 Tw (thing to do in a test.) Tj T* ET Q Q q -1 0 0 1 62.69291 312.6236 cm +1 0 0 1 62.69291 228.6236 cm q BT 1 0 0 1 0 26 Tm 1.616457 Tw 12 TL /F1 10 Tf 0 0 0 rg (As a consequence of this behavior it is impossible to test for invalid commands, unless you wrap the) Tj T* 0 Tw .259985 Tw /F3 10 Tf (SystemExit ) Tj /F1 10 Tf (exception by hand each time \(a possibly you do something with the error message in stderr) Tj T* 0 Tw (too\). Luckily, ) Tj /F3 10 Tf (plac ) Tj /F1 10 Tf (offers a better testing support through the ) Tj /F3 10 Tf (check ) Tj /F1 10 Tf (method of ) Tj /F3 10 Tf (Interpreter ) Tj /F1 10 Tf (objects:) Tj T* ET Q Q q -1 0 0 1 62.69291 159.4236 cm +1 0 0 1 62.69291 99.42362 cm q q 1 0 0 1 0 0 cm @@ -9274,21 +9305,15 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 144 re B* +n -6 -6 468.6898 120 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 122 Tm /F3 10 Tf 12 TL (# test_ishelve_more.py) Tj T* (from __future__ import with_statement) Tj T* (import plac, ishelve) Tj T* T* (def test\(\):) Tj T* ( with plac.Interpreter\(ishelve.main\) as i:) Tj T* ( i.check\('.clear', 'cleared the shelve'\)) Tj T* ( i.check\('a=1', 'setting a=1'\)) Tj T* ( i.check\('a', '1'\)) Tj T* ( i.check\('.delete=a', 'deleted a'\)) Tj T* ( i.check\('a', 'a: not found'\)) Tj T* ET -Q +BT 1 0 0 1 0 98 Tm /F3 10 Tf 12 TL (# test_ishelve_more.py) Tj T* (from __future__ import with_statement) Tj T* (import plac, ishelve) Tj T* T* (def test\(\):) Tj T* ( with plac.Interpreter\(ishelve.main\) as i:) Tj T* ( i.check\('.clear', 'cleared the shelve'\)) Tj T* ( i.check\('a=1', 'setting a=1'\)) Tj T* ( i.check\('a', '1'\)) Tj T* ET Q Q Q Q -q -1 0 0 1 62.69291 103.4236 cm -q -BT 1 0 0 1 0 38 Tm 6.299974 Tw 12 TL /F1 10 Tf 0 0 0 rg (The method ) Tj /F3 10 Tf (.check\(given_input, expected_output\) ) Tj /F1 10 Tf (works on strings and raises an) Tj T* 0 Tw .971318 Tw /F3 10 Tf (AssertionError ) Tj /F1 10 Tf (if the output produced by the interpreter is different from the expected output for the) Tj T* 0 Tw 2.186905 Tw (given input. Notice that ) Tj /F3 10 Tf (AssertionError ) Tj /F1 10 Tf (is catched by tools like ) Tj /F3 10 Tf (py.test ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (nosetests ) Tj /F1 10 Tf (and) Tj T* 0 Tw (actually ) Tj /F3 10 Tf (plac ) Tj /F1 10 Tf (tests are intended to be run with such tools.) Tj T* ET -Q Q q 1 0 0 1 56.69291 56.69291 cm @@ -9300,29 +9325,56 @@ Q endstream endobj -% 'R367': class PDFStream -367 0 obj +% 'R368': class PDFStream +368 0 obj % page stream -<< /Length 6041 >> +<< /Length 6116 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 717.0236 cm +1 0 0 1 62.69291 727.8236 cm +q +q +1 0 0 1 0 0 cm +q +1 0 0 1 6.6 6.6 cm +q +.662745 .662745 .662745 RG +.5 w +.960784 .960784 .862745 rg +n -6 -6 468.6898 36 re B* +Q +q +0 0 0 rg +BT 1 0 0 1 0 14 Tm /F3 10 Tf 12 TL ( i.check\('.delete=a', 'deleted a'\)) Tj T* ( i.check\('a', 'a: not found'\)) Tj T* ET +Q +Q +Q +Q +Q +q +1 0 0 1 62.69291 671.8236 cm +q +BT 1 0 0 1 0 38 Tm 6.299974 Tw 12 TL /F1 10 Tf 0 0 0 rg (The method ) Tj /F3 10 Tf (.check\(given_input, expected_output\) ) Tj /F1 10 Tf (works on strings and raises an) Tj T* 0 Tw .971318 Tw /F3 10 Tf (AssertionError ) Tj /F1 10 Tf (if the output produced by the interpreter is different from the expected output for the) Tj T* 0 Tw 2.186905 Tw (given input. Notice that ) Tj /F3 10 Tf (AssertionError ) Tj /F1 10 Tf (is catched by tools like ) Tj /F3 10 Tf (py.test ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (nosetests ) Tj /F1 10 Tf (and) Tj T* 0 Tw (actually ) Tj /F3 10 Tf (plac ) Tj /F1 10 Tf (tests are intended to be run with such tools.) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 617.8236 cm q BT 1 0 0 1 0 38 Tm .239984 Tw 12 TL /F1 10 Tf 0 0 0 rg (Interpreters offer a minor syntactic advantage with respect to calling ) Tj /F3 10 Tf (plac.call ) Tj /F1 10 Tf (directly, but they offer a) Tj T* 0 Tw .96748 Tw /F4 10 Tf (major ) Tj /F1 10 Tf (semantic advantage when things go wrong \(read exceptions\): an ) Tj /F3 10 Tf (Interpreter ) Tj /F1 10 Tf (object internally) Tj T* 0 Tw 1.181318 Tw (invokes something like ) Tj /F3 10 Tf (plac.call) Tj /F1 10 Tf (, but it wraps all exceptions, so that ) Tj /F3 10 Tf (i.check ) Tj /F1 10 Tf (is guaranteed not to) Tj T* 0 Tw (raise any exception except ) Tj /F3 10 Tf (AssertionError) Tj /F1 10 Tf (.) Tj T* ET Q Q q -1 0 0 1 62.69291 699.0236 cm +1 0 0 1 62.69291 599.8236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (Even the ) Tj /F3 10 Tf (SystemExit ) Tj /F1 10 Tf (exception is captured and you can write your test as) Tj T* ET Q Q q -1 0 0 1 62.69291 693.0236 cm +1 0 0 1 62.69291 593.8236 cm Q q -1 0 0 1 62.69291 681.0236 cm +1 0 0 1 62.69291 581.8236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET BT 1 0 0 1 0 2 Tm T* ET @@ -9337,41 +9389,41 @@ q Q Q q -1 0 0 1 62.69291 681.0236 cm +1 0 0 1 62.69291 581.8236 cm Q q -1 0 0 1 62.69291 663.0236 cm +1 0 0 1 62.69291 563.8236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (without risk of exiting from the Python interpreter.) Tj T* ET Q Q q -1 0 0 1 62.69291 621.0236 cm +1 0 0 1 62.69291 521.8236 cm q BT 1 0 0 1 0 26 Tm 1.422651 Tw 12 TL /F1 10 Tf 0 0 0 rg (There is a second advantage of interpreters: if the main function contains some initialization code and) Tj T* 0 Tw .454651 Tw (finalization code \() Tj /F3 10 Tf (__enter__ ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (__exit__ ) Tj /F1 10 Tf (functions\) they will be run only once at the beginning and) Tj T* 0 Tw (at the end of the interpreter loop. ) Tj /F3 10 Tf (plac.call ) Tj /F1 10 Tf (instead ignores the initialization/finalization code.) Tj T* ET Q Q q -1 0 0 1 62.69291 591.0236 cm +1 0 0 1 62.69291 491.8236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Plac easy tests) Tj T* ET Q Q q -1 0 0 1 62.69291 549.0236 cm +1 0 0 1 62.69291 449.8236 cm q BT 1 0 0 1 0 26 Tm 1.517126 Tw 12 TL /F1 10 Tf 0 0 0 rg (Writing your tests in terms of ) Tj /F3 10 Tf (Interpreter.check ) Tj /F1 10 Tf (is certainly an improvement over writing them in) Tj T* 0 Tw 1.807318 Tw (terms of ) Tj /F3 10 Tf (plac.call) Tj /F1 10 Tf (, but they are still too low-level for my taste. The ) Tj /F3 10 Tf (Interpreter ) Tj /F1 10 Tf (class provides) Tj T* 0 Tw (support for doctest-style tests, a.k.a. ) Tj /F4 10 Tf (plac easy tests) Tj /F1 10 Tf (.) Tj T* ET Q Q q -1 0 0 1 62.69291 507.0236 cm +1 0 0 1 62.69291 407.8236 cm q BT 1 0 0 1 0 26 Tm 2.142209 Tw 12 TL /F1 10 Tf 0 0 0 rg (By using plac easy tests you can cut and paste your interactive session and turn it into a runnable) Tj T* 0 Tw .519213 Tw (automatics test. Consider for instance the following file ) Tj /F3 10 Tf (ishelve.placet ) Tj /F1 10 Tf (\(the ) Tj /F3 10 Tf (.placet ) Tj /F1 10 Tf (extension is a) Tj T* 0 Tw (mnemonic for plac easy tests\):) Tj T* ET Q Q q -1 0 0 1 62.69291 329.8236 cm +1 0 0 1 62.69291 230.6236 cm q q 1 0 0 1 0 0 cm @@ -9391,19 +9443,19 @@ Q Q Q q -1 0 0 1 62.69291 273.8236 cm +1 0 0 1 62.69291 174.6236 cm q BT 1 0 0 1 0 38 Tm .697132 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice the precence of the shebang line containing the name of the ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (tool to test \(a ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (tool is just a) Tj T* 0 Tw 1.511751 Tw (Python module with a function called ) Tj /F3 10 Tf (main) Tj /F1 10 Tf (\). The shebang is ignored by the interpreter \(it looks like a) Tj T* 0 Tw .487608 Tw (comment to it\) but it is there so that external tools \(say a test runner\) can infer the plac interpreter to use) Tj T* 0 Tw (to test the file.) Tj T* ET Q Q q -1 0 0 1 62.69291 243.8236 cm +1 0 0 1 62.69291 144.6236 cm q BT 1 0 0 1 0 14 Tm 2.419984 Tw 12 TL /F1 10 Tf 0 0 0 rg (You can test ) Tj /F3 10 Tf (ishelve.placet ) Tj /F1 10 Tf (file by calling the ) Tj /F3 10 Tf (.doctest ) Tj /F1 10 Tf (method of the interpreter, as in this) Tj T* 0 Tw (example:) Tj T* ET Q Q q -1 0 0 1 62.69291 199.0393 cm +1 0 0 1 62.69291 99.83932 cm q q .988825 0 0 .988825 0 0 cm @@ -9424,18 +9476,6 @@ Q Q Q q -1 0 0 1 62.69291 155.0393 cm -q -BT 1 0 0 1 0 26 Tm 4.007109 Tw 12 TL /F1 10 Tf 0 0 0 rg (Internally ) Tj /F3 10 Tf (Interpreter.doctests ) Tj /F1 10 Tf (invokes something like ) Tj /F3 10 Tf (Interpreter.check ) Tj /F1 10 Tf (multiple times) Tj T* 0 Tw .226654 Tw (inside the same context and compare the output with the expected output: if even a check fails, the whole) Tj T* 0 Tw (test fail.) Tj T* ET -Q -Q -q -1 0 0 1 62.69291 113.0393 cm -q -BT 1 0 0 1 0 26 Tm .175868 Tw 12 TL /F1 10 Tf 0 0 0 rg (You should realize tha the easy tests supported by ) Tj /F3 10 Tf (plac ) Tj /F1 10 Tf (are ) Tj /F4 10 Tf (not ) Tj /F1 10 Tf (unittests: they are functional tests. They) Tj T* 0 Tw 1.22936 Tw (model then user interaction and the order of the operations generally matters. The single subtests in a) Tj T* 0 Tw /F3 10 Tf (.placet ) Tj /F1 10 Tf (file are not independent and it makes sense to exit immediately at the first failure.) Tj T* ET -Q -Q -q 1 0 0 1 56.69291 56.69291 cm q 0 0 0 rg @@ -9445,38 +9485,50 @@ Q endstream endobj -% 'R368': class PDFStream -368 0 obj +% 'R369': class PDFStream +369 0 obj % page stream -<< /Length 6421 >> +<< /Length 6740 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 693.0236 cm +1 0 0 1 62.69291 729.0236 cm +q +BT 1 0 0 1 0 26 Tm 4.007109 Tw 12 TL /F1 10 Tf 0 0 0 rg (Internally ) Tj /F3 10 Tf (Interpreter.doctests ) Tj /F1 10 Tf (invokes something like ) Tj /F3 10 Tf (Interpreter.check ) Tj /F1 10 Tf (multiple times) Tj T* 0 Tw .226654 Tw (inside the same context and compare the output with the expected output: if even a check fails, the whole) Tj T* 0 Tw (test fail.) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 687.0236 cm +q +BT 1 0 0 1 0 26 Tm .175868 Tw 12 TL /F1 10 Tf 0 0 0 rg (You should realize tha the easy tests supported by ) Tj /F3 10 Tf (plac ) Tj /F1 10 Tf (are ) Tj /F4 10 Tf (not ) Tj /F1 10 Tf (unittests: they are functional tests. They) Tj T* 0 Tw 1.22936 Tw (model then user interaction and the order of the operations generally matters. The single subtests in a) Tj T* 0 Tw /F3 10 Tf (.placet ) Tj /F1 10 Tf (file are not independent and it makes sense to exit immediately at the first failure.) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 609.0236 cm q BT 1 0 0 1 0 62 Tm .414431 Tw 12 TL /F1 10 Tf 0 0 0 rg (The support for doctests in ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (comes nearly for free, thanks to the ) Tj 0 0 .501961 rg (shlex ) Tj 0 0 0 rg (module in the standard library,) Tj T* 0 Tw .352765 Tw (which is able to parse simple languages as the ones you can implement with ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (. In particular, thanks to) Tj T* 0 Tw .875984 Tw 0 0 .501961 rg (shlex) Tj 0 0 0 rg (, ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is able to recognize comments \(the default comment character is ) Tj /F3 10 Tf (#) Tj /F1 10 Tf (\), escape sequences and) Tj T* 0 Tw 1.50686 Tw (more. Look at the ) Tj 0 0 .501961 rg (shlex ) Tj 0 0 0 rg (documentation if you need to customize how the language is interpreted. For) Tj T* 0 Tw 2.794985 Tw (more flexibility, it is even possible to pass to the interpreter a custom split function with signature) Tj T* 0 Tw /F3 10 Tf (split\(line, commentchar\)) Tj /F1 10 Tf (.) Tj T* ET Q Q q -1 0 0 1 62.69291 639.0236 cm +1 0 0 1 62.69291 555.0236 cm q BT 1 0 0 1 0 38 Tm .136654 Tw 12 TL /F1 10 Tf 0 0 0 rg (In addition, I have implemented from scratch some support for line number recognition, so that if a test fail) Tj T* 0 Tw .042093 Tw (you get the line number of the failing command. This is especially useful if your tests are stored in external) Tj T* 0 Tw .610898 Tw (files, even if plac easy tests does not need to be in a file: you can just pass to the ) Tj /F3 10 Tf (.doctest ) Tj /F1 10 Tf (method a) Tj T* 0 Tw (list of strings corresponding to the lines of the file.) Tj T* ET Q Q q -1 0 0 1 62.69291 609.0236 cm +1 0 0 1 62.69291 525.0236 cm q BT 1 0 0 1 0 14 Tm .653145 Tw 12 TL /F1 10 Tf 0 0 0 rg (At the present ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (does not use any code from the doctest module, but the situation may change in the) Tj T* 0 Tw (future \(it would be nice if ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (could reuse doctests directives like ELLIPSIS\).) Tj T* ET Q Q q -1 0 0 1 62.69291 579.0236 cm +1 0 0 1 62.69291 495.0236 cm q BT 1 0 0 1 0 14 Tm 1.447318 Tw 12 TL /F1 10 Tf 0 0 0 rg (It is straighforward to integrate your ) Tj /F3 10 Tf (.placet ) Tj /F1 10 Tf (tests with standard testing tools. For instance, you can) Tj T* 0 Tw (integrate your doctests with ) Tj /F3 10 Tf (nose ) Tj /F1 10 Tf (or ) Tj /F3 10 Tf (py.test ) Tj /F1 10 Tf (as follow:) Tj T* ET Q Q q -1 0 0 1 62.69291 391.8485 cm +1 0 0 1 62.69291 307.8485 cm q q .988825 0 0 .988825 0 0 cm @@ -9497,57 +9549,30 @@ Q Q Q q -1 0 0 1 62.69291 311.8485 cm +1 0 0 1 62.69291 227.8485 cm q BT 1 0 0 1 0 62 Tm 1.44811 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here you should notice that usage of ) Tj /F3 10 Tf (plac.import_main) Tj /F1 10 Tf (, an utility which is able to import the main) Tj T* 0 Tw .775703 Tw (function of the script specified in the shebang line. You can use both the full path name of the tool, or a) Tj T* 0 Tw .87686 Tw (relative path name. In this case the runner look at the environment variable ) Tj /F3 10 Tf (PLACPATH ) Tj /F1 10 Tf (and it searches) Tj T* 0 Tw 1.900651 Tw (the plac tool in the directories specified there \() Tj /F3 10 Tf (PLACPATH ) Tj /F1 10 Tf (is just a string containing directory names) Tj T* 0 Tw .56332 Tw (separated by colons\). If the variable ) Tj /F3 10 Tf (PLACPATH ) Tj /F1 10 Tf (is not defined, it just looks in the current directory. If the) Tj T* 0 Tw (plac tool is not found, an ) Tj /F3 10 Tf (ImportError ) Tj /F1 10 Tf (is raised.) Tj T* ET Q Q q -1 0 0 1 62.69291 281.8485 cm +1 0 0 1 62.69291 197.8485 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Plac batch scripts) Tj T* ET Q Q q -1 0 0 1 62.69291 239.8485 cm +1 0 0 1 62.69291 155.8485 cm q BT 1 0 0 1 0 26 Tm .772093 Tw 12 TL /F1 10 Tf 0 0 0 rg (It is pretty easy to realize that an interactive interpreter can also be used to run batch scripts: instead of) Tj T* 0 Tw .504692 Tw (reading the commands from the console, it is enough to read the commands from a file. ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (interpreters) Tj T* 0 Tw (provide an ) Tj /F3 10 Tf (.execute ) Tj /F1 10 Tf (method to perform just that.) Tj T* ET Q Q q -1 0 0 1 62.69291 173.8485 cm +1 0 0 1 62.69291 89.84848 cm q BT 1 0 0 1 0 50 Tm .098935 Tw 12 TL /F1 10 Tf 0 0 0 rg (There is just a subtle point to notice: whereas in an interactive loop one wants to manage all exceptions, a) Tj T* 0 Tw 3.866412 Tw (batch script should not in the background in case of unexpected errors. The implementation of) Tj T* 0 Tw .103059 Tw /F3 10 Tf (Interpreter.execute ) Tj /F1 10 Tf (makes sure that any error raised by ) Tj /F3 10 Tf (plac.call ) Tj /F1 10 Tf (internally is re-raised. In other) Tj T* 0 Tw .407045 Tw (words, ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (interpreters ) Tj /F4 10 Tf (wrap the errors, but does not eat them) Tj /F1 10 Tf (: the errors are always accessible and can) Tj T* 0 Tw (be re-raised on demand.) Tj T* ET Q Q q -1 0 0 1 62.69291 143.8485 cm -q -BT 1 0 0 1 0 14 Tm 1.239318 Tw 12 TL /F1 10 Tf 0 0 0 rg (The exception is the case of invalid commands, which are skipped. Consider for instance the following) Tj T* 0 Tw (batch file, which contains a mispelled command \() Tj /F3 10 Tf (.dl ) Tj /F1 10 Tf (instead of ) Tj /F3 10 Tf (.del) Tj /F1 10 Tf (\):) Tj T* ET -Q -Q -q -1 0 0 1 62.69291 98.64848 cm -q -q -1 0 0 1 0 0 cm -q -1 0 0 1 6.6 6.6 cm -q -.662745 .662745 .662745 RG -.5 w -.960784 .960784 .862745 rg -n -6 -6 468.6898 36 re B* -Q -q -0 0 0 rg -BT 1 0 0 1 0 14 Tm /F3 10 Tf 12 TL (#!ishelve.py) Tj T* (.clear ) Tj T* ET -Q -Q -Q -Q -Q -q 1 0 0 1 56.69291 56.69291 cm q 0 0 0 rg @@ -9557,14 +9582,20 @@ Q endstream endobj -% 'R369': class PDFStream -369 0 obj +% 'R370': class PDFStream +370 0 obj % page stream -<< /Length 4398 >> +<< /Length 4637 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 691.8236 cm +1 0 0 1 62.69291 741.0236 cm +q +BT 1 0 0 1 0 14 Tm 1.239318 Tw 12 TL /F1 10 Tf 0 0 0 rg (The exception is the case of invalid commands, which are skipped. Consider for instance the following) Tj T* 0 Tw (batch file, which contains a mispelled command \() Tj /F3 10 Tf (.dl ) Tj /F1 10 Tf (instead of ) Tj /F3 10 Tf (.del) Tj /F1 10 Tf (\):) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 635.8236 cm q q 1 0 0 1 0 0 cm @@ -9574,24 +9605,24 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 72 re B* +n -6 -6 468.6898 96 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 50 Tm /F3 10 Tf 12 TL (a=1 b=2) Tj T* (.show) Tj T* (.del a) Tj T* (.dl b) Tj T* (.show) Tj T* ET +BT 1 0 0 1 0 74 Tm /F3 10 Tf 12 TL (#!ishelve.py) Tj T* (.clear ) Tj T* (a=1 b=2) Tj T* (.show) Tj T* (.del a) Tj T* (.dl b) Tj T* (.show) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 659.8236 cm +1 0 0 1 62.69291 603.8236 cm q BT 1 0 0 1 0 14 Tm 1.939461 Tw 12 TL /F1 10 Tf 0 0 0 rg (If you execute the batch file, the interpreter will print a ) Tj /F3 10 Tf (.dl: not found ) Tj /F1 10 Tf (at the ) Tj /F3 10 Tf (.dl ) Tj /F1 10 Tf (line and will) Tj T* 0 Tw (continue:) Tj T* ET Q Q q -1 0 0 1 62.69291 434.6236 cm +1 0 0 1 62.69291 378.6236 cm q q 1 0 0 1 0 0 cm @@ -9611,44 +9642,44 @@ Q Q Q q -1 0 0 1 62.69291 390.6236 cm +1 0 0 1 62.69291 334.6236 cm q BT 1 0 0 1 0 26 Tm .159988 Tw 12 TL /F1 10 Tf 0 0 0 rg (The ) Tj /F3 10 Tf (verbose ) Tj /F1 10 Tf (flag is there to show the lines which are being interpreted \(prefixed by ) Tj /F3 10 Tf (i) Tj (>) Tj /F1 10 Tf (\). This is done on) Tj T* 0 Tw 1.359988 Tw (purpose, so that you can cut and paste the output of the batch script and turn it into a ) Tj /F3 10 Tf (.placet ) Tj /F1 10 Tf (test) Tj T* 0 Tw (\(cool, isn't it?\).) Tj T* ET Q Q q -1 0 0 1 62.69291 360.6236 cm +1 0 0 1 62.69291 304.6236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Implementing subcommands) Tj T* ET Q Q q -1 0 0 1 62.69291 318.6236 cm +1 0 0 1 62.69291 262.6236 cm q BT 1 0 0 1 0 26 Tm 1.182485 Tw 12 TL /F1 10 Tf 0 0 0 rg (When I discussed the ) Tj /F3 10 Tf (ishelve ) Tj /F1 10 Tf (implementation in the ) Tj 0 0 .501961 rg (basic documentation) Tj 0 0 0 rg (, I said that it looked like a) Tj T* 0 Tw .116655 Tw (poor man implementation of an object system as a chain of elifs; I also said that ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (was able to do much) Tj T* 0 Tw (better than that. Here I will substantiate my claim.) Tj T* ET Q Q q -1 0 0 1 62.69291 276.6236 cm +1 0 0 1 62.69291 220.6236 cm q BT 1 0 0 1 0 26 Tm .89104 Tw 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is actually able to infer a set of subparsers from a generic container of commands. This is useful if) Tj T* 0 Tw 3.125814 Tw (you want to implement ) Tj /F4 10 Tf (subcommands ) Tj /F1 10 Tf (\(a familiar example of a command-line application featuring) Tj T* 0 Tw (subcommands is subversion\).) Tj T* ET Q Q q -1 0 0 1 62.69291 210.6236 cm +1 0 0 1 62.69291 154.6236 cm q BT 1 0 0 1 0 50 Tm .015868 Tw 12 TL /F1 10 Tf 0 0 0 rg (Technically a container of commands is any object with a ) Tj /F3 10 Tf (.commands ) Tj /F1 10 Tf (attribute listing a set of functions or) Tj T* 0 Tw 2.550888 Tw (methods which are valid commands. A command container may have initialization/finalization hooks) Tj T* 0 Tw 2.55664 Tw (\() Tj /F3 10 Tf (__enter__/__exit__) Tj /F1 10 Tf (\) and dispatch hooks \() Tj /F3 10 Tf (__missing__) Tj /F1 10 Tf (, invoked for invalid command names\).) Tj T* 0 Tw 2.113828 Tw (Moreover, only when using command containers ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is able to provide automatic autocompletion of) Tj T* 0 Tw (commands.) Tj T* ET Q Q q -1 0 0 1 62.69291 192.6236 cm +1 0 0 1 62.69291 136.6236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (The shelve interface can be rewritten in an object-oriented way as follows:) Tj T* ET Q Q q -1 0 0 1 62.69291 99.42362 cm +1 0 0 1 62.69291 91.42362 cm q q 1 0 0 1 0 0 cm @@ -9658,11 +9689,11 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 84 re B* +n -6 -6 468.6898 36 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 62 Tm /F3 10 Tf 12 TL (# ishelve2.py) Tj T* (import shelve, os, sys, plac) Tj T* T* (class ShelveInterface\(object\):) Tj T* ( "A minimal interface over a shelve object.") Tj T* ( commands = 'set', 'show', 'showall', 'delete') Tj T* ET +BT 1 0 0 1 0 14 Tm /F3 10 Tf 12 TL (# ishelve2.py) Tj T* (import shelve, os, sys, plac) Tj T* ET Q Q Q @@ -9678,14 +9709,14 @@ Q endstream endobj -% 'R370': class PDFStream -370 0 obj +% 'R371': class PDFStream +371 0 obj % page stream << /Length 4327 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 307.8236 cm +1 0 0 1 62.69291 259.8236 cm q q 1 0 0 1 0 0 cm @@ -9695,36 +9726,29 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 456 re B* +n -6 -6 468.6898 504 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 434 Tm /F3 10 Tf 12 TL ( @plac.annotations\() Tj T* ( configfile=\('path name of the shelve', 'option'\)\)) Tj T* ( def __init__\(self, configfile\):) Tj T* ( self.configfile = configfile or '~/conf.shelve') Tj T* ( self.fname = os.path.expanduser\(self.configfile\)) Tj T* ( self.__doc__ += '\\nOperating on %s.\\n.help to see '\\) Tj T* ( 'the available commands.\\n' % self.fname) Tj T* ( def __enter__\(self\):) Tj T* ( self.sh = shelve.open\(self.fname\)) Tj T* ( return self) Tj T* ( def __exit__\(self, etype, exc, tb\):) Tj T* ( self.sh.close\(\)) Tj T* ( def set\(self, name, value\):) Tj T* ( "set name value") Tj T* ( yield 'setting %s=%s' % \(name, value\)) Tj T* ( self.sh[name] = value) Tj T* ( def show\(self, *names\):) Tj T* ( "show given parameters") Tj T* ( for name in names:) Tj T* ( yield '%s = %s' % \(name, self.sh[name]\) # no error checking) Tj T* ( def showall\(self\):) Tj T* ( "show all parameters") Tj T* ( for name in self.sh:) Tj T* ( yield '%s = %s' % \(name, self.sh[name]\)) Tj T* ( def delete\(self, name=None\):) Tj T* ( "delete given parameter \(or everything\)") Tj T* ( if name is None:) Tj T* ( yield 'deleting everything') Tj T* ( self.sh.clear\(\)) Tj T* ( else:) Tj T* ( yield 'deleting %s' % name) Tj T* ( del self.sh[name] # no error checking) Tj T* T* (main = ShelveInterface # useful for the tests) Tj T* T* (if __name__ == '__main__':) Tj T* ( plac.Interpreter.call\(ShelveInterface\)) Tj T* ET +BT 1 0 0 1 0 482 Tm /F3 10 Tf 12 TL T* (class ShelveInterface\(object\):) Tj T* ( "A minimal interface over a shelve object.") Tj T* ( commands = 'set', 'show', 'showall', 'delete') Tj T* ( @plac.annotations\() Tj T* ( configfile=\('path name of the shelve', 'option'\)\)) Tj T* ( def __init__\(self, configfile\):) Tj T* ( self.configfile = configfile or '~/conf.shelve') Tj T* ( self.fname = os.path.expanduser\(self.configfile\)) Tj T* ( self.__doc__ += '\\nOperating on %s.\\n.help to see '\\) Tj T* ( 'the available commands.\\n' % self.fname) Tj T* ( def __enter__\(self\):) Tj T* ( self.sh = shelve.open\(self.fname\)) Tj T* ( return self) Tj T* ( def __exit__\(self, etype, exc, tb\):) Tj T* ( self.sh.close\(\)) Tj T* ( def set\(self, name, value\):) Tj T* ( "set name value") Tj T* ( yield 'setting %s=%s' % \(name, value\)) Tj T* ( self.sh[name] = value) Tj T* ( def show\(self, *names\):) Tj T* ( "show given parameters") Tj T* ( for name in names:) Tj T* ( yield '%s = %s' % \(name, self.sh[name]\) # no error checking) Tj T* ( def showall\(self\):) Tj T* ( "show all parameters") Tj T* ( for name in self.sh:) Tj T* ( yield '%s = %s' % \(name, self.sh[name]\)) Tj T* ( def delete\(self, name=None\):) Tj T* ( "delete given parameter \(or everything\)") Tj T* ( if name is None:) Tj T* ( yield 'deleting everything') Tj T* ( self.sh.clear\(\)) Tj T* ( else:) Tj T* ( yield 'deleting %s' % name) Tj T* ( del self.sh[name] # no error checking) Tj T* T* (main = ShelveInterface # useful for the tests) Tj T* T* (if __name__ == '__main__':) Tj T* ( plac.Interpreter.call\(ShelveInterface\)) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 215.8236 cm +1 0 0 1 62.69291 167.8236 cm q BT 1 0 0 1 0 74 Tm .885366 Tw 12 TL /F3 10 Tf 0 0 0 rg (plac.Interpreter ) Tj /F1 10 Tf (objects wrap context manager objects consistently. In other words, if you wrap an) Tj T* 0 Tw 2.323828 Tw (object with ) Tj /F3 10 Tf (__enter__ ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (__exit__ ) Tj /F1 10 Tf (methods, they are invoked in the right order \() Tj /F3 10 Tf (__enter__) Tj T* 0 Tw .23528 Tw /F1 10 Tf (before the interpreter loop starts and ) Tj /F3 10 Tf (__exit__ ) Tj /F1 10 Tf (after the interpreter loop ends, both in the regular and in) Tj T* 0 Tw 1.916412 Tw (the exceptional case\). In our example, the methods ) Tj /F3 10 Tf (__enter__ ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (__exit__ ) Tj /F1 10 Tf (make sure the the) Tj T* 0 Tw .339398 Tw (shelve is opened and closed correctly even in the case of exceptions. Notice that I have not implemented) Tj T* 0 Tw .814104 Tw (any error checking in the ) Tj /F3 10 Tf (show ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (delete ) Tj /F1 10 Tf (methods on purpose, to verify that ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (works correctly in) Tj T* 0 Tw (the presence of exceptions.) Tj T* ET Q Q q -1 0 0 1 62.69291 137.8236 cm +1 0 0 1 62.69291 89.82362 cm q BT 1 0 0 1 0 62 Tm 1.567126 Tw 12 TL /F1 10 Tf 0 0 0 rg (When working with command containers, ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (automatically adds two special commands to the set of) Tj T* 0 Tw 1.176136 Tw (provided commands: ) Tj /F3 10 Tf (.help ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (.last_tb) Tj /F1 10 Tf (. The ) Tj /F3 10 Tf (.help ) Tj /F1 10 Tf (command is the easier to understand: when) Tj T* 0 Tw .39811 Tw (invoked without arguments it displays the list of available commands with the same formatting of the ) Tj 0 0 .501961 rg (cmd) Tj T* 0 Tw 1.19561 Tw 0 0 0 rg (module; when invoked with the name of a command it displays the usage message for that command.) Tj T* 0 Tw 2.33686 Tw (The ) Tj /F3 10 Tf (.last_tb ) Tj /F1 10 Tf (command is useful when debugging: in case of errors, it allows you to display the) Tj T* 0 Tw (traceback of the last executed command.) Tj T* ET Q Q q -1 0 0 1 62.69291 119.8236 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is a session of usage on an Unix-like operating system:) Tj T* ET -Q -Q -q 1 0 0 1 56.69291 56.69291 cm q 0 0 0 rg @@ -9734,14 +9758,21 @@ Q endstream endobj -% 'R371': class PDFStream -371 0 obj +% 'R372': class PDFStream +372 0 obj % page stream -<< /Length 4203 >> +<< /Length 4010 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 374.0679 cm +1 0 0 1 62.69291 753.0236 cm +q +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is a session of usage on an Unix-like operating system:) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 354.0679 cm q q .773863 0 0 .773863 0 0 cm @@ -9761,25 +9792,25 @@ Q Q Q q -1 0 0 1 62.69291 342.0679 cm +1 0 0 1 62.69291 322.0679 cm q BT 1 0 0 1 0 14 Tm 2.571235 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that in interactive mode the traceback is hidden, unless you pass the ) Tj /F3 10 Tf (verbose ) Tj /F1 10 Tf (flag to the) Tj T* 0 Tw /F3 10 Tf (Interpreter.interact ) Tj /F1 10 Tf (method.) Tj T* ET Q Q q -1 0 0 1 62.69291 312.0679 cm +1 0 0 1 62.69291 292.0679 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (plac.Interpreter.call) Tj T* ET Q Q q -1 0 0 1 62.69291 270.0679 cm +1 0 0 1 62.69291 250.0679 cm q BT 1 0 0 1 0 26 Tm .10104 Tw 12 TL /F1 10 Tf 0 0 0 rg (At the core of ) Tj /F3 10 Tf (plac ) Tj /F1 10 Tf (there is the ) Tj /F3 10 Tf (call ) Tj /F1 10 Tf (function which invokes a callable with the list of arguments passed) Tj T* 0 Tw 1.238443 Tw (at the command-line \() Tj /F3 10 Tf (sys.argv[1:]) Tj /F1 10 Tf (\). Thanks to ) Tj /F3 10 Tf (plac.call ) Tj /F1 10 Tf (you can launch your module by simply) Tj T* 0 Tw (adding the lines:) Tj T* ET Q Q q -1 0 0 1 62.69291 224.8679 cm +1 0 0 1 62.69291 204.8679 cm q q 1 0 0 1 0 0 cm @@ -9800,13 +9831,13 @@ Q Q Q q -1 0 0 1 62.69291 168.8679 cm +1 0 0 1 62.69291 148.8679 cm q BT 1 0 0 1 0 38 Tm .50436 Tw 12 TL /F1 10 Tf 0 0 0 rg (Everything works fine if ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (is a simple callable performing some action; however, in many cases, one) Tj T* 0 Tw .087633 Tw (has a ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf ("function" which is a actually a factory returning a command container object. For instance, in) Tj T* 0 Tw .573318 Tw (my second shelve example the main function is the class ) Tj /F3 10 Tf (ShelveInterface) Tj /F1 10 Tf (, and the two lines needed) Tj T* 0 Tw (to run the module are a bit ugly:) Tj T* ET Q Q q -1 0 0 1 62.69291 123.6679 cm +1 0 0 1 62.69291 103.6679 cm q q 1 0 0 1 0 0 cm @@ -9827,12 +9858,6 @@ Q Q Q q -1 0 0 1 62.69291 91.66791 cm -q -BT 1 0 0 1 0 14 Tm .873988 Tw 12 TL /F1 10 Tf 0 0 0 rg (Moreover, now the program runs, but only in interactive mode, i.e. it is not possible to run it as a script. ) Tj T* 0 Tw .097882 Tw (Instead, it would be nice to be able to specify the command to execute on the command-line and have the) Tj T* 0 Tw ET -Q -Q -q 1 0 0 1 56.69291 56.69291 cm q 0 0 0 rg @@ -9842,20 +9867,20 @@ Q endstream endobj -% 'R372': class PDFStream -372 0 obj +% 'R373': class PDFStream +373 0 obj % page stream -<< /Length 4687 >> +<< /Length 4449 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 693.0236 cm +1 0 0 1 62.69291 669.0236 cm q -BT 1 0 0 1 0 62 Tm 4.08229 Tw 12 TL /F1 10 Tf 0 0 0 rg (interpreter start, execute the command and finish properly \(I mean by calling ) Tj /F3 10 Tf (__enter__ ) Tj /F1 10 Tf (and) Tj T* 0 Tw .100574 Tw /F3 10 Tf (__exit__) Tj /F1 10 Tf (\) without needing user input. Then the script could be called from a batch shell script working in) Tj T* 0 Tw 2.26816 Tw (the background. In order to provide such functionality ) Tj /F3 10 Tf (plac.Interpreter ) Tj /F1 10 Tf (provides a classmethod) Tj T* 0 Tw 1.173318 Tw (named ) Tj /F3 10 Tf (.call ) Tj /F1 10 Tf (which takes the factory, instantiates it with the arguments read from the command line,) Tj T* 0 Tw 1.517045 Tw (wraps the resulting container object as an interpreter and runs it with the rest arguments found in the) Tj T* 0 Tw (command line. Here is the code to turn the ) Tj /F3 10 Tf (ShelveInterface ) Tj /F1 10 Tf (into a script) Tj T* ET +BT 1 0 0 1 0 86 Tm .873988 Tw 12 TL /F1 10 Tf 0 0 0 rg (Moreover, now the program runs, but only in interactive mode, i.e. it is not possible to run it as a script.) Tj T* 0 Tw .097882 Tw (Instead, it would be nice to be able to specify the command to execute on the command-line and have the) Tj T* 0 Tw 4.08229 Tw (interpreter start, execute the command and finish properly \(I mean by calling ) Tj /F3 10 Tf (__enter__ ) Tj /F1 10 Tf (and) Tj T* 0 Tw .100574 Tw /F3 10 Tf (__exit__) Tj /F1 10 Tf (\) without needing user input. Then the script could be called from a batch shell script working in) Tj T* 0 Tw 2.26816 Tw (the background. In order to provide such functionality ) Tj /F3 10 Tf (plac.Interpreter ) Tj /F1 10 Tf (provides a classmethod) Tj T* 0 Tw 1.173318 Tw (named ) Tj /F3 10 Tf (.call ) Tj /F1 10 Tf (which takes the factory, instantiates it with the arguments read from the command line,) Tj T* 0 Tw 1.517045 Tw (wraps the resulting container object as an interpreter and runs it with the rest arguments found in the) Tj T* 0 Tw (command line. Here is the code to turn the ) Tj /F3 10 Tf (ShelveInterface ) Tj /F1 10 Tf (into a script) Tj T* ET Q Q q -1 0 0 1 62.69291 611.8236 cm +1 0 0 1 62.69291 587.8236 cm q q 1 0 0 1 0 0 cm @@ -9876,14 +9901,14 @@ Q Q Q q -1 0 0 1 62.69291 591.8236 cm +1 0 0 1 62.69291 567.8236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (and here are a few examples of usage:) Tj T* ET Q Q q -1 0 0 1 62.69291 378.6236 cm +1 0 0 1 62.69291 354.6236 cm q q 1 0 0 1 0 0 cm @@ -9904,13 +9929,13 @@ Q Q Q q -1 0 0 1 62.69291 346.6236 cm +1 0 0 1 62.69291 322.6236 cm q BT 1 0 0 1 0 14 Tm .079989 Tw 12 TL /F1 10 Tf 0 0 0 rg (If you pass the ) Tj /F3 10 Tf (-i ) Tj /F1 10 Tf (flag in the command line, then the script will enter in interactive mode and ask the user) Tj T* 0 Tw (for the commands to execute:) Tj T* ET Q Q q -1 0 0 1 62.69291 253.4236 cm +1 0 0 1 62.69291 229.4236 cm q q 1 0 0 1 0 0 cm @@ -9930,19 +9955,19 @@ Q Q Q q -1 0 0 1 62.69291 209.4236 cm +1 0 0 1 62.69291 185.4236 cm q BT 1 0 0 1 0 26 Tm .221417 Tw 12 TL /F1 10 Tf 0 0 0 rg (In a sense, I have closed the circle: at the beginning of this document I discussed how to turn a script into) Tj T* 0 Tw .784147 Tw (an interactive application \(the ) Tj /F3 10 Tf (shelve_interpreter.py ) Tj /F1 10 Tf (example\), whereas here I have show how to) Tj T* 0 Tw (turn an interactive application into a script.) Tj T* ET Q Q q -1 0 0 1 62.69291 191.4236 cm +1 0 0 1 62.69291 167.4236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (The complete signature of ) Tj /F3 10 Tf (plac.Interpreter.call ) Tj /F1 10 Tf (is the following:) Tj T* ET Q Q q -1 0 0 1 62.69291 134.2236 cm +1 0 0 1 62.69291 110.2236 cm q q 1 0 0 1 0 0 cm @@ -9962,12 +9987,6 @@ Q Q Q q -1 0 0 1 62.69291 90.22362 cm -q -BT 1 0 0 1 0 26 Tm 1.756651 Tw 12 TL /F1 10 Tf 0 0 0 rg (The factory must have a fixed number of positional arguments \(no default arguments, no varargs, no ) Tj T* 0 Tw 1.87881 Tw (kwargs\), otherwise a ) Tj /F3 10 Tf (TypeError ) Tj /F1 10 Tf (is raised: the reason is that we want to be able to distinguish the ) Tj T* 0 Tw .829984 Tw (command-line arguments needed to instantiate the factory from the rest arguments that must be sent to) Tj T* 0 Tw ET -Q -Q -q 1 0 0 1 56.69291 56.69291 cm q 0 0 0 rg @@ -9977,32 +9996,32 @@ Q endstream endobj -% 'R373': class PDFStream -373 0 obj +% 'R374': class PDFStream +374 0 obj % page stream -<< /Length 5046 >> +<< /Length 4955 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 729.0236 cm +1 0 0 1 62.69291 693.0236 cm q -BT 1 0 0 1 0 26 Tm 2.609984 Tw 12 TL /F1 10 Tf 0 0 0 rg (the corresponding interpreter object. It is also possible to specify a list of arguments different from) Tj T* 0 Tw .513318 Tw /F3 10 Tf (sys.argv[1:] ) Tj /F1 10 Tf (\(useful in tests\), the character to be recognized as a comment, the splitting function, the) Tj T* 0 Tw (input source and the prompt to use while in interactive mode, and a verbose flag.) Tj T* ET +BT 1 0 0 1 0 62 Tm 1.756651 Tw 12 TL /F1 10 Tf 0 0 0 rg (The factory must have a fixed number of positional arguments \(no default arguments, no varargs, no) Tj T* 0 Tw 1.87881 Tw (kwargs\), otherwise a ) Tj /F3 10 Tf (TypeError ) Tj /F1 10 Tf (is raised: the reason is that we want to be able to distinguish the) Tj T* 0 Tw .829984 Tw (command-line arguments needed to instantiate the factory from the rest arguments that must be sent to) Tj T* 0 Tw 2.609984 Tw (the corresponding interpreter object. It is also possible to specify a list of arguments different from) Tj T* 0 Tw .513318 Tw /F3 10 Tf (sys.argv[1:] ) Tj /F1 10 Tf (\(useful in tests\), the character to be recognized as a comment, the splitting function, the) Tj T* 0 Tw (input source and the prompt to use while in interactive mode, and a verbose flag.) Tj T* ET Q Q q -1 0 0 1 62.69291 699.0236 cm +1 0 0 1 62.69291 663.0236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Readline support) Tj T* ET Q Q q -1 0 0 1 62.69291 621.0236 cm +1 0 0 1 62.69291 585.0236 cm q BT 1 0 0 1 0 62 Tm 1.022485 Tw 12 TL /F1 10 Tf 0 0 0 rg (Starting from release 0.6 ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (offers full readline support. That means that if your Python was compiled) Tj T* 0 Tw 2.120697 Tw (with readline support you get autocompletion and persistent command history for free. By default all) Tj T* 0 Tw .144104 Tw (commands are autocomplete in a case sensitive way. If you want to add new words to the autocompletion) Tj T* 0 Tw .116488 Tw (set, or you want to change the location of the ) Tj /F3 10 Tf (.history ) Tj /F1 10 Tf (file, or to change the case sensitivity, the way to) Tj T* 0 Tw .18436 Tw (go is to pass a ) Tj /F3 10 Tf (plac.ReadlineInput ) Tj /F1 10 Tf (object to the interpreter. Here is an example, assuming you want) Tj T* 0 Tw (to build a database interface understanding SQL commands:) Tj T* ET Q Q q -1 0 0 1 62.69291 276.2307 cm +1 0 0 1 62.69291 240.2307 cm q q .96447 0 0 .96447 0 0 cm @@ -10022,14 +10041,14 @@ Q Q Q q -1 0 0 1 62.69291 256.2307 cm +1 0 0 1 62.69291 220.2307 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is an example of usage:) Tj T* ET Q Q q -1 0 0 1 62.69291 199.0307 cm +1 0 0 1 62.69291 163.0307 cm q q 1 0 0 1 0 0 cm @@ -10049,15 +10068,9 @@ Q Q Q q -1 0 0 1 62.69291 119.0307 cm -q -BT 1 0 0 1 0 62 Tm 1.951318 Tw 12 TL /F1 10 Tf 0 0 0 rg (You can check that entering just ) Tj /F3 10 Tf (sel ) Tj /F1 10 Tf (and pressing TAB the readline library completes the ) Tj /F3 10 Tf (SELECT) Tj T* 0 Tw .797356 Tw /F1 10 Tf (keyword for you and makes it upper case; idem for ) Tj /F3 10 Tf (FROM) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (INNER) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (JOIN ) Tj /F1 10 Tf (and even for the names of the) Tj T* 0 Tw .256235 Tw (tables. An obvious improvement is to read the names of the tables by introspecting the database: actually) Tj T* 0 Tw 1.616654 Tw (you can even read the names of the views and of the columns, and have full autocompletion. All the) Tj T* 0 Tw 2.047251 Tw (entered commands and recorded and saved in the file ) Tj /F3 10 Tf (~/.sql_interface.history ) Tj /F1 10 Tf (when exiting) Tj T* 0 Tw (from the command-line interface.) Tj T* ET -Q -Q -q -1 0 0 1 62.69291 89.03071 cm +1 0 0 1 62.69291 95.03071 cm q -BT 1 0 0 1 0 14 Tm 2.010574 Tw 12 TL /F1 10 Tf 0 0 0 rg (If the readline library is not available, my suggestion is to use the ) Tj 0 0 .501961 rg (rlwrap ) Tj 0 0 0 rg (tool which provides similar ) Tj T* 0 Tw .22561 Tw (features, at least on Unix-like platforms. ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (should also work fine on Windows with the ) Tj 0 0 .501961 rg (pyreadline ) Tj 0 0 0 rg (library) Tj T* 0 Tw ET +BT 1 0 0 1 0 50 Tm 1.951318 Tw 12 TL /F1 10 Tf 0 0 0 rg (You can check that entering just ) Tj /F3 10 Tf (sel ) Tj /F1 10 Tf (and pressing TAB the readline library completes the ) Tj /F3 10 Tf (SELECT ) Tj T* 0 Tw .797356 Tw /F1 10 Tf (keyword for you and makes it upper case; idem for ) Tj /F3 10 Tf (FROM) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (INNER) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (JOIN ) Tj /F1 10 Tf (and even for the names of the ) Tj T* 0 Tw .256235 Tw (tables. An obvious improvement is to read the names of the tables by introspecting the database: actually ) Tj T* 0 Tw 1.616654 Tw (you can even read the names of the views and of the columns, and have full autocompletion. All the ) Tj T* 0 Tw 2.047251 Tw (entered commands and recorded and saved in the file ) Tj /F3 10 Tf (~/.sql_interface.history ) Tj /F1 10 Tf (when exiting) Tj T* 0 Tw ET Q Q q @@ -10070,26 +10083,33 @@ Q endstream endobj -% 'R374': class PDFStream -374 0 obj +% 'R375': class PDFStream +375 0 obj % page stream -<< /Length 4970 >> +<< /Length 4218 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 717.0236 cm +1 0 0 1 62.69291 753.0236 cm q -BT 1 0 0 1 0 38 Tm .389989 Tw 12 TL /F1 10 Tf 0 0 0 rg (\(I do not use Windows, so this part is very little tested: I tried it only once and it worked, but your mileage) Tj T* 0 Tw 2.206457 Tw (may vary\). For people worried about licenses, I will notice that ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (uses the readline library only if) Tj T* 0 Tw .591894 Tw (available, it does not include it and it does not rely on it in any fundamental way, so that the ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (licence) Tj T* 0 Tw (does not need to be the GPL \(actually it is a BSD do-whatever-you-want-with-it licence\).) Tj T* ET +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (from the command-line interface.) Tj T* ET Q Q q 1 0 0 1 62.69291 675.0236 cm q +BT 1 0 0 1 0 62 Tm 2.010574 Tw 12 TL /F1 10 Tf 0 0 0 rg (If the readline library is not available, my suggestion is to use the ) Tj 0 0 .501961 rg (rlwrap ) Tj 0 0 0 rg (tool which provides similar) Tj T* 0 Tw .22561 Tw (features, at least on Unix-like platforms. ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (should also work fine on Windows with the ) Tj 0 0 .501961 rg (pyreadline ) Tj 0 0 0 rg (library) Tj T* 0 Tw .389989 Tw (\(I do not use Windows, so this part is very little tested: I tried it only once and it worked, but your mileage) Tj T* 0 Tw 2.206457 Tw (may vary\). For people worried about licenses, I will notice that ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (uses the readline library only if) Tj T* 0 Tw .591894 Tw (available, it does not include it and it does not rely on it in any fundamental way, so that the ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (licence) Tj T* 0 Tw (does not need to be the GPL \(actually it is a BSD do-whatever-you-want-with-it licence\).) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 633.0236 cm +q BT 1 0 0 1 0 26 Tm .187882 Tw 12 TL /F1 10 Tf 0 0 0 rg (The interactive mode of ) Tj /F3 10 Tf (plac ) Tj /F1 10 Tf (can be used as a replacement of the ) Tj 0 0 .501961 rg (cmd ) Tj 0 0 0 rg (module in the standard library. It) Tj T* 0 Tw 2.730651 Tw (is actually better than ) Tj 0 0 .501961 rg (cmd) Tj 0 0 0 rg (: for instance, the ) Tj /F3 10 Tf (.help ) Tj /F1 10 Tf (command is more powerful, since it provides) Tj T* 0 Tw (information about the arguments accepted by the given command:) Tj T* ET Q Q q -1 0 0 1 62.69291 365.8236 cm +1 0 0 1 62.69291 323.8236 cm q q 1 0 0 1 0 0 cm @@ -10109,25 +10129,25 @@ Q Q Q q -1 0 0 1 62.69291 309.8236 cm +1 0 0 1 62.69291 267.8236 cm q BT 1 0 0 1 0 38 Tm 1.959985 Tw 12 TL /F1 10 Tf 0 0 0 rg (As you can imagine, the help message is provided by the underlying ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (subparser \(there is a) Tj T* 0 Tw 2.954524 Tw (subparser for each command\). ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (commands accept options, flags, varargs, keyword arguments,) Tj T* 0 Tw .719318 Tw (arguments with defaults, arguments with a fixed number of choices, type conversion and all the features) Tj T* 0 Tw (provided of ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (which should be reimplemented from scratch using ) Tj 0 0 .501961 rg (plac) Tj 0 0 0 rg (.) Tj T* ET Q Q q -1 0 0 1 62.69291 279.8236 cm +1 0 0 1 62.69291 237.8236 cm q BT 1 0 0 1 0 14 Tm 1.78248 Tw 12 TL /F1 10 Tf 0 0 0 rg (Moreover at the moment ) Tj /F3 10 Tf (plac ) Tj /F1 10 Tf (also understands command abbreviations. However, this feature may) Tj T* 0 Tw (disappear in future releases. It was meaningful in the past, when ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (did not support readline.) Tj T* ET Q Q q -1 0 0 1 62.69291 261.8236 cm +1 0 0 1 62.69291 219.8236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (Notice that if an abbreviation is ambiguous, ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (warns you:) Tj T* ET Q Q q -1 0 0 1 62.69291 216.6236 cm +1 0 0 1 62.69291 174.6236 cm q q 1 0 0 1 0 0 cm @@ -10147,41 +10167,41 @@ Q Q Q q -1 0 0 1 62.69291 186.6236 cm +1 0 0 1 56.69291 56.69291 cm q -BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (The plac runner) Tj T* ET +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (29) Tj T* -235.3849 0 Td ET Q Q + +endstream +endobj +% 'R376': class PDFStream +376 0 obj +% page stream +<< /Length 4958 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 120.6236 cm +1 0 0 1 62.69291 747.0236 cm q -BT 1 0 0 1 0 50 Tm 1.531318 Tw 12 TL /F1 10 Tf 0 0 0 rg (The distribution of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (includes a runner script named ) Tj /F3 10 Tf (plac_runner.py) Tj /F1 10 Tf (, which will be installed in a) Tj T* 0 Tw .44748 Tw (suitable directory in your system by ) Tj 0 0 .501961 rg (distutils ) Tj 0 0 0 rg (\(say in ) Tj /F3 10 Tf (\\usr\\local\\bin\\plac_runner.py ) Tj /F1 10 Tf (in a Unix-like) Tj T* 0 Tw .680651 Tw (operative system\). The runner provides many facilities to run ) Tj /F3 10 Tf (.plac ) Tj /F1 10 Tf (scripts and ) Tj /F3 10 Tf (.placet ) Tj /F1 10 Tf (files, as well) Tj T* 0 Tw 1.47311 Tw (as Python modules containg a ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (object, which can be a function, a command container object or) Tj T* 0 Tw (even a command container class.) Tj T* ET +BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (The plac runner) Tj T* ET Q Q q -1 0 0 1 62.69291 90.62362 cm +1 0 0 1 62.69291 681.0236 cm q -BT 1 0 0 1 0 14 Tm 1.994269 Tw 12 TL /F1 10 Tf 0 0 0 rg (For instance, suppose you want to execute a script containing commands defined in the ) Tj /F3 10 Tf (ishelve2) Tj T* 0 Tw /F1 10 Tf (module like the following one:) Tj T* ET +BT 1 0 0 1 0 50 Tm 1.531318 Tw 12 TL /F1 10 Tf 0 0 0 rg (The distribution of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (includes a runner script named ) Tj /F3 10 Tf (plac_runner.py) Tj /F1 10 Tf (, which will be installed in a) Tj T* 0 Tw .44748 Tw (suitable directory in your system by ) Tj 0 0 .501961 rg (distutils ) Tj 0 0 0 rg (\(say in ) Tj /F3 10 Tf (\\usr\\local\\bin\\plac_runner.py ) Tj /F1 10 Tf (in a Unix-like) Tj T* 0 Tw .680651 Tw (operative system\). The runner provides many facilities to run ) Tj /F3 10 Tf (.plac ) Tj /F1 10 Tf (scripts and ) Tj /F3 10 Tf (.placet ) Tj /F1 10 Tf (files, as well) Tj T* 0 Tw 1.47311 Tw (as Python modules containg a ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (object, which can be a function, a command container object or) Tj T* 0 Tw (even a command container class.) Tj T* ET Q Q q -1 0 0 1 56.69291 56.69291 cm +1 0 0 1 62.69291 651.0236 cm q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (29) Tj T* -235.3849 0 Td ET +BT 1 0 0 1 0 14 Tm 1.994269 Tw 12 TL /F1 10 Tf 0 0 0 rg (For instance, suppose you want to execute a script containing commands defined in the ) Tj /F3 10 Tf (ishelve2) Tj T* 0 Tw /F1 10 Tf (module like the following one:) Tj T* ET Q Q - -endstream -endobj -% 'R375': class PDFStream -375 0 obj -% page stream -<< /Length 4210 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 703.8236 cm +1 0 0 1 62.69291 581.8236 cm q q 1 0 0 1 0 0 cm @@ -10202,13 +10222,13 @@ Q Q Q q -1 0 0 1 62.69291 635.8236 cm +1 0 0 1 62.69291 513.8236 cm q BT 1 0 0 1 0 50 Tm .575868 Tw 12 TL /F1 10 Tf 0 0 0 rg (The first line of the ) Tj /F3 10 Tf (.plac ) Tj /F1 10 Tf (script contains the name of the python module containing the plac interpreter) Tj T* 0 Tw 2.327209 Tw (and the arguments which must be passed to its main function in order to be able to instantiate an) Tj T* 0 Tw .202485 Tw (interpreter object. In this case I appended ) Tj /F3 10 Tf (:ShelveInterface ) Tj /F1 10 Tf (to the name of the module to specify the) Tj T* 0 Tw 1.030574 Tw (object that must be imported: if not specified, by default the object named 'main' is imported. The other) Tj T* 0 Tw (lines contains commands. You can run the script as follows:) Tj T* ET Q Q q -1 0 0 1 62.69291 546.6505 cm +1 0 0 1 62.69291 424.6505 cm q q .952737 0 0 .952737 0 0 cm @@ -10229,24 +10249,24 @@ Q Q Q q -1 0 0 1 62.69291 514.6505 cm +1 0 0 1 62.69291 392.6505 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 2.79186 Tw (The last command intentionally contained an error, to show that the plac runner does not eat the) Tj T* 0 Tw (traceback.) Tj T* ET Q Q q -1 0 0 1 62.69291 484.6505 cm +1 0 0 1 62.69291 362.6505 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .437633 Tw (The runner can also be used to run Python modules in interactive mode and non-interactive mode. If you) Tj T* 0 Tw (put this alias in your bashrc) Tj T* ET Q Q q -1 0 0 1 62.69291 478.6505 cm +1 0 0 1 62.69291 356.6505 cm Q q -1 0 0 1 62.69291 466.6505 cm +1 0 0 1 62.69291 344.6505 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET BT 1 0 0 1 0 2 Tm T* ET @@ -10261,16 +10281,16 @@ q Q Q q -1 0 0 1 62.69291 466.6505 cm +1 0 0 1 62.69291 344.6505 cm Q q -1 0 0 1 62.69291 436.6505 cm +1 0 0 1 62.69291 314.6505 cm q BT 1 0 0 1 0 14 Tm 2.955318 Tw 12 TL /F1 10 Tf 0 0 0 rg (\(or you define a suitable ) Tj /F3 10 Tf (plac.bat ) Tj /F1 10 Tf (script in Windows\) you can run the ) Tj /F3 10 Tf (ishelve2.py ) Tj /F1 10 Tf (script in) Tj T* 0 Tw (interactive mode as follows:) Tj T* ET Q Q q -1 0 0 1 62.69291 259.4505 cm +1 0 0 1 62.69291 137.4505 cm q q 1 0 0 1 0 0 cm @@ -10290,13 +10310,29 @@ Q Q Q q -1 0 0 1 62.69291 239.4505 cm +1 0 0 1 62.69291 117.4505 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (Now you can cut and paste the interactive session an turns into into a ) Tj /F3 10 Tf (.placet ) Tj /F1 10 Tf (file like the following:) Tj T* ET Q Q q -1 0 0 1 62.69291 110.2505 cm +1 0 0 1 56.69291 56.69291 cm +q +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (30) Tj T* -235.3849 0 Td ET +Q +Q + +endstream +endobj +% 'R377': class PDFStream +377 0 obj +% page stream +<< /Length 5435 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET +q +1 0 0 1 62.69291 643.8236 cm q q 1 0 0 1 0 0 cm @@ -10316,36 +10352,20 @@ Q Q Q q -1 0 0 1 56.69291 56.69291 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (30) Tj T* -235.3849 0 Td ET -Q -Q - -endstream -endobj -% 'R376': class PDFStream -376 0 obj -% page stream -<< /Length 5294 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET -q -1 0 0 1 62.69291 741.0236 cm +1 0 0 1 62.69291 611.8236 cm q BT 1 0 0 1 0 14 Tm 2.145697 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that the first line specifies a test database ) Tj /F3 10 Tf (~/test.shelve) Tj /F1 10 Tf (, to avoid clobbering your default) Tj T* 0 Tw (shelve. If you mispell the arguments in the first line plac will give you an ) Tj 0 0 .501961 rg (argparse ) Tj 0 0 0 rg (error message \(just try\).) Tj T* ET Q Q q -1 0 0 1 62.69291 723.0236 cm +1 0 0 1 62.69291 593.8236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (You can run placets following the shebang convention directly with the plac runner:) Tj T* ET Q Q q -1 0 0 1 62.69291 677.8236 cm +1 0 0 1 62.69291 548.6236 cm q q 1 0 0 1 0 0 cm @@ -10366,19 +10386,19 @@ Q Q Q q -1 0 0 1 62.69291 633.8236 cm +1 0 0 1 62.69291 504.6236 cm q BT 1 0 0 1 0 26 Tm .32104 Tw 12 TL /F1 10 Tf 0 0 0 rg (If you want to see the output of the tests, pass the ) Tj /F3 10 Tf (-v/--verbose ) Tj /F1 10 Tf (flag. Notice that he runner ignore the) Tj T* 0 Tw .24856 Tw (extension, so you can actually use any extension your like, but ) Tj /F4 10 Tf (it relies on the first line of the file to invoke) Tj T* 0 Tw (the corresponding plac tool with the given arguments) Tj /F1 10 Tf (.) Tj T* ET Q Q q -1 0 0 1 62.69291 603.8236 cm +1 0 0 1 62.69291 474.6236 cm q BT 1 0 0 1 0 14 Tm .537209 Tw 12 TL /F1 10 Tf 0 0 0 rg (The plac runner does not provide any test discovery facility, but you can use standard Unix tools to help.) Tj T* 0 Tw (For instance, you can run all the ) Tj /F3 10 Tf (.placet ) Tj /F1 10 Tf (files into a directory and its subdirectories as follows:) Tj T* ET Q Q q -1 0 0 1 62.69291 570.6236 cm +1 0 0 1 62.69291 441.4236 cm q q 1 0 0 1 0 0 cm @@ -10399,23 +10419,23 @@ Q Q Q q -1 0 0 1 62.69291 538.6236 cm +1 0 0 1 62.69291 409.4236 cm q BT 1 0 0 1 0 14 Tm .760988 Tw 12 TL /F1 10 Tf 0 0 0 rg (The plac runner expects the main function of your script to return a plac tool, i.e. a function or an object) Tj T* 0 Tw (with a ) Tj /F3 10 Tf (.commands ) Tj /F1 10 Tf (attribute. It this is not the case the runner gracefully exits.) Tj T* ET Q Q q -1 0 0 1 62.69291 520.6236 cm +1 0 0 1 62.69291 391.4236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (It also works in non-interactive mode, if you call it as) Tj T* ET Q Q q -1 0 0 1 62.69291 514.6236 cm +1 0 0 1 62.69291 385.4236 cm Q q -1 0 0 1 62.69291 502.6236 cm +1 0 0 1 62.69291 373.4236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET BT 1 0 0 1 0 2 Tm T* ET @@ -10430,17 +10450,17 @@ q Q Q q -1 0 0 1 62.69291 502.6236 cm +1 0 0 1 62.69291 373.4236 cm Q q -1 0 0 1 62.69291 484.6236 cm +1 0 0 1 62.69291 355.4236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is an example:) Tj T* ET Q Q q -1 0 0 1 62.69291 415.4236 cm +1 0 0 1 62.69291 286.2236 cm q q 1 0 0 1 0 0 cm @@ -10461,32 +10481,32 @@ Q Q Q q -1 0 0 1 62.69291 383.4236 cm +1 0 0 1 62.69291 254.2236 cm q BT 1 0 0 1 0 14 Tm .01561 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that in non-interactive mode the runner just invokes ) Tj /F3 10 Tf (plac.call ) Tj /F1 10 Tf (on the ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (object of the Python) Tj T* 0 Tw (module.) Tj T* ET Q Q q -1 0 0 1 62.69291 353.4236 cm +1 0 0 1 62.69291 224.2236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (A non class-based example) Tj T* ET Q Q q -1 0 0 1 62.69291 311.4236 cm +1 0 0 1 62.69291 182.2236 cm q BT 1 0 0 1 0 26 Tm .907209 Tw 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (does not force you to use classes to define command containers. Even a simple function can be a) Tj T* 0 Tw 1.796651 Tw (valid command container, it is enough to add to it a ) Tj /F3 10 Tf (.commands ) Tj /F1 10 Tf (attribute and possibly ) Tj /F3 10 Tf (__enter__) Tj T* 0 Tw /F1 10 Tf (and/or ) Tj /F3 10 Tf (__exit__ ) Tj /F1 10 Tf (attributes.) Tj T* ET Q Q q -1 0 0 1 62.69291 281.4236 cm +1 0 0 1 62.69291 152.2236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .327485 Tw (In particular, a Python module is a perfect container of commands. As an example, consider the following) Tj T* 0 Tw (module implementing a fake Version Control System:) Tj T* ET Q Q q -1 0 0 1 62.69291 92.22362 cm +1 0 0 1 62.69291 95.02362 cm q q 1 0 0 1 0 0 cm @@ -10496,11 +10516,11 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 180 re B* +n -6 -6 468.6898 48 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 158 Tm /F3 10 Tf 12 TL ("A Fake Version Control System") Tj T* T* (import plac) Tj T* T* (commands = 'checkout', 'commit', 'status') Tj T* T* (@plac.annotations\(url='url of the source code'\)) Tj T* (def checkout\(url\):) Tj T* ( "A fake checkout command") Tj T* ( return \('checkout ', url\)) Tj T* T* (@plac.annotations\(message=\('commit message', 'option'\)\)) Tj T* (def commit\(message\):) Tj T* ( "A fake commit command") Tj T* ET +BT 1 0 0 1 0 26 Tm /F3 10 Tf 12 TL ("A Fake Version Control System") Tj T* T* (import plac) Tj T* ET Q Q Q @@ -10516,14 +10536,14 @@ Q endstream endobj -% 'R377': class PDFStream -377 0 obj +% 'R378': class PDFStream +378 0 obj % page stream -<< /Length 3670 >> +<< /Length 3468 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 559.8236 cm +1 0 0 1 62.69291 427.8236 cm q q 1 0 0 1 0 0 cm @@ -10533,30 +10553,57 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 204 re B* +n -6 -6 468.6898 336 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 182 Tm /F3 10 Tf 12 TL ( return \('commit ', message\)) Tj T* T* (@plac.annotations\(quiet=\('summary information', 'flag', 'q'\)\)) Tj T* (def status\(quiet\):) Tj T* ( "A fake status command") Tj T* ( return \('status ', quiet\)) Tj T* T* (def __missing__\(name\):) Tj T* ( return 'Command %r does not exist' % name) Tj T* T* (def __exit__\(etype, exc, tb\):) Tj T* ( "Will be called automatically at the end of the call/cmdloop") Tj T* ( if etype in \(None, GeneratorExit\): # success) Tj T* ( print\('ok'\)) Tj T* T* (main = __import__\(__name__\) # the module imports itself!) Tj T* ET +BT 1 0 0 1 0 314 Tm /F3 10 Tf 12 TL T* (commands = 'checkout', 'commit', 'status') Tj T* T* (@plac.annotations\(url='url of the source code'\)) Tj T* (def checkout\(url\):) Tj T* ( "A fake checkout command") Tj T* ( return \('checkout ', url\)) Tj T* T* (@plac.annotations\(message=\('commit message', 'option'\)\)) Tj T* (def commit\(message\):) Tj T* ( "A fake commit command") Tj T* ( return \('commit ', message\)) Tj T* T* (@plac.annotations\(quiet=\('summary information', 'flag', 'q'\)\)) Tj T* (def status\(quiet\):) Tj T* ( "A fake status command") Tj T* ( return \('status ', quiet\)) Tj T* T* (def __missing__\(name\):) Tj T* ( return 'Command %r does not exist' % name) Tj T* T* (def __exit__\(etype, exc, tb\):) Tj T* ( "Will be called automatically at the end of the call/cmdloop") Tj T* ( if etype in \(None, GeneratorExit\): # success) Tj T* ( print\('ok'\)) Tj T* T* (main = __import__\(__name__\) # the module imports itself!) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 515.8236 cm +1 0 0 1 62.69291 383.8236 cm q BT 1 0 0 1 0 26 Tm .431318 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that I have defined both an ) Tj /F3 10 Tf (__exit__ ) Tj /F1 10 Tf (hook and a ) Tj /F3 10 Tf (__missing__ ) Tj /F1 10 Tf (hook, invoked for non-existing) Tj T* 0 Tw .592651 Tw (commands. The real trick here is the line ) Tj /F3 10 Tf (main = __import__\(__name__\)) Tj /F1 10 Tf (, which define ) Tj /F3 10 Tf (main ) Tj /F1 10 Tf (to be) Tj T* 0 Tw (an alias for the current module.) Tj T* ET Q Q q -1 0 0 1 62.69291 485.8236 cm +1 0 0 1 62.69291 353.8236 cm q BT 1 0 0 1 0 14 Tm 1.259986 Tw 12 TL /F1 10 Tf 0 0 0 rg (The ) Tj /F3 10 Tf (vcs ) Tj /F1 10 Tf (module does not contain an ) Tj /F3 10 Tf (if __name__ == '__main__' ) Tj /F1 10 Tf (block, but you can still run it) Tj T* 0 Tw (through the plac runner \(try ) Tj /F3 10 Tf (plac vcs.py -h) Tj /F1 10 Tf (\):) Tj T* ET Q Q q -1 0 0 1 62.69291 320.6236 cm +1 0 0 1 62.69291 188.6236 cm +q +q +1 0 0 1 0 0 cm +q +1 0 0 1 6.6 6.6 cm +q +.662745 .662745 .662745 RG +.5 w +.960784 .960784 .862745 rg +n -6 -6 468.6898 156 re B* +Q +q +0 0 0 rg +BT 1 0 0 1 0 134 Tm /F3 10 Tf 12 TL (usage: plac_runner.py vcs.py [-h] {status,commit,checkout} ...) Tj T* T* (A Fake Version Control System) Tj T* T* (optional arguments:) Tj T* ( -h, --help show this help message and exit) Tj T* T* (subcommands:) Tj T* ( {status,commit,checkout}) Tj T* ( checkout A fake checkout command) Tj T* ( commit A fake commit command) Tj T* ( status A fake status command) Tj T* ET +Q +Q +Q +Q +Q +q +1 0 0 1 62.69291 168.6236 cm +q +BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (You can get help for the subcommands by postponing ) Tj /F3 10 Tf (-h ) Tj /F1 10 Tf (after the name of the command:) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 99.42362 cm q q 1 0 0 1 0 0 cm @@ -10566,24 +10613,34 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 156 re B* +n -6 -6 468.6898 60 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 134 Tm /F3 10 Tf 12 TL (usage: plac_runner.py vcs.py [-h] {status,commit,checkout} ...) Tj T* T* (A Fake Version Control System) Tj T* T* (optional arguments:) Tj T* ( -h, --help show this help message and exit) Tj T* T* (subcommands:) Tj T* ( {status,commit,checkout}) Tj T* ( checkout A fake checkout command) Tj T* ( commit A fake commit command) Tj T* ( status A fake status command) Tj T* ET +BT 1 0 0 1 0 38 Tm /F3 10 Tf 12 TL ($ plac vcs.py status -h) Tj T* (usage: vcs.py status [-h] [-q]) Tj T* T* (A fake status command) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 300.6236 cm +1 0 0 1 56.69291 56.69291 cm q -BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (You can get help for the subcommands by postponing ) Tj /F3 10 Tf (-h ) Tj /F1 10 Tf (after the name of the command:) Tj T* ET +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (32) Tj T* -235.3849 0 Td ET Q Q + +endstream +endobj +% 'R379': class PDFStream +379 0 obj +% page stream +<< /Length 4852 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 183.4236 cm +1 0 0 1 62.69291 703.8236 cm q q 1 0 0 1 0 0 cm @@ -10593,47 +10650,31 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 108 re B* +n -6 -6 468.6898 60 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 86 Tm /F3 10 Tf 12 TL ($ plac vcs.py status -h) Tj T* (usage: vcs.py status [-h] [-q]) Tj T* T* (A fake status command) Tj T* T* (optional arguments:) Tj T* ( -h, --help show this help message and exit) Tj T* ( -q, --quiet summary information) Tj T* ET +BT 1 0 0 1 0 38 Tm /F3 10 Tf 12 TL T* (optional arguments:) Tj T* ( -h, --help show this help message and exit) Tj T* ( -q, --quiet summary information) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 151.4236 cm +1 0 0 1 62.69291 671.8236 cm q BT 1 0 0 1 0 14 Tm 2.064985 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice how the docstring of the command is automatically shown in usage message, as well as the) Tj T* 0 Tw (documentation for the sub flag ) Tj /F3 10 Tf (-q) Tj /F1 10 Tf (.) Tj T* ET Q Q q -1 0 0 1 62.69291 133.4236 cm +1 0 0 1 62.69291 653.8236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is an example of a non-interactive session:) Tj T* ET Q Q q -1 0 0 1 56.69291 56.69291 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (32) Tj T* -235.3849 0 Td ET -Q -Q - -endstream -endobj -% 'R378': class PDFStream -378 0 obj -% page stream -<< /Length 5393 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET -q -1 0 0 1 62.69291 643.8236 cm +1 0 0 1 62.69291 524.6236 cm q q 1 0 0 1 0 0 cm @@ -10654,14 +10695,14 @@ Q Q Q q -1 0 0 1 62.69291 623.8236 cm +1 0 0 1 62.69291 504.6236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (and here is an interactive session:) Tj T* ET Q Q q -1 0 0 1 62.69291 422.6236 cm +1 0 0 1 62.69291 303.4236 cm q q 1 0 0 1 0 0 cm @@ -10681,38 +10722,38 @@ Q Q Q q -1 0 0 1 62.69291 390.6236 cm +1 0 0 1 62.69291 271.4236 cm q BT 1 0 0 1 0 14 Tm 2.986905 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice the invocation of the ) Tj /F3 10 Tf (__missing__ ) Tj /F1 10 Tf (hook for non-existing commands. Notice also that the) Tj T* 0 Tw /F3 10 Tf (__exit__ ) Tj /F1 10 Tf (hook gets called only in interactive mode.) Tj T* ET Q Q q -1 0 0 1 62.69291 360.6236 cm +1 0 0 1 62.69291 241.4236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 1.614104 Tw (If the commands are completely independent, a module is a good fit for a method container. In other) Tj T* 0 Tw (situations, it is best to use a custom class.) Tj T* ET Q Q q -1 0 0 1 62.69291 330.6236 cm +1 0 0 1 62.69291 211.4236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Writing your own plac runner) Tj T* ET Q Q q -1 0 0 1 62.69291 276.6236 cm +1 0 0 1 62.69291 157.4236 cm q BT 1 0 0 1 0 38 Tm .167209 Tw 12 TL /F1 10 Tf 0 0 0 rg (The runner included in the ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (distribution is intentionally kept small \(around 50 lines of code\) so that you) Tj T* 0 Tw .081294 Tw (can study it and write your own runner if want to. If you need to go to such level of detail, you should know) Tj T* 0 Tw .42061 Tw (that the most important method of the ) Tj /F3 10 Tf (Interpreter ) Tj /F1 10 Tf (class is the ) Tj /F3 10 Tf (.send ) Tj /F1 10 Tf (method, which takes strings in) Tj T* 0 Tw (input and returns a four-tuple with attributes ) Tj /F3 10 Tf (.str) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (.etype) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (.exc ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (.tb) Tj /F1 10 Tf (:) Tj T* ET Q Q q -1 0 0 1 62.69291 270.6236 cm +1 0 0 1 62.69291 151.4236 cm Q q -1 0 0 1 62.69291 270.6236 cm +1 0 0 1 62.69291 151.4236 cm Q q -1 0 0 1 62.69291 258.6236 cm +1 0 0 1 62.69291 139.4236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -10732,10 +10773,10 @@ q Q Q q -1 0 0 1 62.69291 252.6236 cm +1 0 0 1 62.69291 133.4236 cm Q q -1 0 0 1 62.69291 240.6236 cm +1 0 0 1 62.69291 121.4236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -10755,10 +10796,10 @@ q Q Q q -1 0 0 1 62.69291 234.6236 cm +1 0 0 1 62.69291 115.4236 cm Q q -1 0 0 1 62.69291 222.6236 cm +1 0 0 1 62.69291 103.4236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -10778,10 +10819,26 @@ q Q Q q -1 0 0 1 62.69291 216.6236 cm +1 0 0 1 62.69291 97.42362 cm +Q +q +1 0 0 1 56.69291 56.69291 cm +q +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (33) Tj T* -235.3849 0 Td ET Q +Q + +endstream +endobj +% 'R380': class PDFStream +380 0 obj +% page stream +<< /Length 5029 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 204.6236 cm +1 0 0 1 62.69291 753.0236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET q @@ -10801,58 +10858,22 @@ q Q Q q -1 0 0 1 62.69291 204.6236 cm +1 0 0 1 62.69291 753.0236 cm Q q -1 0 0 1 62.69291 162.6236 cm +1 0 0 1 62.69291 711.0236 cm q BT 1 0 0 1 0 26 Tm .937485 Tw 12 TL /F1 10 Tf 0 0 0 rg (Moreover the ) Tj /F3 10 Tf (__str__ ) Tj /F1 10 Tf (representation of the output object is redefined to return the output string if the) Tj T* 0 Tw 2.686651 Tw (command was successful or the error message if the command failed \(actually it returns the error) Tj T* 0 Tw (message preceded by the name of the exception class\).) Tj T* ET Q Q q -1 0 0 1 62.69291 144.6236 cm +1 0 0 1 62.69291 693.0236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (For instance, if you send a mispelled option to the interpreter a ) Tj /F3 10 Tf (SystemExit ) Tj /F1 10 Tf (will be trapped:) Tj T* ET Q Q q -1 0 0 1 62.69291 99.42362 cm -q -q -1 0 0 1 0 0 cm -q -1 0 0 1 6.6 6.6 cm -q -.662745 .662745 .662745 RG -.5 w -.960784 .960784 .862745 rg -n -6 -6 468.6898 36 re B* -Q -q -BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf 0 0 0 rg (>) Tj (>) Tj (>) Tj ( import plac) Tj T* (>) Tj (>) Tj (>) Tj ( from ishelve import ishelve) Tj T* ET -Q -Q -Q -Q -Q -q -1 0 0 1 56.69291 56.69291 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (33) Tj T* -235.3849 0 Td ET -Q -Q - -endstream -endobj -% 'R379': class PDFStream -379 0 obj -% page stream -<< /Length 4842 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET -q -1 0 0 1 62.69291 703.8236 cm +1 0 0 1 62.69291 599.8236 cm q q 1 0 0 1 0 0 cm @@ -10862,30 +10883,30 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 60 re B* +n -6 -6 468.6898 84 re B* Q q -BT 1 0 0 1 0 38 Tm 12 TL /F3 10 Tf 0 0 0 rg (>) Tj (>) Tj (>) Tj ( with plac.Interpreter\(ishelve\) as i:) Tj T* (... print\(i.send\('.cler'\)\)) Tj T* (...) Tj T* (SystemExit: unrecognized arguments: .cler) Tj T* ET +BT 1 0 0 1 0 62 Tm 12 TL /F3 10 Tf 0 0 0 rg (>) Tj (>) Tj (>) Tj ( import plac) Tj T* (>) Tj (>) Tj (>) Tj ( from ishelve import ishelve) Tj T* (>) Tj (>) Tj (>) Tj ( with plac.Interpreter\(ishelve\) as i:) Tj T* (... print\(i.send\('.cler'\)\)) Tj T* (...) Tj T* (SystemExit: unrecognized arguments: .cler) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 671.8236 cm +1 0 0 1 62.69291 567.8236 cm q BT 1 0 0 1 0 14 Tm 2.90561 Tw 12 TL /F1 10 Tf 0 0 0 rg (It is important to invoke the ) Tj /F3 10 Tf (.send ) Tj /F1 10 Tf (method inside the context manager, otherwise you will get a) Tj T* 0 Tw /F3 10 Tf (RuntimeError) Tj /F1 10 Tf (.) Tj T* ET Q Q q -1 0 0 1 62.69291 629.8236 cm +1 0 0 1 62.69291 525.8236 cm q 0 0 0 rg BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL .29311 Tw (For instance, suppose you want to implement a graphical runner for a plac-based interpreter with two text) Tj T* 0 Tw 1.548221 Tw (widgets: one to enter the commands and one to display the results. Suppose you want to display the) Tj T* 0 Tw (errors with tracebacks in red. You will need to code something like that \(pseudocode follows\):) Tj T* ET Q Q q -1 0 0 1 62.69291 392.6236 cm +1 0 0 1 62.69291 288.6236 cm q q 1 0 0 1 0 0 cm @@ -10906,26 +10927,26 @@ Q Q Q q -1 0 0 1 62.69291 360.6236 cm +1 0 0 1 62.69291 256.6236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .102765 Tw (You can adapt the pseudocode to your GUI toolkit of choice and you can also change the file associations) Tj T* 0 Tw (in such a way that clicking on a plac tool file the graphical user interface starts.) Tj T* ET Q Q q -1 0 0 1 62.69291 330.6236 cm +1 0 0 1 62.69291 226.6236 cm q BT 1 0 0 1 0 14 Tm .259988 Tw 12 TL /F1 10 Tf 0 0 0 rg (An example of GUI program built on top of ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is given later on, in the paragraph ) Tj /F4 10 Tf (Managing the output of) Tj T* 0 Tw (concurrent commands ) Tj /F1 10 Tf (\(using Tkinter for simplicity and portability\).) Tj T* ET Q Q q -1 0 0 1 62.69291 276.6236 cm +1 0 0 1 62.69291 172.6236 cm q BT 1 0 0 1 0 38 Tm 2.090651 Tw 12 TL /F1 10 Tf 0 0 0 rg (There is a final ) Tj /F4 10 Tf (caveat) Tj /F1 10 Tf (: since the plac interpreter loop is implemented via extended generators, plac) Tj T* 0 Tw .988651 Tw (interpreters are single threaded: you will get an error if you ) Tj /F3 10 Tf (.send ) Tj /F1 10 Tf (commands from separated threads.) Tj T* 0 Tw .947882 Tw (You can circumvent the problem by using a queue. If EXIT is a sentinel value to signal exiting from the) Tj T* 0 Tw (interpreter look, you can write code like this:) Tj T* ET Q Q q -1 0 0 1 62.69291 219.4236 cm +1 0 0 1 62.69291 115.4236 cm q q 1 0 0 1 0 0 cm @@ -10946,41 +10967,41 @@ Q Q Q q -1 0 0 1 62.69291 187.4236 cm +1 0 0 1 56.69291 56.69291 cm q -BT 1 0 0 1 0 14 Tm .106098 Tw 12 TL /F1 10 Tf 0 0 0 rg (The same trick also work for processes; you could run the interpreter loop in a separate process and send) Tj T* 0 Tw (commands to it via the Queue class provided by the ) Tj 0 0 .501961 rg (multiprocessing ) Tj 0 0 0 rg (module.) Tj T* ET +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (34) Tj T* -235.3849 0 Td ET Q Q + +endstream +endobj +% 'R381': class PDFStream +381 0 obj +% page stream +<< /Length 4156 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 157.4236 cm +1 0 0 1 62.69291 741.0236 cm q -BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Long running commands) Tj T* ET +BT 1 0 0 1 0 14 Tm .106098 Tw 12 TL /F1 10 Tf 0 0 0 rg (The same trick also work for processes; you could run the interpreter loop in a separate process and send) Tj T* 0 Tw (commands to it via the Queue class provided by the ) Tj 0 0 .501961 rg (multiprocessing ) Tj 0 0 0 rg (module.) Tj T* ET Q Q q -1 0 0 1 62.69291 115.4236 cm +1 0 0 1 62.69291 711.0236 cm q -BT 1 0 0 1 0 26 Tm 1.434431 Tw 12 TL /F1 10 Tf 0 0 0 rg (As we saw, by default a ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (interpreter blocks until the command terminates. This is an issue, in the) Tj T* 0 Tw 1.201318 Tw (sense that it makes the interactive experience quite painful for long running commands. An example is) Tj T* 0 Tw (better than a thousand words, so consider the following fake importer:) Tj T* ET +BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Long running commands) Tj T* ET Q Q q -1 0 0 1 56.69291 56.69291 cm +1 0 0 1 62.69291 669.0236 cm q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (34) Tj T* -235.3849 0 Td ET +BT 1 0 0 1 0 26 Tm 1.434431 Tw 12 TL /F1 10 Tf 0 0 0 rg (As we saw, by default a ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (interpreter blocks until the command terminates. This is an issue, in the) Tj T* 0 Tw 1.201318 Tw (sense that it makes the interactive experience quite painful for long running commands. An example is) Tj T* 0 Tw (better than a thousand words, so consider the following fake importer:) Tj T* ET Q Q - -endstream -endobj -% 'R380': class PDFStream -380 0 obj -% page stream -<< /Length 4152 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 511.8236 cm +1 0 0 1 62.69291 407.8236 cm q q 1 0 0 1 0 0 cm @@ -11001,13 +11022,13 @@ Q Q Q q -1 0 0 1 62.69291 479.8236 cm +1 0 0 1 62.69291 375.8236 cm q BT 1 0 0 1 0 14 Tm 1.466457 Tw 12 TL /F1 10 Tf 0 0 0 rg (If you run the ) Tj /F3 10 Tf (import_file ) Tj /F1 10 Tf (command, you will have to wait for 200 seconds before entering a new) Tj T* 0 Tw (command:) Tj T* ET Q Q q -1 0 0 1 62.69291 338.6236 cm +1 0 0 1 62.69291 234.6236 cm q q 1 0 0 1 0 0 cm @@ -11027,29 +11048,29 @@ Q Q Q q -1 0 0 1 62.69291 294.6236 cm +1 0 0 1 62.69291 190.6236 cm q BT 1 0 0 1 0 26 Tm .96832 Tw 12 TL /F1 10 Tf 0 0 0 rg (Being unable to enter any other command is quite annoying: in such situation one would like to run the) Tj T* 0 Tw .941318 Tw (long running commands in the background, to keep the interface responsive. ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (provides two ways to) Tj T* 0 Tw (reach this goal: threads and processes.) Tj T* ET Q Q q -1 0 0 1 62.69291 264.6236 cm +1 0 0 1 62.69291 160.6236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Threaded commands) Tj T* ET Q Q q -1 0 0 1 62.69291 234.6236 cm +1 0 0 1 62.69291 130.6236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .317988 Tw (The most familiar way to execute a task in the background \(even if not necessarily the best way\) is to run) Tj T* 0 Tw (it into a separated thread. In our example it is sufficient to replace the line) Tj T* ET Q Q q -1 0 0 1 62.69291 228.6236 cm +1 0 0 1 62.69291 124.6236 cm Q q -1 0 0 1 62.69291 216.6236 cm +1 0 0 1 62.69291 112.6236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET BT 1 0 0 1 0 2 Tm T* ET @@ -11064,20 +11085,36 @@ q Q Q q -1 0 0 1 62.69291 216.6236 cm +1 0 0 1 62.69291 112.6236 cm Q q -1 0 0 1 62.69291 198.6236 cm +1 0 0 1 62.69291 94.62362 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (with) Tj T* ET Q Q q -1 0 0 1 62.69291 192.6236 cm +1 0 0 1 62.69291 88.86614 cm +Q +q +1 0 0 1 56.69291 56.69291 cm +q +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (35) Tj T* -235.3849 0 Td ET Q +Q + +endstream +endobj +% 'R382': class PDFStream +382 0 obj +% page stream +<< /Length 5064 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 180.6236 cm +1 0 0 1 62.69291 753.0236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET BT 1 0 0 1 0 2 Tm T* ET @@ -11092,16 +11129,16 @@ q Q Q q -1 0 0 1 62.69291 180.6236 cm +1 0 0 1 62.69291 753.0236 cm Q q -1 0 0 1 62.69291 150.6236 cm +1 0 0 1 62.69291 723.0236 cm q BT 1 0 0 1 0 14 Tm 1.38311 Tw 12 TL /F1 10 Tf 0 0 0 rg (to tell to the ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (interpreter that the command ) Tj /F3 10 Tf (import_file ) Tj /F1 10 Tf (should be run into a separated thread.) Tj T* 0 Tw (Here is an example session:) Tj T* ET Q Q q -1 0 0 1 62.69291 105.4236 cm +1 0 0 1 62.69291 677.8236 cm q q 1 0 0 1 0 0 cm @@ -11121,29 +11158,13 @@ Q Q Q q -1 0 0 1 56.69291 56.69291 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (35) Tj T* -235.3849 0 Td ET -Q -Q - -endstream -endobj -% 'R381': class PDFStream -381 0 obj -% page stream -<< /Length 4636 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET -q -1 0 0 1 62.69291 741.0236 cm +1 0 0 1 62.69291 645.8236 cm q BT 1 0 0 1 0 14 Tm .595777 Tw 12 TL /F1 10 Tf 0 0 0 rg (The import task started in a separated thread. You can see the progress of the task by using the special) Tj T* 0 Tw (command ) Tj /F3 10 Tf (.output) Tj /F1 10 Tf (:) Tj T* ET Q Q q -1 0 0 1 62.69291 671.8236 cm +1 0 0 1 62.69291 576.6236 cm q q 1 0 0 1 0 0 cm @@ -11163,14 +11184,14 @@ Q Q Q q -1 0 0 1 62.69291 651.8236 cm +1 0 0 1 62.69291 556.6236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (If you look after a while, you will get more lines of output:) Tj T* ET Q Q q -1 0 0 1 62.69291 558.6236 cm +1 0 0 1 62.69291 463.4236 cm q q 1 0 0 1 0 0 cm @@ -11190,14 +11211,14 @@ Q Q Q q -1 0 0 1 62.69291 538.6236 cm +1 0 0 1 62.69291 443.4236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (If you look after a time long enough, the task will be finished:) Tj T* ET Q Q q -1 0 0 1 62.69291 493.4236 cm +1 0 0 1 62.69291 398.2236 cm q q 1 0 0 1 0 0 cm @@ -11217,14 +11238,14 @@ Q Q Q q -1 0 0 1 62.69291 461.4236 cm +1 0 0 1 62.69291 366.2236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .819573 Tw (It is possible to store the output of a task into a file, to be read later \(this is useful for tasks with a large) Tj T* 0 Tw (output\):) Tj T* ET Q Q q -1 0 0 1 62.69291 416.2236 cm +1 0 0 1 62.69291 321.0236 cm q q 1 0 0 1 0 0 cm @@ -11244,20 +11265,20 @@ Q Q Q q -1 0 0 1 62.69291 384.2236 cm +1 0 0 1 62.69291 289.0236 cm q BT 1 0 0 1 0 14 Tm 1.045868 Tw 12 TL /F1 10 Tf 0 0 0 rg (You can even skip the number argument: then ) Tj /F3 10 Tf (.output ) Tj /F1 10 Tf (will the return the output of the last launched) Tj T* 0 Tw (command \(the special commands like .output do not count\).) Tj T* ET Q Q q -1 0 0 1 62.69291 366.2236 cm +1 0 0 1 62.69291 271.0236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (You can launch many tasks one after the other:) Tj T* ET Q Q q -1 0 0 1 62.69291 297.0236 cm +1 0 0 1 62.69291 201.8236 cm q q 1 0 0 1 0 0 cm @@ -11277,13 +11298,13 @@ Q Q Q q -1 0 0 1 62.69291 277.0236 cm +1 0 0 1 62.69291 181.8236 cm q BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (The ) Tj /F3 10 Tf (.list ) Tj /F1 10 Tf (command displays all the running tasks:) Tj T* ET Q Q q -1 0 0 1 62.69291 219.8236 cm +1 0 0 1 62.69291 124.6236 cm q q 1 0 0 1 0 0 cm @@ -11303,14 +11324,30 @@ Q Q Q q -1 0 0 1 62.69291 199.8236 cm +1 0 0 1 62.69291 104.6236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (It is even possible to kill a task:) Tj T* ET Q Q q -1 0 0 1 62.69291 106.6236 cm +1 0 0 1 56.69291 56.69291 cm +q +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (36) Tj T* -235.3849 0 Td ET +Q +Q + +endstream +endobj +% 'R383': class PDFStream +383 0 obj +% page stream +<< /Length 4743 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET +q +1 0 0 1 62.69291 679.8236 cm q q 1 0 0 1 0 0 cm @@ -11330,29 +11367,13 @@ Q Q Q q -1 0 0 1 56.69291 56.69291 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (36) Tj T* -235.3849 0 Td ET -Q -Q - -endstream -endobj -% 'R382': class PDFStream -382 0 obj -% page stream -<< /Length 4830 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET -q -1 0 0 1 62.69291 681.0236 cm +1 0 0 1 62.69291 587.8236 cm q BT 1 0 0 1 0 74 Tm 1.100542 Tw 12 TL /F1 10 Tf 0 0 0 rg (You should notice that since at the Python level it is impossible to kill a thread, the ) Tj /F3 10 Tf (.kill ) Tj /F1 10 Tf (commands) Tj T* 0 Tw 1.793984 Tw (works by setting the status of the task to ) Tj /F3 10 Tf (TOBEKILLED) Tj /F1 10 Tf (. Internally the generator corresponding to the) Tj T* 0 Tw .632927 Tw (command is executed in the thread and the status is checked at each iteration: when the status become) Tj T* 0 Tw 2.578443 Tw /F3 10 Tf (TOBEKILLED ) Tj /F1 10 Tf (a ) Tj /F3 10 Tf (GeneratorExit ) Tj /F1 10 Tf (exception is raised and the thread terminates \(softly, so that the) Tj T* 0 Tw 2.328651 Tw /F3 10 Tf (finally ) Tj /F1 10 Tf (clause is honored\). In our example the generator is yielding back control once every 100) Tj T* 0 Tw 1.152619 Tw (iterations, i.e. every two seconds \(not much\). In order to get a responsive interface it is a good idea to) Tj T* 0 Tw (yield more often, for instance every 10 iterations \(i.e. 5 times per second\), as in the following code:) Tj T* ET Q Q q -1 0 0 1 62.69291 395.8236 cm +1 0 0 1 62.69291 302.6236 cm q q 1 0 0 1 0 0 cm @@ -11373,29 +11394,29 @@ Q Q Q q -1 0 0 1 62.69291 365.8236 cm +1 0 0 1 62.69291 272.6236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Running commands as external processes) Tj T* ET Q Q q -1 0 0 1 62.69291 311.8236 cm +1 0 0 1 62.69291 218.6236 cm q BT 1 0 0 1 0 38 Tm 2.30686 Tw 12 TL /F1 10 Tf 0 0 0 rg (Threads are not loved much in the Python world and actually most people prefer to use processes) Tj T* 0 Tw 3.350697 Tw (instead. For this reason ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (provides the option to execute long running commands as external) Tj T* 0 Tw .632706 Tw (processes. Unfortunately the current implementation only works in Unix-like operating systems \(including) Tj T* 0 Tw (Mac OS X\) because it relies on fork via the ) Tj 0 0 .501961 rg (multiprocessing ) Tj 0 0 0 rg (module.) Tj T* ET Q Q q -1 0 0 1 62.69291 293.8236 cm +1 0 0 1 62.69291 200.6236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (In our example, to enable the feature it is sufficient to replace the line) Tj T* ET Q Q q -1 0 0 1 62.69291 287.8236 cm +1 0 0 1 62.69291 194.6236 cm Q q -1 0 0 1 62.69291 275.8236 cm +1 0 0 1 62.69291 182.6236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET BT 1 0 0 1 0 2 Tm T* ET @@ -11410,20 +11431,20 @@ q Q Q q -1 0 0 1 62.69291 275.8236 cm +1 0 0 1 62.69291 182.6236 cm Q q -1 0 0 1 62.69291 257.8236 cm +1 0 0 1 62.69291 164.6236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (with) Tj T* ET Q Q q -1 0 0 1 62.69291 251.8236 cm +1 0 0 1 62.69291 158.6236 cm Q q -1 0 0 1 62.69291 239.8236 cm +1 0 0 1 62.69291 146.6236 cm 0 0 0 rg BT /F1 10 Tf 12 TL ET BT 1 0 0 1 0 2 Tm T* ET @@ -11437,36 +11458,16 @@ q Q Q q -1 0 0 1 62.69291 239.8236 cm +1 0 0 1 62.69291 146.6236 cm Q q -1 0 0 1 62.69291 209.8236 cm +1 0 0 1 62.69291 116.6236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .772619 Tw (The user experience is exactly the same as with threads and you will not see any difference at the user) Tj T* 0 Tw (interface level:) Tj T* ET Q Q q -1 0 0 1 62.69291 92.62362 cm -q -q -1 0 0 1 0 0 cm -q -1 0 0 1 6.6 6.6 cm -q -.662745 .662745 .662745 RG -.5 w -.960784 .960784 .862745 rg -n -6 -6 468.6898 108 re B* -Q -q -BT 1 0 0 1 0 86 Tm 12 TL /F3 10 Tf 0 0 0 rg (i) Tj (>) Tj ( import_file file3) Tj T* (<) Tj (MPTask 1 [import_file file3] SUBMITTED) Tj (>) Tj T* (i) Tj (>) Tj ( .kill 1) Tj T* (<) Tj (MPTask 1 [import_file file3] RUNNING) Tj (>) Tj T* (closing the file) Tj T* (i) Tj (>) Tj ( .o 1) Tj T* (<) Tj (MPTask 1 [import_file file3] KILLED) Tj (>) Tj T* (Imported 100 lines) Tj T* ET -Q -Q -Q -Q -Q -q 1 0 0 1 56.69291 56.69291 cm q 0 0 0 rg @@ -11475,15 +11476,15 @@ Q Q endstream -endobj -% 'R383': class PDFStream -383 0 obj +endobj +% 'R384': class PDFStream +384 0 obj % page stream -<< /Length 4604 >> +<< /Length 4710 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 727.8236 cm +1 0 0 1 62.69291 631.8236 cm q q 1 0 0 1 0 0 cm @@ -11493,43 +11494,43 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 36 re B* +n -6 -6 468.6898 132 re B* Q q -BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf 0 0 0 rg (Imported 200 lines) Tj T* (i) Tj (>) Tj T* ET +BT 1 0 0 1 0 110 Tm 12 TL /F3 10 Tf 0 0 0 rg (i) Tj (>) Tj ( import_file file3) Tj T* (<) Tj (MPTask 1 [import_file file3] SUBMITTED) Tj (>) Tj T* (i) Tj (>) Tj ( .kill 1) Tj T* (<) Tj (MPTask 1 [import_file file3] RUNNING) Tj (>) Tj T* (closing the file) Tj T* (i) Tj (>) Tj ( .o 1) Tj T* (<) Tj (MPTask 1 [import_file file3] KILLED) Tj (>) Tj T* (Imported 100 lines) Tj T* (Imported 200 lines) Tj T* (i) Tj (>) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 671.8236 cm +1 0 0 1 62.69291 575.8236 cm q 0 0 0 rg BT 1 0 0 1 0 38 Tm /F1 10 Tf 12 TL 1.201318 Tw (Still, using processes is quite different than using threads: in particular, when using processes you can) Tj T* 0 Tw 2.313318 Tw (only yield pickleable values and you cannot re-raise an exception first raised in a different process,) Tj T* 0 Tw 1.445697 Tw (because traceback objects are not pickleable. Moreover, you cannot rely on automatic sharing of your) Tj T* 0 Tw (objects.) Tj T* ET Q Q q -1 0 0 1 62.69291 617.8236 cm +1 0 0 1 62.69291 521.8236 cm q BT 1 0 0 1 0 38 Tm .128935 Tw 12 TL /F1 10 Tf 0 0 0 rg (On the plus side, when using processes you do not need to worry about killing a command: they are killed) Tj T* 0 Tw .466412 Tw (immediately using a SIGTERM signal, and there is not a ) Tj /F3 10 Tf (TOBEKILLED ) Tj /F1 10 Tf (mechanism. Moreover, the killing) Tj T* 0 Tw 1.50229 Tw (is guaranteed to be soft: internally a command receiving a SIGTERM raises a ) Tj /F3 10 Tf (TerminatedProcess) Tj T* 0 Tw /F1 10 Tf (exception which is trapped in the generator loop, so that the command is closed properly.) Tj T* ET Q Q q -1 0 0 1 62.69291 587.8236 cm +1 0 0 1 62.69291 491.8236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .242927 Tw (Using processes allows to take full advantage of multicore machines and it is safer than using threads, so) Tj T* 0 Tw (it is the recommended approach unless you are working on Windows.) Tj T* ET Q Q q -1 0 0 1 62.69291 557.8236 cm +1 0 0 1 62.69291 461.8236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Managing the output of concurrent commands) Tj T* ET Q Q q -1 0 0 1 62.69291 443.8236 cm +1 0 0 1 62.69291 347.8236 cm q BT 1 0 0 1 0 98 Tm 1.895542 Tw 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (acts as a command-line task launcher and can be used as the base to build a GUI-based task) Tj T* 0 Tw .38561 Tw (launcher and task monitor. To this aim the interpreter class provides a ) Tj /F3 10 Tf (.submit ) Tj /F1 10 Tf (method which returns a) Tj T* 0 Tw 1.792339 Tw (task object and a ) Tj /F3 10 Tf (.tasks ) Tj /F1 10 Tf (method returning the list of all the tasks submitted to the interpreter. The) Tj T* 0 Tw .373516 Tw /F3 10 Tf (submit ) Tj /F1 10 Tf (method does not start the task and thus it is nonblocking. Each task has an ) Tj /F3 10 Tf (.outlist ) Tj /F1 10 Tf (attribute) Tj T* 0 Tw .106098 Tw (which is a list storing the value yielded by the generator underlying the task \(the ) Tj /F3 10 Tf (None ) Tj /F1 10 Tf (values are skipped) Tj T* 0 Tw .633318 Tw (though\): the ) Tj /F3 10 Tf (.outlist ) Tj /F1 10 Tf (grows as the task runs and more values are yielded. Accessing the ) Tj /F3 10 Tf (.outlist) Tj T* 0 Tw 1.051654 Tw /F1 10 Tf (is nonblocking and can be done freely. Finally there is a ) Tj /F3 10 Tf (.result ) Tj /F1 10 Tf (property which waits for the task to) Tj T* 0 Tw .830574 Tw (finish and returns the last yielded value or raises an exception. The code below provides an example of) Tj T* 0 Tw (how you could implement a GUI over the importer example:) Tj T* ET Q @@ -11545,11 +11546,11 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 336 re B* +n -6 -6 468.6898 240 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 314 Tm /F3 10 Tf 12 TL (from __future__ import with_statement) Tj T* (from Tkinter import *) Tj T* (from importer3 import FakeImporter) Tj T* T* (def taskwidget\(root, task, tick=500\):) Tj T* ( "A Label widget showing the output of a task every 500 ms") Tj T* ( sv = StringVar\(root\)) Tj T* ( lb = Label\(root, textvariable=sv\)) Tj T* ( def show_outlist\(\):) Tj T* ( try:) Tj T* ( out = task.outlist[-1]) Tj T* ( except IndexError: # no output yet) Tj T* ( out = '') Tj T* ( sv.set\('%s %s' % \(task, out\)\)) Tj T* ( root.after\(tick, show_outlist\)) Tj T* ( root.after\(0, show_outlist\)) Tj T* ( return lb) Tj T* T* (def monitor\(tasks\):) Tj T* ( root = Tk\(\)) Tj T* ( for task in tasks:) Tj T* ( task.run\(\)) Tj T* ( taskwidget\(root, task\).pack\(\)) Tj T* ( root.mainloop\(\)) Tj T* T* (if __name__ == '__main__':) Tj T* ( import plac) Tj T* ET +BT 1 0 0 1 0 218 Tm /F3 10 Tf 12 TL (from __future__ import with_statement) Tj T* (from Tkinter import *) Tj T* (from importer3 import FakeImporter) Tj T* T* (def taskwidget\(root, task, tick=500\):) Tj T* ( "A Label widget showing the output of a task every 500 ms") Tj T* ( sv = StringVar\(root\)) Tj T* ( lb = Label\(root, textvariable=sv\)) Tj T* ( def show_outlist\(\):) Tj T* ( try:) Tj T* ( out = task.outlist[-1]) Tj T* ( except IndexError: # no output yet) Tj T* ( out = '') Tj T* ( sv.set\('%s %s' % \(task, out\)\)) Tj T* ( root.after\(tick, show_outlist\)) Tj T* ( root.after\(0, show_outlist\)) Tj T* ( return lb) Tj T* T* (def monitor\(tasks\):) Tj T* ET Q Q Q @@ -11565,14 +11566,14 @@ Q endstream endobj -% 'R384': class PDFStream -384 0 obj +% 'R385': class PDFStream +385 0 obj % page stream -<< /Length 5571 >> +<< /Length 5316 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 715.8236 cm +1 0 0 1 62.69291 619.8236 cm q q 1 0 0 1 0 0 cm @@ -11582,30 +11583,30 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 48 re B* +n -6 -6 468.6898 144 re B* Q q 0 0 0 rg -BT 1 0 0 1 0 26 Tm /F3 10 Tf 12 TL ( with plac.Interpreter\(plac.call\(FakeImporter\)\) as i:) Tj T* ( tasks = [i.submit\('import_file f1'\), i.submit\('import_file f2'\)]) Tj T* ( monitor\(tasks\)) Tj T* ET +BT 1 0 0 1 0 122 Tm /F3 10 Tf 12 TL ( root = Tk\(\)) Tj T* ( for task in tasks:) Tj T* ( task.run\(\)) Tj T* ( taskwidget\(root, task\).pack\(\)) Tj T* ( root.mainloop\(\)) Tj T* T* (if __name__ == '__main__':) Tj T* ( import plac) Tj T* ( with plac.Interpreter\(plac.call\(FakeImporter\)\) as i:) Tj T* ( tasks = [i.submit\('import_file f1'\), i.submit\('import_file f2'\)]) Tj T* ( monitor\(tasks\)) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 685.8236 cm +1 0 0 1 62.69291 589.8236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Monitor support) Tj T* ET Q Q q -1 0 0 1 62.69291 571.8236 cm +1 0 0 1 62.69291 475.8236 cm q BT 1 0 0 1 0 98 Tm .493555 Tw 12 TL /F1 10 Tf 0 0 0 rg (Starting from release 0.8 ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (provides builtin support for monitoring the output of concurrent commands,) Tj T* 0 Tw 1.277318 Tw (at least for platforms where multiprocessing is fully supported. You can define your own monitor class,) Tj T* 0 Tw .839979 Tw (simply by inheriting from ) Tj /F3 10 Tf (plac.Monitor ) Tj /F1 10 Tf (and by overriding the methods ) Tj /F3 10 Tf (add_listener\(self, no\)) Tj /F1 10 Tf (,) Tj T* 0 Tw 2.953953 Tw /F3 10 Tf (del_listener\(self, taskno\)) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (notify_listener\(self, taskno, msg\)) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (schedule\(self,) Tj T* 0 Tw .367674 Tw (seconds, func, arg\) ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (run\(self\)) Tj /F1 10 Tf (. Then, you can a monitor object to any ) Tj /F3 10 Tf (plac.Interpreter) Tj T* 0 Tw 1.149983 Tw /F1 10 Tf (object by simply calling the ) Tj /F3 10 Tf (add_monitor ) Tj /F1 10 Tf (method. For convenience, ) Tj /F3 10 Tf (plac ) Tj /F1 10 Tf (comes with a very simple) Tj T* 0 Tw .82683 Tw /F3 10 Tf (TkMonitor ) Tj /F1 10 Tf (based on Tkinter \(I chose Tkinter because it is easy to use and it is in the standard library,) Tj T* 0 Tw .08332 Tw (but you can use any GUI\): you can just look at how the ) Tj /F3 10 Tf (TkMonitor ) Tj /F1 10 Tf (is implemented in ) Tj /F3 10 Tf (plac_tk.py ) Tj /F1 10 Tf (and) Tj T* 0 Tw (adapt it. Here is an example of usage of the ) Tj /F3 10 Tf (TkMonitor) Tj /F1 10 Tf (:) Tj T* ET Q Q q -1 0 0 1 62.69291 394.6236 cm +1 0 0 1 62.69291 298.6236 cm q q 1 0 0 1 0 0 cm @@ -11626,25 +11627,41 @@ Q Q Q q -1 0 0 1 62.69291 350.6236 cm +1 0 0 1 62.69291 254.6236 cm q BT 1 0 0 1 0 26 Tm 1.657633 Tw 12 TL /F1 10 Tf 0 0 0 rg (Try to give the ) Tj /F3 10 Tf (hello ) Tj /F1 10 Tf (command from the interactive interpreter: each time a new text widget will be) Tj T* 0 Tw 1.321235 Tw (added displaying the output of the command. Notice that if ) Tj /F3 10 Tf (Tkinter ) Tj /F1 10 Tf (is not installed correctly on your) Tj T* 0 Tw (system the ) Tj /F3 10 Tf (TkMonitor ) Tj /F1 10 Tf (class will not be available.) Tj T* ET Q Q q -1 0 0 1 62.69291 320.6236 cm +1 0 0 1 62.69291 224.6236 cm q BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Parallel computing with plac) Tj T* ET Q Q q -1 0 0 1 62.69291 206.6236 cm +1 0 0 1 62.69291 110.6236 cm q BT 1 0 0 1 0 98 Tm 1.174751 Tw 12 TL /F1 10 Tf 0 0 .501961 rg (plac ) Tj 0 0 0 rg (is certainly not intended as a tool for parallel computing, but still you can use it to launch a set of) Tj T* 0 Tw .497984 Tw (commands and to collect the results, similarly to the MapReduce pattern popularized by Google. In order) Tj T* 0 Tw .669431 Tw (to give an example, I will consider the "Hello World" of parallel computing, i.e. the computation of pi with) Tj T* 0 Tw .537633 Tw (independent processes. There is a huge number of algorithms to compute pi; here I will describe a trivial) Tj T* 0 Tw .101567 Tw (one chosen for simplicity, not per efficienty. The trick is to consider the first quadrant of a circle with radius) Tj T* 0 Tw .602488 Tw (1 and to extract a number of points ) Tj /F3 10 Tf (\(x, y\) ) Tj /F1 10 Tf (with ) Tj /F3 10 Tf (x ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (y ) Tj /F1 10 Tf (random variables in the interval ) Tj /F3 10 Tf ([0,1]) Tj /F1 10 Tf (. The) Tj T* 0 Tw .928876 Tw (probability of extracting a number inside the quadrant \(i.e. with ) Tj /F3 10 Tf (x^2 + y^2 < 1) Tj /F1 10 Tf (\) is proportional to the) Tj T* 0 Tw .433145 Tw (area of the quadrant \(i.e. ) Tj /F3 10 Tf (pi/4) Tj /F1 10 Tf (\). The value of ) Tj /F3 10 Tf (pi ) Tj /F1 10 Tf (therefore can be extracted by multiplying by 4 the ratio) Tj T* 0 Tw (between the number of points in the quadrant versus the total number of points ) Tj /F3 10 Tf (N) Tj /F1 10 Tf (, for ) Tj /F3 10 Tf (N ) Tj /F1 10 Tf (large:) Tj T* ET Q Q q -1 0 0 1 62.69291 101.4236 cm +1 0 0 1 56.69291 56.69291 cm +q +0 0 0 rg +BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (39) Tj T* -235.3849 0 Td ET +Q +Q + +endstream +endobj +% 'R386': class PDFStream +386 0 obj +% page stream +<< /Length 3415 >> +stream +1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET +q +1 0 0 1 62.69291 667.8236 cm q q 1 0 0 1 0 0 cm @@ -11664,36 +11681,20 @@ Q Q Q q -1 0 0 1 56.69291 56.69291 cm -q -0 0 0 rg -BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 235.3849 0 Td (39) Tj T* -235.3849 0 Td ET -Q -Q - -endstream -endobj -% 'R385': class PDFStream -385 0 obj -% page stream -<< /Length 3219 >> -stream -1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET -q -1 0 0 1 62.69291 705.0236 cm +1 0 0 1 62.69291 599.8236 cm q 0 0 0 rg BT 1 0 0 1 0 50 Tm /F1 10 Tf 12 TL .046654 Tw (The algorithm is trivially parallelizable: if you have n CPUs, you can compute pi n times with N/n iterations,) Tj T* 0 Tw 1.122488 Tw (sum the results and divide the total by n. I have a Macbook with two cores, therefore I would expect a) Tj T* 0 Tw 2.347984 Tw (speedup factor of 2 with respect to a sequential computation. Moreover, I would expect a threaded) Tj T* 0 Tw 2.827984 Tw (computation to be even slower than a sequential computation, due to the GIL and the scheduling) Tj T* 0 Tw (overhead.) Tj T* ET Q Q q -1 0 0 1 62.69291 675.0236 cm +1 0 0 1 62.69291 569.8236 cm q BT 1 0 0 1 0 14 Tm .313984 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here is a script implementing the algorithm and working in three different modes \(parallel mode, threaded) Tj T* 0 Tw (mode and sequential mode\) depending on a ) Tj /F3 10 Tf (mode ) Tj /F1 10 Tf (option:) Tj T* ET Q Q q -1 0 0 1 62.69291 89.82362 cm +1 0 0 1 62.69291 92.62362 cm q q 1 0 0 1 0 0 cm @@ -11703,10 +11704,10 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 576 re B* +n -6 -6 468.6898 468 re B* Q q -BT 1 0 0 1 0 554 Tm 12 TL /F3 10 Tf 0 0 0 rg (from __future__ import with_statement) Tj T* (from random import random) Tj T* (import multiprocessing) Tj T* (import plac) Tj T* T* (class PiCalculator\(object\):) Tj T* ( """Compute pi in parallel with threads or processes""") Tj T* ( ) Tj T* ( @plac.annotations\() Tj T* ( npoints=\('number of integration points', 'positional', None, int\),) Tj T* ( mode=\('sequential|parallel|threaded', 'option', 'm', str, 'SPT'\)\)) Tj T* ( def __init__\(self, npoints, mode='S'\):) Tj T* ( self.npoints = npoints) Tj T* ( if mode == 'P':) Tj T* ( self.mpcommands = ['calc_pi']) Tj T* ( elif mode == 'T':) Tj T* ( self.thcommands = ['calc_pi']) Tj T* ( elif mode == 'S':) Tj T* ( self.commands = ['calc_pi']) Tj T* ( self.n_cpu = multiprocessing.cpu_count\(\)) Tj T* ( ) Tj T* ( def submit_tasks\(self\):) Tj T* ( self.i = plac.Interpreter\(self\).__enter__\(\) ) Tj T* ( return [self.i.submit\('calc_pi %d' % \(self.npoints / self.n_cpu\)\)) Tj T* ( for _ in range\(self.n_cpu\)]) Tj T* T* ( def close\(self\):) Tj T* ( self.i.close\(\)) Tj T* T* ( @plac.annotations\() Tj T* ( npoints=\('npoints', 'positional', None, int\)\)) Tj T* ( def calc_pi\(self, npoints\):) Tj T* ( counts = 0) Tj T* ( for j in xrange\(npoints\):) Tj T* ( n, r = divmod\(j, 1000000\)) Tj T* ( if r == 0:) Tj T* ( yield '%dM iterations' % n) Tj T* ( x, y = random\(\), random\(\)) Tj T* ( if x*x + y*y ) Tj (<) Tj ( 1:) Tj T* ( counts += 1) Tj T* ( yield \(4.0 * counts\)/npoints) Tj T* T* ( def run\(self\):) Tj T* ( tasks = self.i.tasks\(\)) Tj T* ( for t in tasks:) Tj T* ( t.run\(\)) Tj T* ( try:) Tj T* ET +BT 1 0 0 1 0 446 Tm 12 TL /F3 10 Tf 0 0 0 rg (from __future__ import with_statement) Tj T* (from random import random) Tj T* (import multiprocessing) Tj T* (import plac) Tj T* T* (class PiCalculator\(object\):) Tj T* ( """Compute pi in parallel with threads or processes""") Tj T* ( ) Tj T* ( @plac.annotations\() Tj T* ( npoints=\('number of integration points', 'positional', None, int\),) Tj T* ( mode=\('sequential|parallel|threaded', 'option', 'm', str, 'SPT'\)\)) Tj T* ( def __init__\(self, npoints, mode='S'\):) Tj T* ( self.npoints = npoints) Tj T* ( if mode == 'P':) Tj T* ( self.mpcommands = ['calc_pi']) Tj T* ( elif mode == 'T':) Tj T* ( self.thcommands = ['calc_pi']) Tj T* ( elif mode == 'S':) Tj T* ( self.commands = ['calc_pi']) Tj T* ( self.n_cpu = multiprocessing.cpu_count\(\)) Tj T* ( ) Tj T* ( def submit_tasks\(self\):) Tj T* ( self.i = plac.Interpreter\(self\).__enter__\(\) ) Tj T* ( return [self.i.submit\('calc_pi %d' % \(self.npoints / self.n_cpu\)\)) Tj T* ( for _ in range\(self.n_cpu\)]) Tj T* T* ( def close\(self\):) Tj T* ( self.i.close\(\)) Tj T* T* ( @plac.annotations\() Tj T* ( npoints=\('npoints', 'positional', None, int\)\)) Tj T* ( def calc_pi\(self, npoints\):) Tj T* ( counts = 0) Tj T* ( for j in xrange\(npoints\):) Tj T* ( n, r = divmod\(j, 1000000\)) Tj T* ( if r == 0:) Tj T* ( yield '%dM iterations' % n) Tj T* ( x, y = random\(\), random\(\)) Tj T* ET Q Q Q @@ -11722,14 +11723,14 @@ Q endstream endobj -% 'R386': class PDFStream -386 0 obj +% 'R387': class PDFStream +387 0 obj % page stream -<< /Length 4480 >> +<< /Length 4770 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 559.8236 cm +1 0 0 1 62.69291 451.8236 cm q q 1 0 0 1 0 0 cm @@ -11739,30 +11740,30 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 204 re B* +n -6 -6 468.6898 312 re B* Q q -BT 1 0 0 1 0 182 Tm 12 TL /F3 10 Tf 0 0 0 rg ( total = 0) Tj T* ( for task in tasks:) Tj T* ( total += task.result) Tj T* ( except: # the task was killed) Tj T* ( print tasks) Tj T* ( return) Tj T* ( return total / self.n_cpu) Tj T* T* (if __name__ == '__main__':) Tj T* ( pc = plac.call\(PiCalculator\)) Tj T* ( pc.submit_tasks\(\)) Tj T* ( try:) Tj T* ( import time; t0 = time.time\(\)) Tj T* ( print '%f in %f seconds ' % \(pc.run\(\), time.time\(\) - t0\)) Tj T* ( finally:) Tj T* ( pc.close\(\)) Tj T* ET +BT 1 0 0 1 0 290 Tm 12 TL /F3 10 Tf 0 0 0 rg ( if x*x + y*y ) Tj (<) Tj ( 1:) Tj T* ( counts += 1) Tj T* ( yield \(4.0 * counts\)/npoints) Tj T* T* ( def run\(self\):) Tj T* ( tasks = self.i.tasks\(\)) Tj T* ( for t in tasks:) Tj T* ( t.run\(\)) Tj T* ( try:) Tj T* ( total = 0) Tj T* ( for task in tasks:) Tj T* ( total += task.result) Tj T* ( except: # the task was killed) Tj T* ( print tasks) Tj T* ( return) Tj T* ( return total / self.n_cpu) Tj T* T* (if __name__ == '__main__':) Tj T* ( pc = plac.call\(PiCalculator\)) Tj T* ( pc.submit_tasks\(\)) Tj T* ( try:) Tj T* ( import time; t0 = time.time\(\)) Tj T* ( print '%f in %f seconds ' % \(pc.run\(\), time.time\(\) - t0\)) Tj T* ( finally:) Tj T* ( pc.close\(\)) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 479.8236 cm +1 0 0 1 62.69291 371.8236 cm q BT 1 0 0 1 0 62 Tm .381797 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice the ) Tj /F3 10 Tf (submit_tasks ) Tj /F1 10 Tf (method, which instantiates and initializes a ) Tj /F3 10 Tf (plac.Interpreter ) Tj /F1 10 Tf (object and) Tj T* 0 Tw 3.38152 Tw (submits a number of commands corresponding to the number of available CPUs. The ) Tj /F3 10 Tf (calc_pi) Tj T* 0 Tw 3.796651 Tw /F1 10 Tf (command yield a log message every million of interactions, just to monitor the progress of the) Tj T* 0 Tw 1.751318 Tw (computation. The ) Tj /F3 10 Tf (run ) Tj /F1 10 Tf (method starts all the submitted commands in parallel and sums the results. It) Tj T* 0 Tw 1.17104 Tw (returns the average value of ) Tj /F3 10 Tf (pi ) Tj /F1 10 Tf (after the slowest CPU has finished its job \(if the CPUs are equal and) Tj T* 0 Tw (equally busy they should finish more or less at the same time\).) Tj T* ET Q Q q -1 0 0 1 62.69291 461.8236 cm +1 0 0 1 62.69291 353.8236 cm q 0 0 0 rg BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here are the results on my old Macbook with Ubuntu 10.04 and Python 2.6, for 10 million of iterations:) Tj T* ET Q Q q -1 0 0 1 62.69291 368.6236 cm +1 0 0 1 62.69291 260.6236 cm q q 1 0 0 1 0 0 cm @@ -11783,20 +11784,20 @@ Q Q Q q -1 0 0 1 62.69291 336.6236 cm +1 0 0 1 62.69291 228.6236 cm q 0 0 0 rg BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 1.711751 Tw (As you see using processes one gets a 2x speedup indeed, where the threaded mode is some 20%) Tj T* 0 Tw (slower than the sequential mode.) Tj T* ET Q Q q -1 0 0 1 62.69291 270.6236 cm +1 0 0 1 62.69291 162.6236 cm q BT 1 0 0 1 0 50 Tm .167765 Tw 12 TL /F1 10 Tf 0 0 0 rg (Since the pattern submit a bunch of tasks, starts them and collect the results is so common, ) Tj 0 0 .501961 rg (plac ) Tj 0 0 0 rg (provides) Tj T* 0 Tw 2.487251 Tw (an utility function ) Tj /F3 10 Tf (runp\(genseq, mode='p', monitors=\(\), start=True\) ) Tj /F1 10 Tf (to start a bunch a) Tj T* 0 Tw .598876 Tw (generators and return a list of task objects. By default ) Tj /F3 10 Tf (runp ) Tj /F1 10 Tf (use processes, but you can use threads by) Tj T* 0 Tw .225542 Tw (passing ) Tj /F3 10 Tf (mode='t') Tj /F1 10 Tf (. If you do not wont to start the tasks, you can say so \() Tj /F3 10 Tf (start=False) Tj /F1 10 Tf (\). With ) Tj /F3 10 Tf (runp ) Tj /F1 10 Tf (the) Tj T* 0 Tw (parallel pi calculation becomes a one-liner:) Tj T* ET Q Q q -1 0 0 1 62.69291 238.0159 cm +1 0 0 1 62.69291 130.0159 cm q q .976496 0 0 .976496 0 0 cm @@ -11817,7 +11818,7 @@ Q Q Q q -1 0 0 1 62.69291 206.0159 cm +1 0 0 1 62.69291 98.01593 cm q BT 1 0 0 1 0 14 Tm 1.05186 Tw 12 TL /F1 10 Tf 0 0 0 rg (The file ) Tj /F3 10 Tf (test_runp ) Tj /F1 10 Tf (in the ) Tj /F3 10 Tf (doc ) Tj /F1 10 Tf (directory of the plac distribution shows another couple of examples of) Tj T* 0 Tw (usage, including how to show the results of the running computation on a ) Tj /F3 10 Tf (TkMonitor) Tj /F1 10 Tf (.) Tj T* ET Q @@ -11832,8 +11833,8 @@ Q endstream endobj -% 'R387': class PDFStream -387 0 obj +% 'R388': class PDFStream +388 0 obj % page stream << /Length 6179 >> stream @@ -12069,8 +12070,8 @@ Q endstream endobj -% 'R388': class PDFStream -388 0 obj +% 'R389': class PDFStream +389 0 obj % page stream << /Length 4337 >> stream @@ -12237,8 +12238,8 @@ Q endstream endobj -% 'R389': class PDFStream -389 0 obj +% 'R390': class PDFStream +390 0 obj % page stream << /Length 693 >> stream @@ -12259,364 +12260,364 @@ Q endstream endobj -% 'R390': class PDFPageLabels -390 0 obj +% 'R391': class PDFPageLabels +391 0 obj % Document Root << /Nums [ 0 - 391 0 R - 1 392 0 R - 2 + 1 393 0 R - 3 + 2 394 0 R - 4 + 3 395 0 R - 5 + 4 396 0 R - 6 + 5 397 0 R - 7 + 6 398 0 R - 8 + 7 399 0 R - 9 + 8 400 0 R - 10 + 9 401 0 R - 11 + 10 402 0 R - 12 + 11 403 0 R - 13 + 12 404 0 R - 14 + 13 405 0 R - 15 + 14 406 0 R - 16 + 15 407 0 R - 17 + 16 408 0 R - 18 + 17 409 0 R - 19 + 18 410 0 R - 20 + 19 411 0 R - 21 + 20 412 0 R - 22 + 21 413 0 R - 23 + 22 414 0 R - 24 + 23 415 0 R - 25 + 24 416 0 R - 26 + 25 417 0 R - 27 + 26 418 0 R - 28 + 27 419 0 R - 29 + 28 420 0 R - 30 + 29 421 0 R - 31 + 30 422 0 R - 32 + 31 423 0 R - 33 + 32 424 0 R - 34 + 33 425 0 R - 35 + 34 426 0 R - 36 + 35 427 0 R - 37 + 36 428 0 R - 38 + 37 429 0 R - 39 + 38 430 0 R - 40 + 39 431 0 R - 41 + 40 432 0 R - 42 + 41 433 0 R + 42 + 434 0 R 43 - 434 0 R ] >> -endobj -% 'R391': class PDFPageLabel -391 0 obj -% None -<< /S /D - /St 1 >> + 435 0 R ] >> endobj % 'R392': class PDFPageLabel 392 0 obj % None << /S /D - /St 2 >> + /St 1 >> endobj % 'R393': class PDFPageLabel 393 0 obj % None << /S /D - /St 3 >> + /St 2 >> endobj % 'R394': class PDFPageLabel 394 0 obj % None << /S /D - /St 4 >> + /St 3 >> endobj % 'R395': class PDFPageLabel 395 0 obj % None << /S /D - /St 5 >> + /St 4 >> endobj % 'R396': class PDFPageLabel 396 0 obj % None << /S /D - /St 6 >> + /St 5 >> endobj % 'R397': class PDFPageLabel 397 0 obj % None << /S /D - /St 7 >> + /St 6 >> endobj % 'R398': class PDFPageLabel 398 0 obj % None << /S /D - /St 8 >> + /St 7 >> endobj % 'R399': class PDFPageLabel 399 0 obj % None << /S /D - /St 9 >> + /St 8 >> endobj % 'R400': class PDFPageLabel 400 0 obj % None << /S /D - /St 10 >> + /St 9 >> endobj % 'R401': class PDFPageLabel 401 0 obj % None << /S /D - /St 11 >> + /St 10 >> endobj % 'R402': class PDFPageLabel 402 0 obj % None << /S /D - /St 12 >> + /St 11 >> endobj % 'R403': class PDFPageLabel 403 0 obj % None << /S /D - /St 13 >> + /St 12 >> endobj % 'R404': class PDFPageLabel 404 0 obj % None << /S /D - /St 14 >> + /St 13 >> endobj % 'R405': class PDFPageLabel 405 0 obj % None << /S /D - /St 15 >> + /St 14 >> endobj % 'R406': class PDFPageLabel 406 0 obj % None << /S /D - /St 16 >> + /St 15 >> endobj % 'R407': class PDFPageLabel 407 0 obj % None << /S /D - /St 17 >> + /St 16 >> endobj % 'R408': class PDFPageLabel 408 0 obj % None << /S /D - /St 18 >> + /St 17 >> endobj % 'R409': class PDFPageLabel 409 0 obj % None << /S /D - /St 19 >> + /St 18 >> endobj % 'R410': class PDFPageLabel 410 0 obj % None << /S /D - /St 20 >> + /St 19 >> endobj % 'R411': class PDFPageLabel 411 0 obj % None << /S /D - /St 21 >> + /St 20 >> endobj % 'R412': class PDFPageLabel 412 0 obj % None << /S /D - /St 22 >> + /St 21 >> endobj % 'R413': class PDFPageLabel 413 0 obj % None << /S /D - /St 23 >> + /St 22 >> endobj % 'R414': class PDFPageLabel 414 0 obj % None << /S /D - /St 24 >> + /St 23 >> endobj % 'R415': class PDFPageLabel 415 0 obj % None << /S /D - /St 25 >> + /St 24 >> endobj % 'R416': class PDFPageLabel 416 0 obj % None << /S /D - /St 26 >> + /St 25 >> endobj % 'R417': class PDFPageLabel 417 0 obj % None << /S /D - /St 27 >> + /St 26 >> endobj % 'R418': class PDFPageLabel 418 0 obj % None << /S /D - /St 28 >> + /St 27 >> endobj % 'R419': class PDFPageLabel 419 0 obj % None << /S /D - /St 29 >> + /St 28 >> endobj % 'R420': class PDFPageLabel 420 0 obj % None << /S /D - /St 30 >> + /St 29 >> endobj % 'R421': class PDFPageLabel 421 0 obj % None << /S /D - /St 31 >> + /St 30 >> endobj % 'R422': class PDFPageLabel 422 0 obj % None << /S /D - /St 32 >> + /St 31 >> endobj % 'R423': class PDFPageLabel 423 0 obj % None << /S /D - /St 33 >> + /St 32 >> endobj % 'R424': class PDFPageLabel 424 0 obj % None << /S /D - /St 34 >> + /St 33 >> endobj % 'R425': class PDFPageLabel 425 0 obj % None << /S /D - /St 35 >> + /St 34 >> endobj % 'R426': class PDFPageLabel 426 0 obj % None << /S /D - /St 36 >> + /St 35 >> endobj % 'R427': class PDFPageLabel 427 0 obj % None << /S /D - /St 37 >> + /St 36 >> endobj % 'R428': class PDFPageLabel 428 0 obj % None << /S /D - /St 38 >> + /St 37 >> endobj % 'R429': class PDFPageLabel 429 0 obj % None << /S /D - /St 39 >> + /St 38 >> endobj % 'R430': class PDFPageLabel 430 0 obj % None << /S /D - /St 40 >> + /St 39 >> endobj % 'R431': class PDFPageLabel 431 0 obj % None << /S /D - /St 41 >> + /St 40 >> endobj % 'R432': class PDFPageLabel 432 0 obj % None << /S /D - /St 42 >> + /St 41 >> endobj % 'R433': class PDFPageLabel 433 0 obj % None << /S /D - /St 43 >> + /St 42 >> endobj % 'R434': class PDFPageLabel 434 0 obj % None +<< /S /D + /St 43 >> +endobj +% 'R435': class PDFPageLabel +435 0 obj +% None << /S /D /St 44 >> endobj xref -0 435 +0 436 0000000000 65535 f 0000000113 00000 n 0000000246 00000 n @@ -12728,338 +12729,339 @@ xref 0000027160 00000 n 0000027411 00000 n 0000027665 00000 n -0000027903 00000 n -0000028244 00000 n -0000028498 00000 n -0000028752 00000 n -0000029024 00000 n -0000029365 00000 n -0000029619 00000 n -0000029909 00000 n -0000030199 00000 n -0000030453 00000 n -0000030691 00000 n -0000031036 00000 n -0000031335 00000 n -0000031589 00000 n -0000031827 00000 n -0000032158 00000 n -0000032412 00000 n -0000032666 00000 n -0000032918 00000 n -0000033170 00000 n -0000033422 00000 n -0000033676 00000 n -0000033913 00000 n -0000034279 00000 n -0000034578 00000 n -0000034832 00000 n -0000035080 00000 n -0000035344 00000 n -0000035685 00000 n -0000035939 00000 n -0000036177 00000 n -0000036508 00000 n -0000036747 00000 n -0000037068 00000 n -0000037320 00000 n -0000037559 00000 n -0000037890 00000 n -0000038143 00000 n -0000038395 00000 n -0000038647 00000 n -0000038899 00000 n -0000039153 00000 n -0000039405 00000 n -0000039657 00000 n -0000039911 00000 n -0000040165 00000 n -0000040417 00000 n -0000040671 00000 n -0000040923 00000 n -0000041176 00000 n -0000041430 00000 n -0000041698 00000 n -0000042159 00000 n -0000042413 00000 n -0000042667 00000 n -0000042949 00000 n -0000043232 00000 n -0000043486 00000 n -0000043738 00000 n -0000044056 00000 n -0000044310 00000 n -0000044599 00000 n -0000044851 00000 n -0000045103 00000 n -0000045342 00000 n -0000045773 00000 n -0000046027 00000 n -0000046281 00000 n -0000046540 00000 n -0000046797 00000 n -0000047058 00000 n -0000047310 00000 n -0000047564 00000 n -0000047822 00000 n -0000048074 00000 n -0000048332 00000 n -0000048586 00000 n -0000048839 00000 n -0000049100 00000 n -0000049354 00000 n -0000049608 00000 n -0000049862 00000 n -0000050121 00000 n -0000050375 00000 n -0000050627 00000 n -0000050881 00000 n -0000051133 00000 n -0000051385 00000 n -0000051638 00000 n -0000051892 00000 n -0000052146 00000 n -0000052400 00000 n -0000052654 00000 n -0000052937 00000 n -0000053190 00000 n -0000053480 00000 n -0000053734 00000 n -0000054045 00000 n -0000054297 00000 n -0000054549 00000 n -0000054838 00000 n -0000055090 00000 n -0000055327 00000 n -0000056008 00000 n -0000056266 00000 n -0000056520 00000 n -0000056774 00000 n -0000057028 00000 n -0000057282 00000 n -0000057536 00000 n -0000057790 00000 n -0000058035 00000 n -0000058289 00000 n -0000058543 00000 n -0000058797 00000 n -0000059051 00000 n -0000059301 00000 n -0000059727 00000 n -0000060026 00000 n -0000060265 00000 n -0000060586 00000 n -0000060840 00000 n -0000061079 00000 n -0000061410 00000 n -0000061664 00000 n -0000061926 00000 n -0000062180 00000 n -0000062443 00000 n -0000062696 00000 n -0000062959 00000 n -0000063213 00000 n -0000063467 00000 n -0000063720 00000 n -0000063958 00000 n -0000064369 00000 n -0000064634 00000 n -0000064888 00000 n -0000065142 00000 n -0000065381 00000 n -0000065732 00000 n -0000065986 00000 n -0000066240 00000 n -0000066486 00000 n -0000066812 00000 n -0000067096 00000 n -0000067395 00000 n -0000067649 00000 n -0000067907 00000 n -0000068161 00000 n -0000068414 00000 n -0000068765 00000 n -0000069019 00000 n -0000069273 00000 n -0000069534 00000 n -0000069795 00000 n -0000070047 00000 n -0000070300 00000 n -0000070552 00000 n -0000070806 00000 n -0000071060 00000 n -0000071314 00000 n -0000071568 00000 n -0000071808 00000 n -0000072224 00000 n -0000072523 00000 n -0000072775 00000 n -0000073014 00000 n -0000073330 00000 n -0000073629 00000 n -0000073867 00000 n -0000074188 00000 n -0000074442 00000 n -0000074715 00000 n -0000074954 00000 n -0000075295 00000 n -0000075549 00000 n -0000075788 00000 n -0000076104 00000 n -0000076403 00000 n -0000076657 00000 n -0000076915 00000 n -0000077246 00000 n -0000077485 00000 n -0000077806 00000 n -0000078060 00000 n -0000078299 00000 n -0000078615 00000 n -0000078914 00000 n -0000079153 00000 n -0000079474 00000 n -0000079728 00000 n -0000079967 00000 n -0000080298 00000 n -0000080537 00000 n -0000080843 00000 n -0000081128 00000 n -0000081292 00000 n -0000081542 00000 n -0000081671 00000 n -0000081925 00000 n -0000082122 00000 n -0000082336 00000 n -0000082550 00000 n -0000082776 00000 n -0000082978 00000 n -0000083187 00000 n -0000083384 00000 n -0000083587 00000 n -0000083788 00000 n -0000084006 00000 n -0000084207 00000 n -0000084421 00000 n -0000084616 00000 n -0000084814 00000 n -0000085050 00000 n -0000085230 00000 n -0000085454 00000 n -0000085664 00000 n -0000085863 00000 n -0000086065 00000 n -0000086273 00000 n -0000086478 00000 n -0000086678 00000 n -0000086877 00000 n -0000087087 00000 n -0000087300 00000 n -0000087506 00000 n -0000087708 00000 n -0000087931 00000 n -0000088158 00000 n -0000088358 00000 n -0000088571 00000 n -0000088771 00000 n -0000088963 00000 n -0000089148 00000 n -0000089686 00000 n -0000092722 00000 n -0000102452 00000 n -0000108509 00000 n -0000113028 00000 n -0000117150 00000 n -0000121123 00000 n -0000126210 00000 n -0000130590 00000 n -0000135568 00000 n -0000141800 00000 n -0000146121 00000 n -0000150491 00000 n -0000154125 00000 n -0000158494 00000 n -0000164846 00000 n -0000171516 00000 n -0000178634 00000 n -0000187360 00000 n -0000193275 00000 n -0000196910 00000 n -0000202544 00000 n -0000208686 00000 n -0000215208 00000 n -0000219707 00000 n -0000224135 00000 n -0000228439 00000 n -0000233227 00000 n -0000238374 00000 n -0000243445 00000 n -0000247756 00000 n -0000253151 00000 n -0000256922 00000 n -0000262416 00000 n -0000267359 00000 n -0000271612 00000 n -0000276349 00000 n -0000281280 00000 n -0000285985 00000 n -0000291657 00000 n -0000294977 00000 n -0000299558 00000 n -0000305838 00000 n -0000310276 00000 n -0000311073 00000 n -0000311805 00000 n -0000311884 00000 n -0000311963 00000 n -0000312042 00000 n -0000312121 00000 n -0000312200 00000 n -0000312279 00000 n -0000312358 00000 n -0000312437 00000 n -0000312516 00000 n -0000312596 00000 n -0000312676 00000 n -0000312756 00000 n -0000312836 00000 n -0000312916 00000 n -0000312996 00000 n -0000313076 00000 n -0000313156 00000 n -0000313236 00000 n -0000313316 00000 n -0000313396 00000 n -0000313476 00000 n -0000313556 00000 n -0000313636 00000 n -0000313716 00000 n -0000313796 00000 n -0000313876 00000 n -0000313956 00000 n -0000314036 00000 n -0000314116 00000 n -0000314196 00000 n -0000314276 00000 n -0000314356 00000 n -0000314436 00000 n -0000314516 00000 n -0000314596 00000 n -0000314676 00000 n -0000314756 00000 n -0000314836 00000 n -0000314916 00000 n -0000314996 00000 n -0000315076 00000 n -0000315156 00000 n -0000315236 00000 n +0000027919 00000 n +0000028157 00000 n +0000028508 00000 n +0000028762 00000 n +0000029016 00000 n +0000029290 00000 n +0000029631 00000 n +0000029885 00000 n +0000030175 00000 n +0000030465 00000 n +0000030719 00000 n +0000030957 00000 n +0000031302 00000 n +0000031601 00000 n +0000031855 00000 n +0000032093 00000 n +0000032424 00000 n +0000032678 00000 n +0000032932 00000 n +0000033184 00000 n +0000033436 00000 n +0000033688 00000 n +0000033942 00000 n +0000034179 00000 n +0000034545 00000 n +0000034844 00000 n +0000035098 00000 n +0000035346 00000 n +0000035610 00000 n +0000035951 00000 n +0000036205 00000 n +0000036443 00000 n +0000036774 00000 n +0000037013 00000 n +0000037334 00000 n +0000037586 00000 n +0000037825 00000 n +0000038156 00000 n +0000038409 00000 n +0000038661 00000 n +0000038913 00000 n +0000039165 00000 n +0000039419 00000 n +0000039671 00000 n +0000039923 00000 n +0000040177 00000 n +0000040431 00000 n +0000040683 00000 n +0000040922 00000 n +0000041343 00000 n +0000041595 00000 n +0000041848 00000 n +0000042102 00000 n +0000042385 00000 n +0000042639 00000 n +0000042893 00000 n +0000043175 00000 n +0000043458 00000 n +0000043712 00000 n +0000043964 00000 n +0000044282 00000 n +0000044536 00000 n +0000044825 00000 n +0000045062 00000 n +0000045513 00000 n +0000045765 00000 n +0000046019 00000 n +0000046273 00000 n +0000046527 00000 n +0000046786 00000 n +0000047043 00000 n +0000047304 00000 n +0000047556 00000 n +0000047810 00000 n +0000048068 00000 n +0000048320 00000 n +0000048578 00000 n +0000048832 00000 n +0000049085 00000 n +0000049346 00000 n +0000049600 00000 n +0000049854 00000 n +0000050108 00000 n +0000050367 00000 n +0000050621 00000 n +0000050873 00000 n +0000051127 00000 n +0000051379 00000 n +0000051631 00000 n +0000051884 00000 n +0000052138 00000 n +0000052392 00000 n +0000052646 00000 n +0000052900 00000 n +0000053183 00000 n +0000053436 00000 n +0000053726 00000 n +0000053980 00000 n +0000054291 00000 n +0000054543 00000 n +0000054780 00000 n +0000055451 00000 n +0000055740 00000 n +0000055992 00000 n +0000056244 00000 n +0000056502 00000 n +0000056756 00000 n +0000057010 00000 n +0000057264 00000 n +0000057518 00000 n +0000057772 00000 n +0000058026 00000 n +0000058271 00000 n +0000058525 00000 n +0000058779 00000 n +0000059033 00000 n +0000059287 00000 n +0000059537 00000 n +0000059993 00000 n +0000060292 00000 n +0000060531 00000 n +0000060852 00000 n +0000061106 00000 n +0000061345 00000 n +0000061676 00000 n +0000061930 00000 n +0000062192 00000 n +0000062446 00000 n +0000062709 00000 n +0000062962 00000 n +0000063225 00000 n +0000063479 00000 n +0000063733 00000 n +0000063986 00000 n +0000064224 00000 n +0000064635 00000 n +0000064900 00000 n +0000065154 00000 n +0000065408 00000 n +0000065647 00000 n +0000065998 00000 n +0000066252 00000 n +0000066506 00000 n +0000066752 00000 n +0000067078 00000 n +0000067362 00000 n +0000067661 00000 n +0000067900 00000 n +0000068221 00000 n +0000068479 00000 n +0000068733 00000 n +0000069001 00000 n +0000069255 00000 n +0000069509 00000 n +0000069770 00000 n +0000070031 00000 n +0000070283 00000 n +0000070536 00000 n +0000070788 00000 n +0000071042 00000 n +0000071296 00000 n +0000071535 00000 n +0000071976 00000 n +0000072230 00000 n +0000072470 00000 n +0000072801 00000 n +0000073053 00000 n +0000073292 00000 n +0000073608 00000 n +0000073907 00000 n +0000074145 00000 n +0000074466 00000 n +0000074705 00000 n +0000075026 00000 n +0000075299 00000 n +0000075553 00000 n +0000075792 00000 n +0000076133 00000 n +0000076372 00000 n +0000076693 00000 n +0000076947 00000 n +0000077205 00000 n +0000077536 00000 n +0000077775 00000 n +0000078096 00000 n +0000078350 00000 n +0000078589 00000 n +0000078905 00000 n +0000079204 00000 n +0000079443 00000 n +0000079764 00000 n +0000080018 00000 n +0000080257 00000 n +0000080588 00000 n +0000080827 00000 n +0000081133 00000 n +0000081418 00000 n +0000081582 00000 n +0000081832 00000 n +0000081961 00000 n +0000082215 00000 n +0000082412 00000 n +0000082626 00000 n +0000082840 00000 n +0000083066 00000 n +0000083268 00000 n +0000083477 00000 n +0000083674 00000 n +0000083877 00000 n +0000084078 00000 n +0000084296 00000 n +0000084497 00000 n +0000084711 00000 n +0000084906 00000 n +0000085104 00000 n +0000085340 00000 n +0000085520 00000 n +0000085744 00000 n +0000085954 00000 n +0000086153 00000 n +0000086355 00000 n +0000086563 00000 n +0000086768 00000 n +0000086968 00000 n +0000087167 00000 n +0000087377 00000 n +0000087590 00000 n +0000087796 00000 n +0000087998 00000 n +0000088221 00000 n +0000088448 00000 n +0000088648 00000 n +0000088861 00000 n +0000089061 00000 n +0000089253 00000 n +0000089438 00000 n +0000089976 00000 n +0000093012 00000 n +0000102742 00000 n +0000108799 00000 n +0000113063 00000 n +0000117375 00000 n +0000121349 00000 n +0000126629 00000 n +0000130788 00000 n +0000135631 00000 n +0000141986 00000 n +0000145783 00000 n +0000150421 00000 n +0000154337 00000 n +0000158511 00000 n +0000164680 00000 n +0000170719 00000 n +0000178434 00000 n +0000186685 00000 n +0000193406 00000 n +0000197213 00000 n +0000202201 00000 n +0000208418 00000 n +0000215259 00000 n +0000219997 00000 n +0000224425 00000 n +0000228536 00000 n +0000233086 00000 n +0000238142 00000 n +0000242461 00000 n +0000247520 00000 n +0000253056 00000 n +0000256625 00000 n +0000261578 00000 n +0000266708 00000 n +0000270965 00000 n +0000276130 00000 n +0000280974 00000 n +0000285785 00000 n +0000291202 00000 n +0000294718 00000 n +0000299589 00000 n +0000305869 00000 n +0000310307 00000 n +0000311104 00000 n +0000311836 00000 n +0000311915 00000 n +0000311994 00000 n +0000312073 00000 n +0000312152 00000 n +0000312231 00000 n +0000312310 00000 n +0000312389 00000 n +0000312468 00000 n +0000312547 00000 n +0000312627 00000 n +0000312707 00000 n +0000312787 00000 n +0000312867 00000 n +0000312947 00000 n +0000313027 00000 n +0000313107 00000 n +0000313187 00000 n +0000313267 00000 n +0000313347 00000 n +0000313427 00000 n +0000313507 00000 n +0000313587 00000 n +0000313667 00000 n +0000313747 00000 n +0000313827 00000 n +0000313907 00000 n +0000313987 00000 n +0000314067 00000 n +0000314147 00000 n +0000314227 00000 n +0000314307 00000 n +0000314387 00000 n +0000314467 00000 n +0000314547 00000 n +0000314627 00000 n +0000314707 00000 n +0000314787 00000 n +0000314867 00000 n +0000314947 00000 n +0000315027 00000 n +0000315107 00000 n +0000315187 00000 n +0000315267 00000 n trailer << /ID % ReportLab generated PDF document -- digest (http://www.reportlab.com) - [(5n\177\302\017\217\254\021\324m?\201/Za\032) (5n\177\302\017\217\254\021\324m?\201/Za\032)] + [(V\024\000\246}\245Be[\377c~\246\002\332\311) (V\024\000\246}\245Be[\377c~\246\002\332\311)] - /Info 307 0 R - /Root 306 0 R - /Size 435 >> + /Info 308 0 R + /Root 307 0 R + /Size 436 >> startxref -315285 +315316 %%EOF diff --git a/plac/doc/plac_core.txt b/plac/doc/plac_core.txt index 6012198..db90ec8 100644 --- a/plac/doc/plac_core.txt +++ b/plac/doc/plac_core.txt @@ -88,10 +88,7 @@ the boilerplate from nine lines to six lines: .. include:: example2.py :literal: -However saving three lines does not justify introducing the external -dependency: most people will not switch to Python 2.7, which at the time of -this writing is just about to be released, for many years. -Moreover, it just feels too complex to instantiate a class and to +However, it just feels too complex to instantiate a class and to define a parser by hand for such a trivial task. The plac_ module is designed to manage well such use cases, and it is able @@ -139,6 +136,8 @@ the usage message for free: .. include:: example5.help :literal: +Notice that by default plac_ prints the string representation +of the default values (with square brackets) in the usage message. plac_ manages transparently even the case when you want to pass a variable number of arguments. Here is an example, a script running on a database a series of SQL scripts: @@ -156,7 +155,7 @@ the command-line arguments parser to use from the signature of the main function*. This is the whole idea behind plac_: if the intent is clear, let's the machine take care of the details. -plac_ is inspired to an old Python Cookbook recipe (optionparse_), in +plac_ is inspired to an old Python Cookbook recipe of mine (optionparse_), in the sense that it delivers the programmer from the burden of writing the parser, but is less of a hack: instead of extracting the parser from the docstring of the module, it extracts it from the signature of diff --git a/plac/doc/test_plac.py b/plac/doc/test_plac.py index dda456b..5414bf1 100644 --- a/plac/doc/test_plac.py +++ b/plac/doc/test_plac.py @@ -2,7 +2,7 @@ The tests are runnable with nose, with py.test, or even as standalone script """ -import os, sys, doctest, subprocess +import os, sys, datetime, doctest, subprocess import plac sys_argv0 = sys.argv[0] @@ -10,6 +10,9 @@ os.chdir(os.path.dirname(__file__) or '.') # work in the current directory ######################## helpers ####################### +def fix_today(text): + return text.replace('YYYY-MM-DD', str(datetime.date.today())) + def expect(errclass, func, *args, **kw): try: func(*args, **kw) @@ -34,7 +37,7 @@ def check_help(name): else: # not expected for Python 3.X raise p = plac.parser_from(main) - expected = open(name + '.help').read().strip() + expected = fix_today(open(name + '.help').read()).strip() got = p.format_help().strip() assert got == expected, got finally: diff --git a/plac/plac.py b/plac/plac.py index 091550f..979a5ed 100644 --- a/plac/plac.py +++ b/plac/plac.py @@ -27,12 +27,13 @@ See doc/plac.pdf, doc/plac_adv.pdf for the documentation. """ -__version__ = '0.8.1' +__version__ = '0.8.2' from plac_core import * if sys.version >= '2.5': - from plac_ext import Interpreter, import_main, ReadlineInput, stdout, runp, Monitor + from plac_ext import (Interpreter, import_main, ReadlineInput, + stdout, runp, Monitor) try: from plac_tk import TkMonitor except ImportError: diff --git a/plac/plac_core.py b/plac/plac_core.py index ec4a562..0e12aff 100644 --- a/plac/plac_core.py +++ b/plac/plac_core.py @@ -69,7 +69,7 @@ def is_annotation(obj): and hasattr(obj, 'choices') and hasattr(obj, 'metavar')) class Annotation(object): - def __init__(self, help="", kind="positional", abbrev=None, type=None, + def __init__(self, help=None, kind="positional", abbrev=None, type=None, choices=None, metavar=None): assert kind in ('positional', 'option', 'flag'), kind if kind == "positional": @@ -245,6 +245,8 @@ class ArgumentParser(argparse.ArgumentParser): dflt = None else: dflt = default + if a.help is None: + a.help = '[%s]' % dflt if a.kind in ('option', 'flag'): if a.abbrev: shortlong = (prefix + a.abbrev, prefix*2 + name) -- cgit v1.2.1