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

changeset 3673
e26d7d0c1088
child 4836
51e12b77428e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Documentation/Source/eric6.DebugClients.Python.FlexCompleter.html	Sat Jul 05 12:29:15 2014 +0200
@@ -0,0 +1,267 @@
+<!DOCTYPE html>
+<html><head>
+<title>eric6.DebugClients.Python.FlexCompleter</title>
+<meta charset="UTF-8">
+<style>
+body {
+    background: #EDECE6;
+    margin: 0em 1em 10em 1em;
+    color: black;
+}
+
+h1 { color: white; background: #85774A; }
+h2 { color: white; background: #85774A; }
+h3 { color: white; background: #9D936E; }
+h4 { color: white; background: #9D936E; }
+    
+a { color: #BA6D36; }
+
+</style>
+</head>
+<body><a NAME="top" ID="top"></a>
+<h1>eric6.DebugClients.Python.FlexCompleter</h1>
+<p>
+Word completion for the eric6 shell.
+</p><p>
+<h4>NOTE for eric6 variant</h4>
+</p><p>
+    This version is a re-implementation of FlexCompleter
+    as found in the PyQwt package. It is modified to work with the eric6 debug
+    clients.
+</p><p>
+
+</p><p>
+<h4>NOTE for the PyQwt variant</h4>
+</p><p>
+    This version is a re-implementation of FlexCompleter
+    with readline support for PyQt&sip-3.6 and earlier.
+</p><p>
+    Full readline support is present in PyQt&sip-snapshot-20030531 and later.
+</p><p>
+
+</p><p>
+<h4>NOTE for FlexCompleter</h4>
+</p><p>
+    This version is a re-implementation of rlcompleter with
+    selectable namespace.
+</p><p>
+    The problem with rlcompleter is that it's hardwired to work with
+    __main__.__dict__, and in some cases one may have 'sandboxed' namespaces.
+    So this class is a ripoff of rlcompleter, with the namespace to work in as
+    an optional parameter.
+</p><p>
+    This class can be used just like rlcompleter, but the Completer class now
+    has a constructor with the optional 'namespace' parameter.
+</p><p>
+    A patch has been submitted to Python@sourceforge for these changes to go in
+    the standard Python distribution.
+</p><p>
+
+</p><p>
+<h4>Original rlcompleter documentation</h4>
+</p><p>
+    This requires the latest extension to the readline module (the
+    completes keywords, built-ins and globals in __main__; when completing
+    NAME.NAME..., it evaluates (!) the expression up to the last dot and
+    completes its attributes.
+</p><p>
+    It's very cool to do "import string" type "string.", hit the
+    completion key (twice), and see the list of names defined by the
+    string module!
+</p><p>
+    Tip: to use the tab key as the completion key, call
+</p><p>
+    'readline.parse_and_bind("tab: complete")'
+</p><p>
+    <b>Notes</b>:
+    <ul>
+    <li>
+    Exceptions raised by the completer function are *ignored* (and
+    generally cause the completion to fail).  This is a feature -- since
+    readline sets the tty device in raw (or cbreak) mode, printing a
+    traceback wouldn't work well without some complicated hoopla to save,
+    reset and restore the tty state.
+    </li>
+    <li>
+    The evaluation of the NAME.NAME... form may cause arbitrary
+    application defined code to be executed if an object with a
+    __getattr__ hook is found.  Since it is the responsibility of the
+    application (or the user) to enable this feature, I consider this an
+    acceptable risk.  More complicated expressions (e.g. function calls or
+    indexing operations) are *not* evaluated.
+    </li>
+    <li>
+    GNU readline is also used by the built-in functions input() and
+    raw_input(), and thus these also benefit/suffer from the completer
+    features.  Clearly an interactive application can benefit by
+    specifying its own completer function and using raw_input() for all
+    its input.
+    </li>
+    <li>
+    When the original stdin is not a tty device, GNU readline is never
+    used, and this module (and the readline module) are silently inactive.
+    </li>
+    </ul>
+</p>
+<h3>Global Attributes</h3>
+<table>
+<tr><td>__all__</td></tr>
+</table>
+<h3>Classes</h3>
+<table>
+<tr>
+<td><a href="#Completer">Completer</a></td>
+<td>Class implementing the command line completer object.</td>
+</tr>
+</table>
+<h3>Functions</h3>
+<table>
+<tr>
+<td><a href="#get_class_members">get_class_members</a></td>
+<td>Module function to retrieve the class members.</td>
+</tr>
+</table>
+<hr /><hr />
+<a NAME="Completer" ID="Completer"></a>
+<h2>Completer</h2>
+<p>
+    Class implementing the command line completer object.
+</p>
+<h3>Derived from</h3>
+object
+<h3>Class Attributes</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Methods</h3>
+<table>
+<tr>
+<td><a href="#Completer.__init__">Completer</a></td>
+<td>Constructor</td>
+</tr><tr>
+<td><a href="#Completer.attr_matches">attr_matches</a></td>
+<td>Public method to compute matches when text contains a dot.</td>
+</tr><tr>
+<td><a href="#Completer.complete">complete</a></td>
+<td>Public method to return the next possible completion for 'text'.</td>
+</tr><tr>
+<td><a href="#Completer.global_matches">global_matches</a></td>
+<td>Public method to compute matches when text is a simple name.</td>
+</tr>
+</table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<a NAME="Completer.__init__" ID="Completer.__init__"></a>
+<h4>Completer (Constructor)</h4>
+<b>Completer</b>(<i>namespace=None</i>)
+<p>
+        Constructor
+</p><p>
+        Completer([namespace]) -> completer instance.
+</p><p>
+        If unspecified, the default namespace where completions are performed
+        is __main__ (technically, __main__.__dict__). Namespaces should be
+        given as dictionaries.
+</p><p>
+        Completer instances should be used as the completion mechanism of
+        readline via the set_completer() call:
+</p><p>
+        readline.set_completer(Completer(my_namespace).complete)
+</p><dl>
+<dt><i>namespace</i></dt>
+<dd>
+namespace for the completer
+</dd>
+</dl><dl>
+<dt>Raises <b>TypeError</b>:</dt>
+<dd>
+raised to indicate a wrong namespace structure
+</dd>
+</dl><a NAME="Completer.attr_matches" ID="Completer.attr_matches"></a>
+<h4>Completer.attr_matches</h4>
+<b>attr_matches</b>(<i>text</i>)
+<p>
+        Public method to compute matches when text contains a dot.
+</p><p>
+        Assuming the text is of the form NAME.NAME....[NAME], and is
+        evaluatable in self.namespace, it will be evaluated and its attributes
+        (as revealed by dir()) are used as possible completions.  (For class
+        instances, class members are are also considered.)
+</p><p>
+        <b>WARNING</b>: this can still invoke arbitrary C code, if an object
+        with a __getattr__ hook is evaluated.
+</p><dl>
+<dt><i>text</i></dt>
+<dd>
+The text to be completed. (string)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+A list of all matches.
+</dd>
+</dl><a NAME="Completer.complete" ID="Completer.complete"></a>
+<h4>Completer.complete</h4>
+<b>complete</b>(<i>text, state</i>)
+<p>
+        Public method to return the next possible completion for 'text'.
+</p><p>
+        This is called successively with state == 0, 1, 2, ... until it
+        returns None.  The completion should begin with 'text'.
+</p><dl>
+<dt><i>text</i></dt>
+<dd>
+The text to be completed. (string)
+</dd><dt><i>state</i></dt>
+<dd>
+The state of the completion. (integer)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+The possible completions as a list of strings.
+</dd>
+</dl><a NAME="Completer.global_matches" ID="Completer.global_matches"></a>
+<h4>Completer.global_matches</h4>
+<b>global_matches</b>(<i>text</i>)
+<p>
+        Public method to compute matches when text is a simple name.
+</p><dl>
+<dt><i>text</i></dt>
+<dd>
+The text to be completed. (string)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+A list of all keywords, built-in functions and names currently
+        defined in self.namespace that match.
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="get_class_members" ID="get_class_members"></a>
+<h2>get_class_members</h2>
+<b>get_class_members</b>(<i>klass</i>)
+<p>
+    Module function to retrieve the class members.
+</p><dl>
+<dt><i>klass</i></dt>
+<dd>
+The class object to be analysed.
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+A list of all names defined in the class.
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr />
+</body></html>
\ No newline at end of file

eric ide

mercurial