Documentation/Source/eric5.DebugClients.Python.FlexCompleter.html

changeset 58
37f0444c3479
parent 21
b88a0e6268bd
child 409
0ea528e80202
equal deleted inserted replaced
57:81326a94fdca 58:37f0444c3479
20 </style> 20 </style>
21 </head> 21 </head>
22 <body><a NAME="top" ID="top"></a> 22 <body><a NAME="top" ID="top"></a>
23 <h1>eric5.DebugClients.Python.FlexCompleter</h1> 23 <h1>eric5.DebugClients.Python.FlexCompleter</h1>
24 <p> 24 <p>
25 &#87;&#111;&#114;&#100; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110; &#102;&#111;&#114; &#116;&#104;&#101; &#101;&#114;&#105;&#99;&#53; &#115;&#104;&#101;&#108;&#108; 25 Word completion for the eric5 shell
26 </p><p> 26 </p><p>
27 &#60;&#104;&#52;&#62;&#78;&#79;&#84;&#69; &#102;&#111;&#114; &#101;&#114;&#105;&#99;&#53; v&#97;&#114;&#105;&#97;&#110;&#116;&#60;/&#104;&#52;&#62; 27 <h4>NOTE for eric5 variant</h4>
28 </p><p> 28 </p><p>
29 &#84;&#104;&#105;&#115; v&#101;&#114;&#115;&#105;&#111;&#110; &#105;&#115; &#97; &#114;&#101;-&#105;&#109;&#112;&#108;&#101;&#109;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#111;&#102; &#70;&#108;&#101;x&#67;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; 29 This version is a re-implementation of FlexCompleter
30 &#97;&#115; &#102;&#111;&#117;&#110;&#100; &#105;&#110; &#116;&#104;&#101; &#80;y&#81;w&#116; &#112;&#97;&#99;&#107;&#97;&#103;&#101;. &#73;&#116; &#105;&#115; &#109;&#111;&#100;&#105;&#102;&#105;&#101;&#100; &#116;&#111; w&#111;&#114;&#107; w&#105;&#116;&#104; &#116;&#104;&#101; &#101;&#114;&#105;&#99;&#53; &#100;&#101;&#98;&#117;&#103; 30 as found in the PyQwt package. It is modified to work with the eric5 debug
31 &#99;&#108;&#105;&#101;&#110;&#116;&#115;. 31 clients.
32 </p><p> 32 </p><p>
33 33
34 </p><p> 34 </p><p>
35 &#60;&#104;&#52;&#62;&#78;&#79;&#84;&#69; &#102;&#111;&#114; &#116;&#104;&#101; &#80;y&#81;w&#116; v&#97;&#114;&#105;&#97;&#110;&#116;&#60;/&#104;&#52;&#62; 35 <h4>NOTE for the PyQwt variant</h4>
36 </p><p> 36 </p><p>
37 &#84;&#104;&#105;&#115; v&#101;&#114;&#115;&#105;&#111;&#110; &#105;&#115; &#97; &#114;&#101;-&#105;&#109;&#112;&#108;&#101;&#109;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#111;&#102; &#70;&#108;&#101;x&#67;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; 37 This version is a re-implementation of FlexCompleter
38 w&#105;&#116;&#104; &#114;&#101;&#97;&#100;&#108;&#105;&#110;&#101; &#115;&#117;&#112;&#112;&#111;&#114;&#116; &#102;&#111;&#114; &#80;y&#81;&#116;&&#115;&#105;&#112;-&#51;.&#54; &#97;&#110;&#100; &#101;&#97;&#114;&#108;&#105;&#101;&#114;. 38 with readline support for PyQt&sip-3.6 and earlier.
39 </p><p> 39 </p><p>
40 &#70;&#117;&#108;&#108; &#114;&#101;&#97;&#100;&#108;&#105;&#110;&#101; &#115;&#117;&#112;&#112;&#111;&#114;&#116; &#105;&#115; &#112;&#114;&#101;&#115;&#101;&#110;&#116; &#105;&#110; &#80;y&#81;&#116;&&#115;&#105;&#112;-&#115;&#110;&#97;&#112;&#115;&#104;&#111;&#116;-&#50;&#48;&#48;&#51;&#48;&#53;&#51;&#49; &#97;&#110;&#100; &#108;&#97;&#116;&#101;&#114;. 40 Full readline support is present in PyQt&sip-snapshot-20030531 and later.
41 </p><p> 41 </p><p>
42 42
43 </p><p> 43 </p><p>
44 &#60;&#104;&#52;&#62;&#78;&#79;&#84;&#69; &#102;&#111;&#114; &#70;&#108;&#101;x&#67;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114;&#60;/&#104;&#52;&#62; 44 <h4>NOTE for FlexCompleter</h4>
45 </p><p> 45 </p><p>
46 &#84;&#104;&#105;&#115; v&#101;&#114;&#115;&#105;&#111;&#110; &#105;&#115; &#97; &#114;&#101;-&#105;&#109;&#112;&#108;&#101;&#109;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#111;&#102; &#114;&#108;&#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; w&#105;&#116;&#104; 46 This version is a re-implementation of rlcompleter with
47 &#115;&#101;&#108;&#101;&#99;&#116;&#97;&#98;&#108;&#101; &#110;&#97;&#109;&#101;&#115;&#112;&#97;&#99;&#101;. 47 selectable namespace.
48 </p><p> 48 </p><p>
49 &#84;&#104;&#101; &#112;&#114;&#111;&#98;&#108;&#101;&#109; w&#105;&#116;&#104; &#114;&#108;&#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; &#105;&#115; &#116;&#104;&#97;&#116; &#105;&#116;'&#115; &#104;&#97;&#114;&#100;w&#105;&#114;&#101;&#100; &#116;&#111; w&#111;&#114;&#107; w&#105;&#116;&#104; 49 The problem with rlcompleter is that it's hardwired to work with
50 &#95;&#95;&#109;&#97;&#105;&#110;&#95;&#95;.&#95;&#95;&#100;&#105;&#99;&#116;&#95;&#95;, &#97;&#110;&#100; &#105;&#110; &#115;&#111;&#109;&#101; &#99;&#97;&#115;&#101;&#115; &#111;&#110;&#101; &#109;&#97;y &#104;&#97;v&#101; '&#115;&#97;&#110;&#100;&#98;&#111;x&#101;&#100;' &#110;&#97;&#109;&#101;&#115;&#112;&#97;&#99;&#101;&#115;. &#83;&#111; 50 __main__.__dict__, and in some cases one may have 'sandboxed' namespaces. So
51 &#116;&#104;&#105;&#115; &#99;&#108;&#97;&#115;&#115; &#105;&#115; &#97; &#114;&#105;&#112;&#111;&#102;&#102; &#111;&#102; &#114;&#108;&#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114;, w&#105;&#116;&#104; &#116;&#104;&#101; &#110;&#97;&#109;&#101;&#115;&#112;&#97;&#99;&#101; &#116;&#111; w&#111;&#114;&#107; &#105;&#110; &#97;&#115; &#97;&#110; 51 this class is a ripoff of rlcompleter, with the namespace to work in as an
52 &#111;&#112;&#116;&#105;&#111;&#110;&#97;&#108; &#112;&#97;&#114;&#97;&#109;&#101;&#116;&#101;&#114;. 52 optional parameter.
53 </p><p> 53 </p><p>
54 &#84;&#104;&#105;&#115; &#99;&#108;&#97;&#115;&#115; &#99;&#97;&#110; &#98;&#101; &#117;&#115;&#101;&#100; &#106;&#117;&#115;&#116; &#108;&#105;&#107;&#101; &#114;&#108;&#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114;, &#98;&#117;&#116; &#116;&#104;&#101; &#67;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; &#99;&#108;&#97;&#115;&#115; &#110;&#111;w &#104;&#97;&#115; 54 This class can be used just like rlcompleter, but the Completer class now has
55 &#97; &#99;&#111;&#110;&#115;&#116;&#114;&#117;&#99;&#116;&#111;&#114; w&#105;&#116;&#104; &#116;&#104;&#101; &#111;&#112;&#116;&#105;&#111;&#110;&#97;&#108; '&#110;&#97;&#109;&#101;&#115;&#112;&#97;&#99;&#101;' &#112;&#97;&#114;&#97;&#109;&#101;&#116;&#101;&#114;. 55 a constructor with the optional 'namespace' parameter.
56 </p><p> 56 </p><p>
57 &#65; &#112;&#97;&#116;&#99;&#104; &#104;&#97;&#115; &#98;&#101;&#101;&#110; &#115;&#117;&#98;&#109;&#105;&#116;&#116;&#101;&#100; &#116;&#111; &#80;y&#116;&#104;&#111;&#110;&#64;&#115;&#111;&#117;&#114;&#99;&#101;&#102;&#111;&#114;&#103;&#101; &#102;&#111;&#114; &#116;&#104;&#101;&#115;&#101; &#99;&#104;&#97;&#110;&#103;&#101;&#115; &#116;&#111; &#103;&#111; &#105;&#110; 57 A patch has been submitted to Python@sourceforge for these changes to go in
58 &#116;&#104;&#101; &#115;&#116;&#97;&#110;&#100;&#97;&#114;&#100; &#80;y&#116;&#104;&#111;&#110; &#100;&#105;&#115;&#116;&#114;&#105;&#98;&#117;&#116;&#105;&#111;&#110;. 58 the standard Python distribution.
59 </p><p> 59 </p><p>
60 60
61 </p><p> 61 </p><p>
62 &#60;&#104;&#52;&#62;&#79;&#114;&#105;&#103;&#105;&#110;&#97;&#108; &#114;&#108;&#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; &#100;&#111;&#99;&#117;&#109;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110;&#60;/&#104;&#52;&#62; 62 <h4>Original rlcompleter documentation</h4>
63 </p><p> 63 </p><p>
64 &#84;&#104;&#105;&#115; &#114;&#101;&#113;&#117;&#105;&#114;&#101;&#115; &#116;&#104;&#101; &#108;&#97;&#116;&#101;&#115;&#116; &#101;x&#116;&#101;&#110;&#115;&#105;&#111;&#110; &#116;&#111; &#116;&#104;&#101; &#114;&#101;&#97;&#100;&#108;&#105;&#110;&#101; &#109;&#111;&#100;&#117;&#108;&#101; (&#116;&#104;&#101; 64 This requires the latest extension to the readline module (the
65 &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#115; &#107;&#101;yw&#111;&#114;&#100;&#115;, &#98;&#117;&#105;&#108;&#116;-&#105;&#110;&#115; &#97;&#110;&#100; &#103;&#108;&#111;&#98;&#97;&#108;&#115; &#105;&#110; &#95;&#95;&#109;&#97;&#105;&#110;&#95;&#95;&#59; w&#104;&#101;&#110; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#110;&#103; 65 completes keywords, built-ins and globals in __main__; when completing
66 &#78;&#65;&#77;&#69;.&#78;&#65;&#77;&#69;..., &#105;&#116; &#101;v&#97;&#108;&#117;&#97;&#116;&#101;&#115; (!) &#116;&#104;&#101; &#101;x&#112;&#114;&#101;&#115;&#115;&#105;&#111;&#110; &#117;&#112; &#116;&#111; &#116;&#104;&#101; &#108;&#97;&#115;&#116; &#100;&#111;&#116; &#97;&#110;&#100; 66 NAME.NAME..., it evaluates (!) the expression up to the last dot and
67 &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#115; &#105;&#116;&#115; &#97;&#116;&#116;&#114;&#105;&#98;&#117;&#116;&#101;&#115;. 67 completes its attributes.
68 </p><p> 68 </p><p>
69 &#73;&#116;'&#115; v&#101;&#114;y &#99;&#111;&#111;&#108; &#116;&#111; &#100;&#111; "&#105;&#109;&#112;&#111;&#114;&#116; &#115;&#116;&#114;&#105;&#110;&#103;" &#116;y&#112;&#101; "&#115;&#116;&#114;&#105;&#110;&#103;.", &#104;&#105;&#116; &#116;&#104;&#101; 69 It's very cool to do "import string" type "string.", hit the
70 &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110; &#107;&#101;y (&#116;w&#105;&#99;&#101;), &#97;&#110;&#100; &#115;&#101;&#101; &#116;&#104;&#101; &#108;&#105;&#115;&#116; &#111;&#102; &#110;&#97;&#109;&#101;&#115; &#100;&#101;&#102;&#105;&#110;&#101;&#100; &#98;y &#116;&#104;&#101; 70 completion key (twice), and see the list of names defined by the
71 &#115;&#116;&#114;&#105;&#110;&#103; &#109;&#111;&#100;&#117;&#108;&#101;! 71 string module!
72 </p><p> 72 </p><p>
73 &#84;&#105;&#112;&#58; &#116;&#111; &#117;&#115;&#101; &#116;&#104;&#101; &#116;&#97;&#98; &#107;&#101;y &#97;&#115; &#116;&#104;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110; &#107;&#101;y, &#99;&#97;&#108;&#108; 73 Tip: to use the tab key as the completion key, call
74 </p><p> 74 </p><p>
75 '&#114;&#101;&#97;&#100;&#108;&#105;&#110;&#101;.&#112;&#97;&#114;&#115;&#101;&#95;&#97;&#110;&#100;&#95;&#98;&#105;&#110;&#100;("&#116;&#97;&#98;&#58; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;")' 75 'readline.parse_and_bind("tab: complete")'
76 </p><p> 76 </p><p>
77 &#60;&#98;&#62;&#78;&#111;&#116;&#101;&#115;&#60;/&#98;&#62;&#58; 77 <b>Notes</b>:
78 &#60;&#117;&#108;&#62; 78 <ul>
79 &#60;&#108;&#105;&#62; 79 <li>
80 &#69;x&#99;&#101;&#112;&#116;&#105;&#111;&#110;&#115; &#114;&#97;&#105;&#115;&#101;&#100; &#98;y &#116;&#104;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#97;&#114;&#101; *&#105;&#103;&#110;&#111;&#114;&#101;&#100;* (&#97;&#110;&#100; 80 Exceptions raised by the completer function are *ignored* (and
81 &#103;&#101;&#110;&#101;&#114;&#97;&#108;&#108;y &#99;&#97;&#117;&#115;&#101; &#116;&#104;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110; &#116;&#111; &#102;&#97;&#105;&#108;). &#84;&#104;&#105;&#115; &#105;&#115; &#97; &#102;&#101;&#97;&#116;&#117;&#114;&#101; -- &#115;&#105;&#110;&#99;&#101; 81 generally cause the completion to fail). This is a feature -- since
82 &#114;&#101;&#97;&#100;&#108;&#105;&#110;&#101; &#115;&#101;&#116;&#115; &#116;&#104;&#101; &#116;&#116;y &#100;&#101;v&#105;&#99;&#101; &#105;&#110; &#114;&#97;w (&#111;&#114; &#99;&#98;&#114;&#101;&#97;&#107;) &#109;&#111;&#100;&#101;, &#112;&#114;&#105;&#110;&#116;&#105;&#110;&#103; &#97; 82 readline sets the tty device in raw (or cbreak) mode, printing a
83 &#116;&#114;&#97;&#99;&#101;&#98;&#97;&#99;&#107; w&#111;&#117;&#108;&#100;&#110;'&#116; w&#111;&#114;&#107; w&#101;&#108;&#108; w&#105;&#116;&#104;&#111;&#117;&#116; &#115;&#111;&#109;&#101; &#99;&#111;&#109;&#112;&#108;&#105;&#99;&#97;&#116;&#101;&#100; &#104;&#111;&#111;&#112;&#108;&#97; &#116;&#111; &#115;&#97;v&#101;, 83 traceback wouldn't work well without some complicated hoopla to save,
84 &#114;&#101;&#115;&#101;&#116; &#97;&#110;&#100; &#114;&#101;&#115;&#116;&#111;&#114;&#101; &#116;&#104;&#101; &#116;&#116;y &#115;&#116;&#97;&#116;&#101;. 84 reset and restore the tty state.
85 &#60;/&#108;&#105;&#62; 85 </li>
86 &#60;&#108;&#105;&#62; 86 <li>
87 &#84;&#104;&#101; &#101;v&#97;&#108;&#117;&#97;&#116;&#105;&#111;&#110; &#111;&#102; &#116;&#104;&#101; &#78;&#65;&#77;&#69;.&#78;&#65;&#77;&#69;... &#102;&#111;&#114;&#109; &#109;&#97;y &#99;&#97;&#117;&#115;&#101; &#97;&#114;&#98;&#105;&#116;&#114;&#97;&#114;y 87 The evaluation of the NAME.NAME... form may cause arbitrary
88 &#97;&#112;&#112;&#108;&#105;&#99;&#97;&#116;&#105;&#111;&#110; &#100;&#101;&#102;&#105;&#110;&#101;&#100; &#99;&#111;&#100;&#101; &#116;&#111; &#98;&#101; &#101;x&#101;&#99;&#117;&#116;&#101;&#100; &#105;&#102; &#97;&#110; &#111;&#98;&#106;&#101;&#99;&#116; w&#105;&#116;&#104; &#97; 88 application defined code to be executed if an object with a
89 &#95;&#95;&#103;&#101;&#116;&#97;&#116;&#116;&#114;&#95;&#95; &#104;&#111;&#111;&#107; &#105;&#115; &#102;&#111;&#117;&#110;&#100;. &#83;&#105;&#110;&#99;&#101; &#105;&#116; &#105;&#115; &#116;&#104;&#101; &#114;&#101;&#115;&#112;&#111;&#110;&#115;&#105;&#98;&#105;&#108;&#105;&#116;y &#111;&#102; &#116;&#104;&#101; 89 __getattr__ hook is found. Since it is the responsibility of the
90 &#97;&#112;&#112;&#108;&#105;&#99;&#97;&#116;&#105;&#111;&#110; (&#111;&#114; &#116;&#104;&#101; &#117;&#115;&#101;&#114;) &#116;&#111; &#101;&#110;&#97;&#98;&#108;&#101; &#116;&#104;&#105;&#115; &#102;&#101;&#97;&#116;&#117;&#114;&#101;, &#73; &#99;&#111;&#110;&#115;&#105;&#100;&#101;&#114; &#116;&#104;&#105;&#115; &#97;&#110; 90 application (or the user) to enable this feature, I consider this an
91 &#97;&#99;&#99;&#101;&#112;&#116;&#97;&#98;&#108;&#101; &#114;&#105;&#115;&#107;. &#77;&#111;&#114;&#101; &#99;&#111;&#109;&#112;&#108;&#105;&#99;&#97;&#116;&#101;&#100; &#101;x&#112;&#114;&#101;&#115;&#115;&#105;&#111;&#110;&#115; (&#101;.&#103;. &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#99;&#97;&#108;&#108;&#115; &#111;&#114; 91 acceptable risk. More complicated expressions (e.g. function calls or
92 &#105;&#110;&#100;&#101;x&#105;&#110;&#103; &#111;&#112;&#101;&#114;&#97;&#116;&#105;&#111;&#110;&#115;) &#97;&#114;&#101; *&#110;&#111;&#116;* &#101;v&#97;&#108;&#117;&#97;&#116;&#101;&#100;. 92 indexing operations) are *not* evaluated.
93 &#60;/&#108;&#105;&#62; 93 </li>
94 &#60;&#108;&#105;&#62; 94 <li>
95 &#71;&#78;&#85; &#114;&#101;&#97;&#100;&#108;&#105;&#110;&#101; &#105;&#115; &#97;&#108;&#115;&#111; &#117;&#115;&#101;&#100; &#98;y &#116;&#104;&#101; &#98;&#117;&#105;&#108;&#116;-&#105;&#110; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110;&#115; &#105;&#110;&#112;&#117;&#116;() &#97;&#110;&#100; 95 GNU readline is also used by the built-in functions input() and
96 &#114;&#97;w&#95;&#105;&#110;&#112;&#117;&#116;(), &#97;&#110;&#100; &#116;&#104;&#117;&#115; &#116;&#104;&#101;&#115;&#101; &#97;&#108;&#115;&#111; &#98;&#101;&#110;&#101;&#102;&#105;&#116;/&#115;&#117;&#102;&#102;&#101;&#114; &#102;&#114;&#111;&#109; &#116;&#104;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; 96 raw_input(), and thus these also benefit/suffer from the completer
97 &#102;&#101;&#97;&#116;&#117;&#114;&#101;&#115;. &#67;&#108;&#101;&#97;&#114;&#108;y &#97;&#110; &#105;&#110;&#116;&#101;&#114;&#97;&#99;&#116;&#105;v&#101; &#97;&#112;&#112;&#108;&#105;&#99;&#97;&#116;&#105;&#111;&#110; &#99;&#97;&#110; &#98;&#101;&#110;&#101;&#102;&#105;&#116; &#98;y 97 features. Clearly an interactive application can benefit by
98 &#115;&#112;&#101;&#99;&#105;&#102;y&#105;&#110;&#103; &#105;&#116;&#115; &#111;w&#110; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#97;&#110;&#100; &#117;&#115;&#105;&#110;&#103; &#114;&#97;w&#95;&#105;&#110;&#112;&#117;&#116;() &#102;&#111;&#114; &#97;&#108;&#108; 98 specifying its own completer function and using raw_input() for all
99 &#105;&#116;&#115; &#105;&#110;&#112;&#117;&#116;. 99 its input.
100 &#60;/&#108;&#105;&#62; 100 </li>
101 &#60;&#108;&#105;&#62; 101 <li>
102 &#87;&#104;&#101;&#110; &#116;&#104;&#101; &#111;&#114;&#105;&#103;&#105;&#110;&#97;&#108; &#115;&#116;&#100;&#105;&#110; &#105;&#115; &#110;&#111;&#116; &#97; &#116;&#116;y &#100;&#101;v&#105;&#99;&#101;, &#71;&#78;&#85; &#114;&#101;&#97;&#100;&#108;&#105;&#110;&#101; &#105;&#115; &#110;&#101;v&#101;&#114; 102 When the original stdin is not a tty device, GNU readline is never
103 &#117;&#115;&#101;&#100;, &#97;&#110;&#100; &#116;&#104;&#105;&#115; &#109;&#111;&#100;&#117;&#108;&#101; (&#97;&#110;&#100; &#116;&#104;&#101; &#114;&#101;&#97;&#100;&#108;&#105;&#110;&#101; &#109;&#111;&#100;&#117;&#108;&#101;) &#97;&#114;&#101; &#115;&#105;&#108;&#101;&#110;&#116;&#108;y &#105;&#110;&#97;&#99;&#116;&#105;v&#101;. 103 used, and this module (and the readline module) are silently inactive.
104 &#60;/&#108;&#105;&#62; 104 </li>
105 &#60;/&#117;&#108;&#62; 105 </ul>
106 </p> 106 </p>
107 <h3>Global Attributes</h3> 107 <h3>Global Attributes</h3>
108 <table> 108 <table>
109 <tr><td>__all__</td></tr> 109 <tr><td>__all__</td></tr>
110 </table> 110 </table>
111 <h3>Classes</h3> 111 <h3>Classes</h3>
112 <table> 112 <table>
113 <tr> 113 <tr>
114 <td><a href="#Completer">Completer</a></td> 114 <td><a href="#Completer">Completer</a></td>
115 <td>&#67;&#108;&#97;&#115;&#115; &#105;&#109;&#112;&#108;&#101;&#109;&#101;&#110;&#116;&#105;&#110;&#103; &#116;&#104;&#101; &#99;&#111;&#109;&#109;&#97;&#110;&#100; &#108;&#105;&#110;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; &#111;&#98;&#106;&#101;&#99;&#116;.</td> 115 <td>Class implementing the command line completer object.</td>
116 </tr> 116 </tr>
117 </table> 117 </table>
118 <h3>Functions</h3> 118 <h3>Functions</h3>
119 <table> 119 <table>
120 <tr> 120 <tr>
121 <td><a href="#get_class_members">get_class_members</a></td> 121 <td><a href="#get_class_members">get_class_members</a></td>
122 <td>&#77;&#111;&#100;&#117;&#108;&#101; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#116;&#111; &#114;&#101;&#116;&#114;&#105;&#101;v&#101; &#116;&#104;&#101; &#99;&#108;&#97;&#115;&#115; &#109;&#101;&#109;&#98;&#101;&#114;&#115;.</td> 122 <td>Module function to retrieve the class members.</td>
123 </tr> 123 </tr>
124 </table> 124 </table>
125 <hr /><hr /> 125 <hr /><hr />
126 <a NAME="Completer" ID="Completer"></a> 126 <a NAME="Completer" ID="Completer"></a>
127 <h2>Completer</h2> 127 <h2>Completer</h2>
128 <p> 128 <p>
129 &#67;&#108;&#97;&#115;&#115; &#105;&#109;&#112;&#108;&#101;&#109;&#101;&#110;&#116;&#105;&#110;&#103; &#116;&#104;&#101; &#99;&#111;&#109;&#109;&#97;&#110;&#100; &#108;&#105;&#110;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; &#111;&#98;&#106;&#101;&#99;&#116;. 129 Class implementing the command line completer object.
130 </p> 130 </p>
131 <h3>Derived from</h3> 131 <h3>Derived from</h3>
132 object 132 object
133 <h3>Class Attributes</h3> 133 <h3>Class Attributes</h3>
134 <table> 134 <table>
136 </table> 136 </table>
137 <h3>Methods</h3> 137 <h3>Methods</h3>
138 <table> 138 <table>
139 <tr> 139 <tr>
140 <td><a href="#Completer.__init__">Completer</a></td> 140 <td><a href="#Completer.__init__">Completer</a></td>
141 <td>&#67;&#114;&#101;&#97;&#116;&#101; &#97; &#110;&#101;w &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; &#102;&#111;&#114; &#116;&#104;&#101; &#99;&#111;&#109;&#109;&#97;&#110;&#100; &#108;&#105;&#110;&#101;.</td> 141 <td>Create a new completer for the command line.</td>
142 </tr><tr> 142 </tr><tr>
143 <td><a href="#Completer.attr_matches">attr_matches</a></td> 143 <td><a href="#Completer.attr_matches">attr_matches</a></td>
144 <td>&#67;&#111;&#109;&#112;&#117;&#116;&#101; &#109;&#97;&#116;&#99;&#104;&#101;&#115; w&#104;&#101;&#110; &#116;&#101;x&#116; &#99;&#111;&#110;&#116;&#97;&#105;&#110;&#115; &#97; &#100;&#111;&#116;.</td> 144 <td>Compute matches when text contains a dot.</td>
145 </tr><tr> 145 </tr><tr>
146 <td><a href="#Completer.complete">complete</a></td> 146 <td><a href="#Completer.complete">complete</a></td>
147 <td>&#82;&#101;&#116;&#117;&#114;&#110; &#116;&#104;&#101; &#110;&#101;x&#116; &#112;&#111;&#115;&#115;&#105;&#98;&#108;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110; &#102;&#111;&#114; '&#116;&#101;x&#116;'.</td> 147 <td>Return the next possible completion for 'text'.</td>
148 </tr><tr> 148 </tr><tr>
149 <td><a href="#Completer.global_matches">global_matches</a></td> 149 <td><a href="#Completer.global_matches">global_matches</a></td>
150 <td>&#67;&#111;&#109;&#112;&#117;&#116;&#101; &#109;&#97;&#116;&#99;&#104;&#101;&#115; w&#104;&#101;&#110; &#116;&#101;x&#116; &#105;&#115; &#97; &#115;&#105;&#109;&#112;&#108;&#101; &#110;&#97;&#109;&#101;.</td> 150 <td>Compute matches when text is a simple name.</td>
151 </tr> 151 </tr>
152 </table> 152 </table>
153 <a NAME="Completer.__init__" ID="Completer.__init__"></a> 153 <a NAME="Completer.__init__" ID="Completer.__init__"></a>
154 <h4>Completer (Constructor)</h4> 154 <h4>Completer (Constructor)</h4>
155 <b>Completer</b>(<i>namespace = None</i>) 155 <b>Completer</b>(<i>namespace = None</i>)
156 <p> 156 <p>
157 &#67;&#114;&#101;&#97;&#116;&#101; &#97; &#110;&#101;w &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; &#102;&#111;&#114; &#116;&#104;&#101; &#99;&#111;&#109;&#109;&#97;&#110;&#100; &#108;&#105;&#110;&#101;. 157 Create a new completer for the command line.
158 </p><p> 158 </p><p>
159 &#67;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114;(&#91;&#110;&#97;&#109;&#101;&#115;&#112;&#97;&#99;&#101;&#93;) -&#62; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; &#105;&#110;&#115;&#116;&#97;&#110;&#99;&#101;. 159 Completer([namespace]) -> completer instance.
160 </p><p> 160 </p><p>
161 &#73;&#102; &#117;&#110;&#115;&#112;&#101;&#99;&#105;&#102;&#105;&#101;&#100;, &#116;&#104;&#101; &#100;&#101;&#102;&#97;&#117;&#108;&#116; &#110;&#97;&#109;&#101;&#115;&#112;&#97;&#99;&#101; w&#104;&#101;&#114;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110;&#115; &#97;&#114;&#101; &#112;&#101;&#114;&#102;&#111;&#114;&#109;&#101;&#100; 161 If unspecified, the default namespace where completions are performed
162 &#105;&#115; &#95;&#95;&#109;&#97;&#105;&#110;&#95;&#95; (&#116;&#101;&#99;&#104;&#110;&#105;&#99;&#97;&#108;&#108;y, &#95;&#95;&#109;&#97;&#105;&#110;&#95;&#95;.&#95;&#95;&#100;&#105;&#99;&#116;&#95;&#95;). &#78;&#97;&#109;&#101;&#115;&#112;&#97;&#99;&#101;&#115; &#115;&#104;&#111;&#117;&#108;&#100; &#98;&#101; 162 is __main__ (technically, __main__.__dict__). Namespaces should be
163 &#103;&#105;v&#101;&#110; &#97;&#115; &#100;&#105;&#99;&#116;&#105;&#111;&#110;&#97;&#114;&#105;&#101;&#115;. 163 given as dictionaries.
164 </p><p> 164 </p><p>
165 &#67;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114; &#105;&#110;&#115;&#116;&#97;&#110;&#99;&#101;&#115; &#115;&#104;&#111;&#117;&#108;&#100; &#98;&#101; &#117;&#115;&#101;&#100; &#97;&#115; &#116;&#104;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110; &#109;&#101;&#99;&#104;&#97;&#110;&#105;&#115;&#109; &#111;&#102; 165 Completer instances should be used as the completion mechanism of
166 &#114;&#101;&#97;&#100;&#108;&#105;&#110;&#101; v&#105;&#97; &#116;&#104;&#101; &#115;&#101;&#116;&#95;&#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114;() &#99;&#97;&#108;&#108;&#58; 166 readline via the set_completer() call:
167 </p><p> 167 </p><p>
168 &#114;&#101;&#97;&#100;&#108;&#105;&#110;&#101;.&#115;&#101;&#116;&#95;&#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114;(&#67;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114;(&#109;y&#95;&#110;&#97;&#109;&#101;&#115;&#112;&#97;&#99;&#101;).&#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;) 168 readline.set_completer(Completer(my_namespace).complete)
169 </p><dl> 169 </p><dl>
170 <dt><i>namespace</i></dt> 170 <dt><i>namespace</i></dt>
171 <dd> 171 <dd>
172 &#84;&#104;&#101; &#110;&#97;&#109;&#101;&#115;&#112;&#97;&#99;&#101; &#102;&#111;&#114; &#116;&#104;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#114;. 172 The namespace for the completer.
173 </dd> 173 </dd>
174 </dl><a NAME="Completer.attr_matches" ID="Completer.attr_matches"></a> 174 </dl><a NAME="Completer.attr_matches" ID="Completer.attr_matches"></a>
175 <h4>Completer.attr_matches</h4> 175 <h4>Completer.attr_matches</h4>
176 <b>attr_matches</b>(<i>text</i>) 176 <b>attr_matches</b>(<i>text</i>)
177 <p> 177 <p>
178 &#67;&#111;&#109;&#112;&#117;&#116;&#101; &#109;&#97;&#116;&#99;&#104;&#101;&#115; w&#104;&#101;&#110; &#116;&#101;x&#116; &#99;&#111;&#110;&#116;&#97;&#105;&#110;&#115; &#97; &#100;&#111;&#116;. 178 Compute matches when text contains a dot.
179 </p><p> 179 </p><p>
180 &#65;&#115;&#115;&#117;&#109;&#105;&#110;&#103; &#116;&#104;&#101; &#116;&#101;x&#116; &#105;&#115; &#111;&#102; &#116;&#104;&#101; &#102;&#111;&#114;&#109; &#78;&#65;&#77;&#69;.&#78;&#65;&#77;&#69;....&#91;&#78;&#65;&#77;&#69;&#93;, &#97;&#110;&#100; &#105;&#115; 180 Assuming the text is of the form NAME.NAME....[NAME], and is
181 &#101;v&#97;&#108;&#117;&#97;&#116;&#97;&#98;&#108;&#101; &#105;&#110; &#115;&#101;&#108;&#102;.&#110;&#97;&#109;&#101;&#115;&#112;&#97;&#99;&#101;, &#105;&#116; w&#105;&#108;&#108; &#98;&#101; &#101;v&#97;&#108;&#117;&#97;&#116;&#101;&#100; &#97;&#110;&#100; &#105;&#116;&#115; &#97;&#116;&#116;&#114;&#105;&#98;&#117;&#116;&#101;&#115; 181 evaluatable in self.namespace, it will be evaluated and its attributes
182 (&#97;&#115; &#114;&#101;v&#101;&#97;&#108;&#101;&#100; &#98;y &#100;&#105;&#114;()) &#97;&#114;&#101; &#117;&#115;&#101;&#100; &#97;&#115; &#112;&#111;&#115;&#115;&#105;&#98;&#108;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110;&#115;. (&#70;&#111;&#114; &#99;&#108;&#97;&#115;&#115; 182 (as revealed by dir()) are used as possible completions. (For class
183 &#105;&#110;&#115;&#116;&#97;&#110;&#99;&#101;&#115;, &#99;&#108;&#97;&#115;&#115; &#109;&#101;&#109;&#98;&#101;&#114;&#115; &#97;&#114;&#101; &#97;&#114;&#101; &#97;&#108;&#115;&#111; &#99;&#111;&#110;&#115;&#105;&#100;&#101;&#114;&#101;&#100;.) 183 instances, class members are are also considered.)
184 </p><p> 184 </p><p>
185 &#60;&#98;&#62;&#87;&#65;&#82;&#78;&#73;&#78;&#71;&#60;/&#98;&#62;&#58; &#116;&#104;&#105;&#115; &#99;&#97;&#110; &#115;&#116;&#105;&#108;&#108; &#105;&#110;v&#111;&#107;&#101; &#97;&#114;&#98;&#105;&#116;&#114;&#97;&#114;y &#67; &#99;&#111;&#100;&#101;, &#105;&#102; &#97;&#110; &#111;&#98;&#106;&#101;&#99;&#116; 185 <b>WARNING</b>: this can still invoke arbitrary C code, if an object
186 w&#105;&#116;&#104; &#97; &#95;&#95;&#103;&#101;&#116;&#97;&#116;&#116;&#114;&#95;&#95; &#104;&#111;&#111;&#107; &#105;&#115; &#101;v&#97;&#108;&#117;&#97;&#116;&#101;&#100;. 186 with a __getattr__ hook is evaluated.
187 </p><dl> 187 </p><dl>
188 <dt><i>text</i></dt> 188 <dt><i>text</i></dt>
189 <dd> 189 <dd>
190 &#84;&#104;&#101; &#116;&#101;x&#116; &#116;&#111; &#98;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#100;. (&#115;&#116;&#114;&#105;&#110;&#103;) 190 The text to be completed. (string)
191 </dd> 191 </dd>
192 </dl><dl> 192 </dl><dl>
193 <dt>Returns:</dt> 193 <dt>Returns:</dt>
194 <dd> 194 <dd>
195 &#65; &#108;&#105;&#115;&#116; &#111;&#102; &#97;&#108;&#108; &#109;&#97;&#116;&#99;&#104;&#101;&#115;. 195 A list of all matches.
196 </dd> 196 </dd>
197 </dl><a NAME="Completer.complete" ID="Completer.complete"></a> 197 </dl><a NAME="Completer.complete" ID="Completer.complete"></a>
198 <h4>Completer.complete</h4> 198 <h4>Completer.complete</h4>
199 <b>complete</b>(<i>text, state</i>) 199 <b>complete</b>(<i>text, state</i>)
200 <p> 200 <p>
201 &#82;&#101;&#116;&#117;&#114;&#110; &#116;&#104;&#101; &#110;&#101;x&#116; &#112;&#111;&#115;&#115;&#105;&#98;&#108;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110; &#102;&#111;&#114; '&#116;&#101;x&#116;'. 201 Return the next possible completion for 'text'.
202 </p><p> 202 </p><p>
203 &#84;&#104;&#105;&#115; &#105;&#115; &#99;&#97;&#108;&#108;&#101;&#100; &#115;&#117;&#99;&#99;&#101;&#115;&#115;&#105;v&#101;&#108;y w&#105;&#116;&#104; &#115;&#116;&#97;&#116;&#101; &#61;&#61; &#48;, &#49;, &#50;, ... &#117;&#110;&#116;&#105;&#108; &#105;&#116; 203 This is called successively with state == 0, 1, 2, ... until it
204 &#114;&#101;&#116;&#117;&#114;&#110;&#115; &#78;&#111;&#110;&#101;. &#84;&#104;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110; &#115;&#104;&#111;&#117;&#108;&#100; &#98;&#101;&#103;&#105;&#110; w&#105;&#116;&#104; '&#116;&#101;x&#116;'. 204 returns None. The completion should begin with 'text'.
205 </p><dl> 205 </p><dl>
206 <dt><i>text</i></dt> 206 <dt><i>text</i></dt>
207 <dd> 207 <dd>
208 &#84;&#104;&#101; &#116;&#101;x&#116; &#116;&#111; &#98;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#100;. (&#115;&#116;&#114;&#105;&#110;&#103;) 208 The text to be completed. (string)
209 </dd><dt><i>state</i></dt> 209 </dd><dt><i>state</i></dt>
210 <dd> 210 <dd>
211 &#84;&#104;&#101; &#115;&#116;&#97;&#116;&#101; &#111;&#102; &#116;&#104;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110;. (&#105;&#110;&#116;&#101;&#103;&#101;&#114;) 211 The state of the completion. (integer)
212 </dd> 212 </dd>
213 </dl><dl> 213 </dl><dl>
214 <dt>Returns:</dt> 214 <dt>Returns:</dt>
215 <dd> 215 <dd>
216 &#84;&#104;&#101; &#112;&#111;&#115;&#115;&#105;&#98;&#108;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#105;&#111;&#110;&#115; &#97;&#115; &#97; &#108;&#105;&#115;&#116; &#111;&#102; &#115;&#116;&#114;&#105;&#110;&#103;&#115;. 216 The possible completions as a list of strings.
217 </dd> 217 </dd>
218 </dl><a NAME="Completer.global_matches" ID="Completer.global_matches"></a> 218 </dl><a NAME="Completer.global_matches" ID="Completer.global_matches"></a>
219 <h4>Completer.global_matches</h4> 219 <h4>Completer.global_matches</h4>
220 <b>global_matches</b>(<i>text</i>) 220 <b>global_matches</b>(<i>text</i>)
221 <p> 221 <p>
222 &#67;&#111;&#109;&#112;&#117;&#116;&#101; &#109;&#97;&#116;&#99;&#104;&#101;&#115; w&#104;&#101;&#110; &#116;&#101;x&#116; &#105;&#115; &#97; &#115;&#105;&#109;&#112;&#108;&#101; &#110;&#97;&#109;&#101;. 222 Compute matches when text is a simple name.
223 </p><dl> 223 </p><dl>
224 <dt><i>text</i></dt> 224 <dt><i>text</i></dt>
225 <dd> 225 <dd>
226 &#84;&#104;&#101; &#116;&#101;x&#116; &#116;&#111; &#98;&#101; &#99;&#111;&#109;&#112;&#108;&#101;&#116;&#101;&#100;. (&#115;&#116;&#114;&#105;&#110;&#103;) 226 The text to be completed. (string)
227 </dd> 227 </dd>
228 </dl><dl> 228 </dl><dl>
229 <dt>Returns:</dt> 229 <dt>Returns:</dt>
230 <dd> 230 <dd>
231 &#65; &#108;&#105;&#115;&#116; &#111;&#102; &#97;&#108;&#108; &#107;&#101;yw&#111;&#114;&#100;&#115;, &#98;&#117;&#105;&#108;&#116;-&#105;&#110; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110;&#115; &#97;&#110;&#100; &#110;&#97;&#109;&#101;&#115; &#99;&#117;&#114;&#114;&#101;&#110;&#116;&#108;y 231 A list of all keywords, built-in functions and names currently
232 &#100;&#101;&#102;&#105;&#110;&#101;&#100; &#105;&#110; &#115;&#101;&#108;&#102;.&#110;&#97;&#109;&#101;&#115;&#112;&#97;&#99;&#101; &#116;&#104;&#97;&#116; &#109;&#97;&#116;&#99;&#104;. 232 defined in self.namespace that match.
233 </dd> 233 </dd>
234 </dl> 234 </dl>
235 <div align="right"><a href="#top">Up</a></div> 235 <div align="right"><a href="#top">Up</a></div>
236 <hr /><hr /> 236 <hr /><hr />
237 <a NAME="get_class_members" ID="get_class_members"></a> 237 <a NAME="get_class_members" ID="get_class_members"></a>
238 <h2>get_class_members</h2> 238 <h2>get_class_members</h2>
239 <b>get_class_members</b>(<i>klass</i>) 239 <b>get_class_members</b>(<i>klass</i>)
240 <p> 240 <p>
241 &#77;&#111;&#100;&#117;&#108;&#101; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#116;&#111; &#114;&#101;&#116;&#114;&#105;&#101;v&#101; &#116;&#104;&#101; &#99;&#108;&#97;&#115;&#115; &#109;&#101;&#109;&#98;&#101;&#114;&#115;. 241 Module function to retrieve the class members.
242 </p><dl> 242 </p><dl>
243 <dt><i>klass</i></dt> 243 <dt><i>klass</i></dt>
244 <dd> 244 <dd>
245 &#84;&#104;&#101; &#99;&#108;&#97;&#115;&#115; &#111;&#98;&#106;&#101;&#99;&#116; &#116;&#111; &#98;&#101; &#97;&#110;&#97;&#108;y&#115;&#101;&#100;. 245 The class object to be analysed.
246 </dd> 246 </dd>
247 </dl><dl> 247 </dl><dl>
248 <dt>Returns:</dt> 248 <dt>Returns:</dt>
249 <dd> 249 <dd>
250 &#65; &#108;&#105;&#115;&#116; &#111;&#102; &#97;&#108;&#108; &#110;&#97;&#109;&#101;&#115; &#100;&#101;&#102;&#105;&#110;&#101;&#100; &#105;&#110; &#116;&#104;&#101; &#99;&#108;&#97;&#115;&#115;. 250 A list of all names defined in the class.
251 </dd> 251 </dd>
252 </dl> 252 </dl>
253 <div align="right"><a href="#top">Up</a></div> 253 <div align="right"><a href="#top">Up</a></div>
254 <hr /> 254 <hr />
255 </body></html> 255 </body></html>

eric ide

mercurial