/usr/share/doc/python-dictclient/dictclient.html is in python-dictclient 1.0.3.1+nmu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | <!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module dictclient</title>
<style type="text/css"><!--
TT { font-family: lucidatypewriter, lucida console, courier }
--></style></head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>dictclient</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/jgoerzen/tree/dictclient/dictclient.py">/home/jgoerzen/tree/dictclient/dictclient.py</a></font></td></tr></table>
<p><tt># Client for the DICT protocol (<a href="http://www.rfc-editor.org/rfc/rfc2229.txt">RFC2229</a>)<br>
#<br>
# Copyright (C) 2002 John Goerzen<br>
#<br>
# This program is free software; you can redistribute it and/or modify<br>
# it under the terms of the GNU General Public License as published by<br>
# the Free Software Foundation; either version 2 of the License, or<br>
# (at your option) any later version.<br>
#<br>
# This program is distributed in the hope that it will be useful,<br>
# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
# GNU General Public License for more details.<br>
#<br>
# You should have received a copy of the GNU General Public License<br>
# along with this program; if not, write to the Free Software<br>
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</tt></p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="re.html">re</a><br>
</td><td width="25%" valign=top><a href="socket.html">socket</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="dictclient.html#Connection">Connection</a>
</font></dt><dt><font face="helvetica, arial"><a href="dictclient.html#Database">Database</a>
</font></dt><dt><font face="helvetica, arial"><a href="dictclient.html#Definition">Definition</a>
</font></dt></dl>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Connection">class <strong>Connection</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>This class is used to establish a connection to a database server.<br>
You will usually use this as the first call into the dictclient library.<br>
Instantiating it takes two optional arguments: a hostname (a string)<br>
and a port (an int). The hostname defaults to localhost<br>
and the port to 2628, the port specified in RFC.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Connection-__init__"><strong>__init__</strong></a>(self, hostname<font color="#909090">='localhost'</font>, port<font color="#909090">=2628</font>)</dt></dl>
<dl><dt><a name="Connection-define"><strong>define</strong></a>(self, database, word)</dt><dd><tt>Returns a list of <a href="#Definition">Definition</a> objects for each matching<br>
definition. Parameters are the database name and the word<br>
to look up. This is one of the main functions you will use<br>
to interact with the server. Returns a list of <a href="#Definition">Definition</a><br>
objects. If there are no matches, an empty list is returned.<br>
<br>
Note: database may be '*' which means to search all databases,<br>
or '!' which means to return matches from the first database that<br>
has a match.</tt></dd></dl>
<dl><dt><a name="Connection-get100block"><strong>get100block</strong></a>(self)</dt><dd><tt>Used when expecting multiple lines of text -- gets the block<br>
part only. Does not get any codes or anything! Returns a string.</tt></dd></dl>
<dl><dt><a name="Connection-get100dict"><strong>get100dict</strong></a>(self)</dt><dd><tt>Used when expecting a dictionary of results. Will read from<br>
the initial 100 code, to a period and the 200 code.</tt></dd></dl>
<dl><dt><a name="Connection-get100result"><strong>get100result</strong></a>(self)</dt><dd><tt>Used when expecting multiple lines of text, terminated by a period<br>
and a 200 code. Returns: [initialcode, [bodytext_1lineperentry],<br>
finalcode]</tt></dd></dl>
<dl><dt><a name="Connection-get200result"><strong>get200result</strong></a>(self)</dt><dd><tt>Used when expecting a single line of text -- a 200-class<br>
result. Returns [intcode, remaindertext]</tt></dd></dl>
<dl><dt><a name="Connection-getcapabilities"><strong>getcapabilities</strong></a>(self)</dt><dd><tt>Returns a list of the capabilities advertised by the server.</tt></dd></dl>
<dl><dt><a name="Connection-getdbdescs"><strong>getdbdescs</strong></a>(self)</dt><dd><tt>Gets a dict of available databases. The key is the db name<br>
and the value is the db description. This command may generate<br>
network traffic!</tt></dd></dl>
<dl><dt><a name="Connection-getdbobj"><strong>getdbobj</strong></a>(self, dbname)</dt><dd><tt>Gets a <a href="#Database">Database</a> object corresponding to the database name passed<br>
in. This function explicitly will *not* generate network traffic.<br>
If you have not yet run <a href="#Connection-getdbdescs">getdbdescs</a>(), it will fail.</tt></dd></dl>
<dl><dt><a name="Connection-getmessageid"><strong>getmessageid</strong></a>(self)</dt><dd><tt>Returns the message id, including angle brackets.</tt></dd></dl>
<dl><dt><a name="Connection-getresultcode"><strong>getresultcode</strong></a>(self)</dt><dd><tt>Generic function to get a result code. It will return a list<br>
consisting of two items: the integer result code and the text<br>
following. You will not usually use this function directly.</tt></dd></dl>
<dl><dt><a name="Connection-getstratdescs"><strong>getstratdescs</strong></a>(self)</dt><dd><tt>Gets a dict of available strategies. The key is the strat<br>
name and the value is the strat description. This call may<br>
generate network traffic!</tt></dd></dl>
<dl><dt><a name="Connection-match"><strong>match</strong></a>(self, database, strategy, word)</dt><dd><tt>Gets matches for a query. Arguments are database name,<br>
the strategy (see available ones in <a href="#Connection-getstratdescs">getstratdescs</a>()), and the<br>
pattern/word to look for. Returns a list of <a href="#Definition">Definition</a> objects.<br>
If there is no match, an empty list is returned.<br>
<br>
Note: database may be '*' which means to search all databases,<br>
or '!' which means to return matches from the first database that<br>
has a match.</tt></dd></dl>
<dl><dt><a name="Connection-saveconnectioninfo"><strong>saveconnectioninfo</strong></a>(self)</dt><dd><tt>Called by __init__ to handle the initial connection. Will<br>
save off the capabilities and messageid.</tt></dd></dl>
<dl><dt><a name="Connection-sendcommand"><strong>sendcommand</strong></a>(self, command)</dt><dd><tt>Takes a command, without a newline character, and sends it to<br>
the server.</tt></dd></dl>
<hr>
Data and non-method functions defined here:<br>
<dl><dt><strong>__doc__</strong> = 'This class is used to establish a connection to ... and the port to 2628, the port specified in RFC.'<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
<dl><dt><strong>__module__</strong> = 'dictclient'<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
</td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Database">class <strong>Database</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>An object corresponding to a particular database in a server.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Database-__init__"><strong>__init__</strong></a>(self, dictconn, dbname)</dt><dd><tt>Initialize the object -- requires a <a href="#Connection">Connection</a> object and<br>
a database name.</tt></dd></dl>
<dl><dt><a name="Database-define"><strong>define</strong></a>(self, word)</dt><dd><tt>Get a definition from within this database.<br>
The argument, word, is the word to look up. The return value is the<br>
same as from <a href="#Connection">Connection</a>.<a href="#Database-define">define</a>().</tt></dd></dl>
<dl><dt><a name="Database-getdescription"><strong>getdescription</strong></a>(self)</dt></dl>
<dl><dt><a name="Database-getinfo"><strong>getinfo</strong></a>(self)</dt><dd><tt>Returns a string of info describing this database.</tt></dd></dl>
<dl><dt><a name="Database-getname"><strong>getname</strong></a>(self)</dt><dd><tt>Returns the short name for this database.</tt></dd></dl>
<dl><dt><a name="Database-match"><strong>match</strong></a>(self, strategy, word)</dt><dd><tt>Get a match from within this database.<br>
The argument, word, is the word to look up. The return value is<br>
the same as from <a href="#Connection">Connection</a>.<a href="#Database-define">define</a>().</tt></dd></dl>
<hr>
Data and non-method functions defined here:<br>
<dl><dt><strong>__doc__</strong> = 'An object corresponding to a particular database in a server.'<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
<dl><dt><strong>__module__</strong> = 'dictclient'<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
</td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Definition">class <strong>Definition</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>An object corresponding to a single definition.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Definition-__init__"><strong>__init__</strong></a>(self, dictconn, db, word, defstr<font color="#909090">=None</font>)</dt><dd><tt>Instantiate the object. Requires: a <a href="#Connection">Connection</a> object,<br>
a <a href="#Database">Database</a> object (NOT corresponding to '*' or '!' databases),<br>
a word. Optional: a definition string. If not supplied,<br>
it will be fetched if/when it is requested.</tt></dd></dl>
<dl><dt><a name="Definition-getdb"><strong>getdb</strong></a>(self)</dt><dd><tt>Get the <a href="#Database">Database</a> object corresponding to this definition.</tt></dd></dl>
<dl><dt><a name="Definition-getdefstr"><strong>getdefstr</strong></a>(self)</dt><dd><tt>Get the definition string (the actual content) of this<br>
definition.</tt></dd></dl>
<dl><dt><a name="Definition-getword"><strong>getword</strong></a>(self)</dt><dd><tt>Get the word this object describes.</tt></dd></dl>
<hr>
Data and non-method functions defined here:<br>
<dl><dt><strong>__doc__</strong> = 'An object corresponding to a single definition.'<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
<dl><dt><strong>__module__</strong> = 'dictclient'<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
</td></tr></table></td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-dequote"><strong>dequote</strong></a>(str)</dt><dd><tt>Will remove single or double quotes from the start and end of a string<br>
and return the result.</tt></dd></dl>
<dl><dt><a name="-enquote"><strong>enquote</strong></a>(str)</dt><dd><tt>This function will put a string in double quotes, properly<br>
escaping any existing double quotes with a backslash. It will<br>
return the result.</tt></dd></dl>
</td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>__file__</strong> = './dictclient.pyc'<br>
<strong>__name__</strong> = 'dictclient'<br>
<strong>version</strong> = '1.0'</td></tr></table>
</body></html>
|