dictclient-1.0.3.1+nmu2/0000755000000000000000000000000012700337312011535 5ustar dictclient-1.0.3.1+nmu2/setup.py0000644000000000000000000000241010230225146013241 0ustar #!/usr/bin/env python2.2 # $Id: setup.py,v 1.4 2002/04/18 17:25:31 jgoerzen Exp $ # Python client for DICT protocol. # COPYRIGHT # # Copyright (C) 2002 John Goerzen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # END OF COPYRIGHT # from distutils.core import setup import dictclient setup(name = "dictclient", version = "1.0.1", description = "Client library for the dict protocol", author = "John Goerzen", author_email = 'jgoerzen@complete.org', url = 'gopher://quux.org/1/devel/dictclient', py_modules = ['dictclient'], license = "GPL version 2" ) dictclient-1.0.3.1+nmu2/Makefile0000644000000000000000000000034410230225146013173 0ustar doc: PYTHONPATH=`pwd` pydoc2.2 dictclient > dictclient.txt PYTHONPATH=`pwd` pydoc2.2 -w dictclient clean: -rm -f `find . -name "*~"` -rm -f `find . -name "*.pyc"` changelog: cvs2cl cvs commit ChangeLog rm ChangeLog.bak dictclient-1.0.3.1+nmu2/dictclient.txt0000644000000000000000000002132510230225146014420 0ustar Python Library Documentation: module dictclient NAME dictclient FILE /home/jgoerzen/tree/dictclient/dictclient.py DESCRIPTION # Client for the DICT protocol (RFC2229) # # Copyright (C) 2002 John Goerzen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA CLASSES Connection Database Definition class Connection | This class is used to establish a connection to a database server. | You will usually use this as the first call into the dictclient library. | Instantiating it takes two optional arguments: a hostname (a string) | and a port (an int). The hostname defaults to localhost | and the port to 2628, the port specified in RFC. | | Methods defined here: | | __init__(self, hostname='localhost', port=2628) | | define(self, database, word) | Returns a list of Definition objects for each matching | definition. Parameters are the database name and the word | to look up. This is one of the main functions you will use | to interact with the server. Returns a list of Definition | objects. If there are no matches, an empty list is returned. | | Note: database may be '*' which means to search all databases, | or '!' which means to return matches from the first database that | has a match. | | get100block(self) | Used when expecting multiple lines of text -- gets the block | part only. Does not get any codes or anything! Returns a string. | | get100dict(self) | Used when expecting a dictionary of results. Will read from | the initial 100 code, to a period and the 200 code. | | get100result(self) | Used when expecting multiple lines of text, terminated by a period | and a 200 code. Returns: [initialcode, [bodytext_1lineperentry], | finalcode] | | get200result(self) | Used when expecting a single line of text -- a 200-class | result. Returns [intcode, remaindertext] | | getcapabilities(self) | Returns a list of the capabilities advertised by the server. | | getdbdescs(self) | Gets a dict of available databases. The key is the db name | and the value is the db description. This command may generate | network traffic! | | getdbobj(self, dbname) | Gets a Database object corresponding to the database name passed | in. This function explicitly will *not* generate network traffic. | If you have not yet run getdbdescs(), it will fail. | | getmessageid(self) | Returns the message id, including angle brackets. | | getresultcode(self) | Generic function to get a result code. It will return a list | consisting of two items: the integer result code and the text | following. You will not usually use this function directly. | | getstratdescs(self) | Gets a dict of available strategies. The key is the strat | name and the value is the strat description. This call may | generate network traffic! | | match(self, database, strategy, word) | Gets matches for a query. Arguments are database name, | the strategy (see available ones in getstratdescs()), and the | pattern/word to look for. Returns a list of Definition objects. | If there is no match, an empty list is returned. | | Note: database may be '*' which means to search all databases, | or '!' which means to return matches from the first database that | has a match. | | saveconnectioninfo(self) | Called by __init__ to handle the initial connection. Will | save off the capabilities and messageid. | | sendcommand(self, command) | Takes a command, without a newline character, and sends it to | the server. | | ---------------------------------------------------------------------- | Data and non-method functions defined here: | | __doc__ = 'This class is used to establish a connection to ... and the... | str(object) -> string | | Return a nice string representation of the object. | If the argument is a string, the return value is the same object. | | __module__ = 'dictclient' | str(object) -> string | | Return a nice string representation of the object. | If the argument is a string, the return value is the same object. class Database | An object corresponding to a particular database in a server. | | Methods defined here: | | __init__(self, dictconn, dbname) | Initialize the object -- requires a Connection object and | a database name. | | define(self, word) | Get a definition from within this database. | The argument, word, is the word to look up. The return value is the | same as from Connection.define(). | | getdescription(self) | | getinfo(self) | Returns a string of info describing this database. | | getname(self) | Returns the short name for this database. | | match(self, strategy, word) | Get a match from within this database. | The argument, word, is the word to look up. The return value is | the same as from Connection.define(). | | ---------------------------------------------------------------------- | Data and non-method functions defined here: | | __doc__ = 'An object corresponding to a particular database in a serve... | str(object) -> string | | Return a nice string representation of the object. | If the argument is a string, the return value is the same object. | | __module__ = 'dictclient' | str(object) -> string | | Return a nice string representation of the object. | If the argument is a string, the return value is the same object. class Definition | An object corresponding to a single definition. | | Methods defined here: | | __init__(self, dictconn, db, word, defstr=None) | Instantiate the object. Requires: a Connection object, | a Database object (NOT corresponding to '*' or '!' databases), | a word. Optional: a definition string. If not supplied, | it will be fetched if/when it is requested. | | getdb(self) | Get the Database object corresponding to this definition. | | getdefstr(self) | Get the definition string (the actual content) of this | definition. | | getword(self) | Get the word this object describes. | | ---------------------------------------------------------------------- | Data and non-method functions defined here: | | __doc__ = 'An object corresponding to a single definition.' | str(object) -> string | | Return a nice string representation of the object. | If the argument is a string, the return value is the same object. | | __module__ = 'dictclient' | str(object) -> string | | Return a nice string representation of the object. | If the argument is a string, the return value is the same object. FUNCTIONS dequote(str) Will remove single or double quotes from the start and end of a string and return the result. enquote(str) This function will put a string in double quotes, properly escaping any existing double quotes with a backslash. It will return the result. DATA __file__ = './dictclient.py' __name__ = 'dictclient' version = '1.0' dictclient-1.0.3.1+nmu2/dictclient.html0000644000000000000000000004452110230225146014550 0ustar Python: module dictclient
 
 
dictclient
index
/home/jgoerzen/tree/dictclient/dictclient.py

# Client for the DICT protocol (RFC2229)
#
# Copyright (C) 2002 John Goerzen
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 
Modules
            
re
socket
 
Classes
            
Connection
Database
Definition
 
class Connection
      This class is used to establish a connection to a database server.
You will usually use this as the first call into the dictclient library.
Instantiating it takes two optional arguments: a hostname (a string)
and a port (an int).  The hostname defaults to localhost
and the port to 2628, the port specified in RFC.
 
   Methods defined here:
__init__(self, hostname='localhost', port=2628)
define(self, database, word)
Returns a list of Definition objects for each matching
definition.  Parameters are the database name and the word
to look up.  This is one of the main functions you will use
to interact with the server.  Returns a list of Definition
objects.  If there are no matches, an empty list is returned.
 
Note: database may be '*' which means to search all databases,
or '!' which means to return matches from the first database that
has a match.
get100block(self)
Used when expecting multiple lines of text -- gets the block
part only.  Does not get any codes or anything!  Returns a string.
get100dict(self)
Used when expecting a dictionary of results.  Will read from
the initial 100 code, to a period and the 200 code.
get100result(self)
Used when expecting multiple lines of text, terminated by a period
and a 200 code.  Returns: [initialcode, [bodytext_1lineperentry],
finalcode]
get200result(self)
Used when expecting a single line of text -- a 200-class
result.  Returns [intcode, remaindertext]
getcapabilities(self)
Returns a list of the capabilities advertised by the server.
getdbdescs(self)
Gets a dict of available databases.  The key is the db name
and the value is the db description.  This command may generate
network traffic!
getdbobj(self, dbname)
Gets a Database object corresponding to the database name passed
in.  This function explicitly will *not* generate network traffic.
If you have not yet run getdbdescs(), it will fail.
getmessageid(self)
Returns the message id, including angle brackets.
getresultcode(self)
Generic function to get a result code.  It will return a list
consisting of two items: the integer result code and the text
following.  You will not usually use this function directly.
getstratdescs(self)
Gets a dict of available strategies.  The key is the strat
name and the value is the strat description.  This call may
generate network traffic!
match(self, database, strategy, word)
Gets matches for a query.  Arguments are database name,
the strategy (see available ones in getstratdescs()), and the
pattern/word to look for.  Returns a list of Definition objects.
If there is no match, an empty list is returned.
 
Note: database may be '*' which means to search all databases,
or '!' which means to return matches from the first database that
has a match.
saveconnectioninfo(self)
Called by __init__ to handle the initial connection.  Will
save off the capabilities and messageid.
sendcommand(self, command)
Takes a command, without a newline character, and sends it to
the server.

Data and non-method functions defined here:
__doc__ = 'This class is used to establish a connection to ... and the port to 2628, the port specified in RFC.'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
__module__ = 'dictclient'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
 
class Database
      An object corresponding to a particular database in a server.
 
   Methods defined here:
__init__(self, dictconn, dbname)
Initialize the object -- requires a Connection object and
a database name.
define(self, word)
Get a definition from within this database.
The argument, word, is the word to look up.  The return value is the
same as from Connection.define().
getdescription(self)
getinfo(self)
Returns a string of info describing this database.
getname(self)
Returns the short name for this database.
match(self, strategy, word)
Get a match from within this database.
The argument, word, is the word to look up.  The return value is
the same as from Connection.define().

Data and non-method functions defined here:
__doc__ = 'An object corresponding to a particular database in a server.'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
__module__ = 'dictclient'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
 
class Definition
      An object corresponding to a single definition.
 
   Methods defined here:
__init__(self, dictconn, db, word, defstr=None)
Instantiate the object.  Requires: a Connection object,
Database object (NOT corresponding to '*' or '!' databases),
a word.  Optional: a definition string.  If not supplied,
it will be fetched if/when it is requested.
getdb(self)
Get the Database object corresponding to this definition.
getdefstr(self)
Get the definition string (the actual content) of this
definition.
getword(self)
Get the word this object describes.

Data and non-method functions defined here:
__doc__ = 'An object corresponding to a single definition.'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
__module__ = 'dictclient'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
 
Functions
            
dequote(str)
Will remove single or double quotes from the start and end of a string
and return the result.
enquote(str)
This function will put a string in double quotes, properly
escaping any existing double quotes with a backslash.  It will
return the result.
 
Data
             __file__ = './dictclient.pyc'
__name__ = 'dictclient'
version = '1.0'
dictclient-1.0.3.1+nmu2/debian/0000755000000000000000000000000012700337213012757 5ustar dictclient-1.0.3.1+nmu2/debian/emacsen-install.ex0000644000000000000000000000232710230225146016375 0ustar #! /bin/sh -e # /usr/lib/emacsen-common/packages/install/pygopherd # Written by Jim Van Zandt , borrowing heavily # from the install scripts for gettext by Santiago Vila # and octave by Dirk Eddelbuettel . FLAVOR=$1 PACKAGE=pygopherd if [ ${FLAVOR} = emacs ]; then exit 0; fi echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} #FLAVORTEST=`echo $FLAVOR | cut -c-6` #if [ ${FLAVORTEST} = xemacs ] ; then # SITEFLAG="-no-site-file" #else # SITEFLAG="--no-site-file" #fi FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile" ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} # Install-info-altdir does not actually exist. # Maybe somebody will write it. if test -x /usr/sbin/install-info-altdir; then echo install/${PACKAGE}: install Info links for ${FLAVOR} install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/info/${PACKAGE}.info.gz fi install -m 755 -d ${ELCDIR} cd ${ELDIR} FILES=`echo *.el` cp ${FILES} ${ELCDIR} cd ${ELCDIR} cat << EOF > path.el (setq load-path (cons "." load-path) byte-compile-warnings nil) EOF ${FLAVOR} ${FLAGS} ${FILES} rm -f *.el path.el exit 0 dictclient-1.0.3.1+nmu2/debian/emacsen-remove.ex0000644000000000000000000000072710230225146016226 0ustar #!/bin/sh -e # /usr/lib/emacsen-common/packages/remove/pygopherd FLAVOR=$1 PACKAGE=pygopherd if [ ${FLAVOR} != emacs ]; then if test -x /usr/sbin/install-info-altdir; then echo remove/${PACKAGE}: removing Info links for ${FLAVOR} install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/info/pygopherd.info.gz fi echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} fi dictclient-1.0.3.1+nmu2/debian/ex.package.doc-base0000644000000000000000000000103510230225146016360 0ustar Document: pygopherd Title: Debian pygopherd Manual Author: Abstract: This manual describes what pygopherd is and how it can be used to manage online manuals on Debian systems. Section: unknown Format: debiandoc-sgml Files: /usr/share/doc/pygopherd/pygopherd.sgml.gz Format: postscript Files: /usr/share/doc/pygopherd/pygopherd.ps.gz Format: text Files: /usr/share/doc/pygopherd/pygopherd.text.gz Format: HTML Index: /usr/share/doc/pygopherd/html/index.html Files: /usr/share/doc/pygopherd/html/*.html dictclient-1.0.3.1+nmu2/debian/manpage.1.ex0000644000000000000000000000356010230225146015065 0ustar .\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH PYGOPHERD SECTION "April 10, 2002" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME pygopherd \- program to do something .SH SYNOPSIS .B pygopherd .RI [ options ] " files" ... .br .B bar .RI [ options ] " files" ... .SH DESCRIPTION This manual page documents briefly the .B pygopherd and .B bar commands. This manual page was written for the Debian distribution because the original program does not have a manual page. Instead, it has documentation in the GNU Info format; see below. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. \fBpygopherd\fP is a program that... .SH OPTIONS These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the Info files. .TP .B \-h, \-\-help Show summary of options. .TP .B \-v, \-\-version Show version of program. .SH SEE ALSO .BR bar (1), .BR baz (1). .br The programs are documented fully by .IR "The Rise and Fall of a Fooish Bar" , available via the Info system. .SH AUTHOR This manual page was written by John Goerzen , for the Debian GNU/Linux system (but may be used by others). dictclient-1.0.3.1+nmu2/debian/emacsen-startup.ex0000644000000000000000000000133210230225146016424 0ustar ;; -*-emacs-lisp-*- ;; ;; Emacs startup file for the Debian GNU/Linux pygopherd package ;; ;; Originally contributed by Nils Naumann ;; Modified by Dirk Eddelbuettel ;; Adapted for dh-make by Jim Van Zandt ;; The pygopherd package follows the Debian/GNU Linux 'emacsen' policy and ;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, ;; xemacs19, emacs20, xemacs20...). The compiled code is then ;; installed in a subdirectory of the respective site-lisp directory. ;; We have to add this to the load-path: (setq load-path (cons (concat "/usr/share/" (symbol-name flavor) "/site-lisp/pygopherd") load-path)) dictclient-1.0.3.1+nmu2/debian/prerm.ex0000644000000000000000000000167210230225146014445 0ustar #! /bin/sh # prerm script for pygopherd # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `remove' # * `upgrade' # * `failed-upgrade' # * `remove' `in-favour' # * `deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in remove|upgrade|deconfigure) # install-info --quiet --remove /usr/info/pygopherd.info.gz ;; failed-upgrade) ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 dictclient-1.0.3.1+nmu2/debian/preinst.ex0000644000000000000000000000164310230225146015002 0ustar #! /bin/sh # preinst script for pygopherd # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `install' # * `install' # * `upgrade' # * `abort-upgrade' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in install|upgrade) # if [ "$1" = "upgrade" ] # then # start-stop-daemon --stop --quiet --oknodo \ # --pidfile /var/run/pygopherd.pid \ # --exec /usr/sbin/pygopherd 2>/dev/null || true # fi ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 dictclient-1.0.3.1+nmu2/debian/rules0000755000000000000000000000377712676003215014061 0ustar #!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Modified by John Goerzen # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This is the debhelper compatibility version to use. #export DH_COMPAT=3 PYTHON=python PACKAGE=python-dictclient ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) CFLAGS += -g endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. #$(PYTHON) setup.py configure touch configure-stamp build: build-stamp build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. $(PYTHON) setup.py build #/usr/bin/docbook-to-man debian/pygopherd.sgml > pygopherd.1 touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) clean -$(PYTHON) setup.py clean --all dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/pygopherd. #$(MAKE) install DESTDIR=$(CURDIR)/debian/pygopherd $(PYTHON) setup.py install --root=`pwd`/debian/$(PACKAGE) --no-compile --install-layout=deb # Build architecture-dependent files here. binary-arch: build install # We have nothing to do by default. # Build architecture-independent files here. binary-indep: build install dh_testdir dh_testroot # dh_installdebconf dh_installdocs dh_installexamples dh_installmenu # dh_installlogrotate # dh_installemacsen # dh_installpam # dh_installmime dh_installinit dh_installcron dh_installman dh_installinfo # dh_undocumented dh_installchangelogs dh_python2 dh_link dh_strip dh_compress dh_fixperms # dh_makeshlibs dh_installdeb # dh_perl dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure dictclient-1.0.3.1+nmu2/debian/watch.ex0000644000000000000000000000041710230225146014422 0ustar # Example watch control file for uscan # Rename this file to "watch" and then you can run the "uscan" command # to check for upstream updates and more. # Site Directory Pattern Version Script sunsite.unc.edu /pub/Linux/Incoming pygopherd-(.*)\.tar\.gz debian uupdate dictclient-1.0.3.1+nmu2/debian/control0000644000000000000000000000151112676222103014363 0ustar Source: dictclient Section: interpreters Priority: optional Maintainer: John Goerzen Build-Depends: debhelper (>=9), dh-python, python-all-dev (>= 2.6.6-3~) Standards-Version: 3.9.7 Package: python-dictclient Architecture: all Provides: ${python:Provides} Depends: ${misc:Depends}, ${python:Depends} Suggests: dictd Description: Python client library for DICT (RFC2229) protocol This is a new library for interacting with Dict servers. It defines three classes -- Connection, Database, and Definition. It supports all common Dict server requests, including definitions, matching, and getting information about available databases, capabilities, etc. You can use it to communicate to a local or remote dictd database. The homepage for this package (includes docs) is at gopher://quux.org/1/devel/dictclient. dictclient-1.0.3.1+nmu2/debian/cron.d.ex0000644000000000000000000000012710230225146014475 0ustar # # Regular cron jobs for the pygopherd package # 0 4 * * * root pygopherd_maintenance dictclient-1.0.3.1+nmu2/debian/examples0000644000000000000000000000001310230225146014507 0ustar examples/* dictclient-1.0.3.1+nmu2/debian/menu.ex0000644000000000000000000000017010230225146014254 0ustar ?package(pygopherd):needs=X11|text|vc|wm section=Apps/see-menu-manual\ title="pygopherd" command="/usr/bin/pygopherd" dictclient-1.0.3.1+nmu2/debian/compat0000644000000000000000000000000212675765421014176 0ustar 9 dictclient-1.0.3.1+nmu2/debian/copyright0000644000000000000000000000206310230225146014710 0ustar This package was debianized by John Goerzen on Thu, 18 Apr 2002 06:58:31 -0500. It was downloaded from gopher://quux.org/1/devel/dictclient Upstream Author(s): John Goerzen Copyright: Copyright (C) 2002 John Goerzen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Debian GNU/Linux may find the GNU General Public License, version 2, in /usr/share/common-licenses/GPL-2. dictclient-1.0.3.1+nmu2/debian/docs0000644000000000000000000000005110230225146013623 0ustar ChangeLog dictclient.html dictclient.txt dictclient-1.0.3.1+nmu2/debian/changelog0000644000000000000000000000316012676223015014637 0ustar dictclient (1.0.3.1+nmu2) unstable; urgency=medium * Non-maintainer upload. * Update DH level to 9. (Closes: #800233) * debian/compat: created and set to 9, instead of using DH_COMPAT. * debian/control: - Added dh-python in Build-Depends. - Added the ${misc:Depends} variable to provide the right install dependencies. - Bumped Standards-Version to 3.9.7. * debian/rules: - Disabled the DH_COMPAT line. - Fixed ignores make clean target errors. Thanks to Sebastian Carneiro (Closes: #694764) -- Giovani Augusto Ferreira Sun, 27 Mar 2016 11:14:03 -0300 dictclient (1.0.3.1+nmu1) unstable; urgency=low * Non-maintainer upload. * Convert to dh_python2 (Closes: #616789). -- Luca Falavigna Mon, 27 May 2013 08:57:40 +0200 dictclient (1.0.3.1) unstable; urgency=low * NMU. Rebuild to move files to /usr/share/pyshared. Closes: #490456. -- Matthias Klose Fri, 18 Jul 2008 15:57:11 +0000 dictclient (1.0.3) unstable; urgency=medium * Update to new Python policy. Closes: #380774. -- John Goerzen Mon, 11 Sep 2006 09:20:21 -0500 dictclient (1.0.2) unstable; urgency=low * Updated Debian package for Python 2.3. -- John Goerzen Mon, 18 Aug 2003 16:02:57 -0500 dictclient (1.0.1) unstable; urgency=low * Added a fix for matching. -- John Goerzen Thu, 18 Apr 2002 12:24:17 -0500 dictclient (1.0) unstable; urgency=low * Initial release. Closes: #143451. -- John Goerzen Thu, 18 Apr 2002 06:58:31 -0500 dictclient-1.0.3.1+nmu2/debian/manpage.sgml.ex0000644000000000000000000001072210230225146015665 0ustar manpage.1'. You may view the manual page with: `docbook-to-man manpage.sgml | nroff -man | less'. A typical entry in a Makefile or Makefile.am is: manpage.1: manpage.sgml docbook-to-man $< > $@ The docbook-to-man binary is found in the docbook-to-man package. Please remember that if you create the nroff version in one of the debian/rules file targets (such as build), you will need to include docbook-to-man in your Build-Depends control field. --> FIRSTNAME"> SURNAME"> April 10, 2002"> SECTION"> jgoerzen@complete.org"> PYGOPHERD"> Debian"> GNU"> ]>
&dhemail;
&dhfirstname; &dhsurname; 2001 &dhusername; &dhdate;
&dhucpackage; &dhsection; &dhpackage; program to do something &dhpackage; DESCRIPTION This manual page documents briefly the &dhpackage; and bar commands. This manual page was written for the &debian; distribution because the original program does not have a manual page. Instead, it has documentation in the &gnu; Info format; see below. &dhpackage; is a program that... OPTIONS These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the Info files. Show summary of options. Show version of program. SEE ALSO bar (1), baz (1). The programs are documented fully by The Rise and Fall of a Fooish Bar available via the Info system. AUTHOR This manual page was written by &dhusername; &dhemail; for the &debian; system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts.
dictclient-1.0.3.1+nmu2/ChangeLog0000644000000000000000000000243610230225146013311 0ustar 2002-04-18 12:25 jgoerzen * setup.py, debian/changelog: Updated. 2002-04-18 12:25 jgoerzen * ChangeLog: Updated for 1.0.1 2002-04-18 10:59 jgoerzen * dictclient.py: Fix for multi-word matches. 2002-04-18 09:55 jgoerzen * debian/rules: Fixed a package name problem. 2002-04-18 09:51 jgoerzen * setup.py: Fixed to the proper setup.py 2002-04-18 09:51 jgoerzen * setup.py: Setup.py: fixed a leftover from pygopherd 2002-04-18 09:50 jgoerzen * debian/: conffiles, rules: Updated. 2002-04-18 09:48 jgoerzen * ChangeLog, Makefile, debian/changelog, debian/conffiles, debian/control, debian/copyright, debian/cron.d.ex, debian/docs, debian/emacsen-install.ex, debian/emacsen-remove.ex, debian/emacsen-startup.ex, debian/ex.package.doc-base, debian/examples, debian/manpage.1.ex, debian/manpage.sgml.ex, debian/menu.ex, debian/preinst.ex, debian/prerm.ex, debian/rules, debian/watch.ex: Added ChangeLog and debian files. 2002-04-18 09:41 jgoerzen * dictclient.html, dictclient.txt: Added. 2002-04-18 09:40 jgoerzen * COPYING, Makefile, README, dictclient.py, setup.py: Added, updated 2002-04-17 14:14 jgoerzen * dictclient.py: [no log message] 2002-04-17 14:06 jgoerzen * dictclient.py: [no log message] 2002-04-17 13:51 jgoerzen * dictclient.py: Initial add dictclient-1.0.3.1+nmu2/README0000644000000000000000000000017310230225146012413 0ustar This is a client library for connecting to DICT servers. Documentation may be found in dictclient.txt or dictclient.html. dictclient-1.0.3.1+nmu2/dictclient.py0000644000000000000000000003011310230225146014224 0ustar # Client for the DICT protocol (RFC2229) # # Copyright (C) 2002 John Goerzen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import socket, re version = '1.0.2' def dequote(str): """Will remove single or double quotes from the start and end of a string and return the result.""" quotechars = "'\"" while len(str) and str[0] in quotechars: str = str[1:] while len(str) and str[-1] in quotechars: str = str[0:-1] return str def enquote(str): """This function will put a string in double quotes, properly escaping any existing double quotes with a backslash. It will return the result.""" return '"' + str.replace('"', "\\\"") + '"' class Connection: """This class is used to establish a connection to a database server. You will usually use this as the first call into the dictclient library. Instantiating it takes two optional arguments: a hostname (a string) and a port (an int). The hostname defaults to localhost and the port to 2628, the port specified in RFC.""" def __init__(self, hostname = 'localhost', port = 2628): self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((hostname, port)) self.rfile = self.sock.makefile("rt") self.wfile = self.sock.makefile("wt", 0) self.saveconnectioninfo() def getresultcode(self): """Generic function to get a result code. It will return a list consisting of two items: the integer result code and the text following. You will not usually use this function directly.""" line = self.rfile.readline().strip() code, text = line.split(' ', 1) return [int(code), text] def get200result(self): """Used when expecting a single line of text -- a 200-class result. Returns [intcode, remaindertext]""" code, text = self.getresultcode() if code < 200 or code >= 300: raise Exception, "Got '%s' when 200-class response expected" % \ line return [code, text] def get100block(self): """Used when expecting multiple lines of text -- gets the block part only. Does not get any codes or anything! Returns a string.""" data = [] while 1: line = self.rfile.readline().strip() if line == '.': break data.append(line) return "\n".join(data) def get100result(self): """Used when expecting multiple lines of text, terminated by a period and a 200 code. Returns: [initialcode, [bodytext_1lineperentry], finalcode]""" code, text = self.getresultcode() if code < 100 or code >= 200: raise Exception, "Got '%s' when 100-class response expected" % \ code bodylines = self.get100block().split("\n") code2 = self.get200result()[0] return [code, bodylines, code2] def get100dict(self): """Used when expecting a dictionary of results. Will read from the initial 100 code, to a period and the 200 code.""" dict = {} for line in self.get100result()[1]: key, val = line.split(' ', 1) dict[key] = dequote(val) return dict def saveconnectioninfo(self): """Called by __init__ to handle the initial connection. Will save off the capabilities and messageid.""" code, string = self.get200result() assert code == 220 capstr, msgid = re.search('<(.*)> (<.*>)$', string).groups() self.capabilities = capstr.split('.') self.messageid = msgid def getcapabilities(self): """Returns a list of the capabilities advertised by the server.""" return self.capabilities def getmessageid(self): """Returns the message id, including angle brackets.""" return self.messageid def getdbdescs(self): """Gets a dict of available databases. The key is the db name and the value is the db description. This command may generate network traffic!""" if hasattr(self, 'dbdescs'): return self.dbdescs self.sendcommand("SHOW DB") self.dbdescs = self.get100dict() return self.dbdescs def getstratdescs(self): """Gets a dict of available strategies. The key is the strat name and the value is the strat description. This call may generate network traffic!""" if hasattr(self, 'stratdescs'): return self.stratdescs self.sendcommand("SHOW STRAT") self.stratdescs = self.get100dict() return self.stratdescs def getdbobj(self, dbname): """Gets a Database object corresponding to the database name passed in. This function explicitly will *not* generate network traffic. If you have not yet run getdbdescs(), it will fail.""" if not hasattr(self, 'dbobjs'): self.dbobjs = {} if self.dbobjs.has_key(dbname): return self.dbobjs[dbname] # We use self.dbdescs explicitly since we don't want to # generate net traffic with this request! if dbname != '*' and dbname != '!' and \ not dbname in self.dbdescs.keys(): raise Exception, "Invalid database name '%s'" % dbname self.dbobjs[dbname] = Database(self, dbname) return self.dbobjs[dbname] def sendcommand(self, command): """Takes a command, without a newline character, and sends it to the server.""" self.wfile.write(command + "\n") def define(self, database, word): """Returns a list of Definition objects for each matching definition. Parameters are the database name and the word to look up. This is one of the main functions you will use to interact with the server. Returns a list of Definition objects. If there are no matches, an empty list is returned. Note: database may be '*' which means to search all databases, or '!' which means to return matches from the first database that has a match.""" self.getdbdescs() # Prime the cache if database != '*' and database != '!' and \ not database in self.getdbdescs(): raise Exception, "Invalid database '%s' specified" % database self.sendcommand("DEFINE " + enquote(database) + " " + enquote(word)) code = self.getresultcode()[0] retval = [] if code == 552: # No definitions. return [] if code != 150: raise Exception, "Unknown code %d" % code while 1: code, text = self.getresultcode() if code != 151: break resultword, resultdb = re.search('^"(.+)" (\S+)', text).groups() defstr = self.get100block() retval.append(Definition(self, self.getdbobj(resultdb), resultword, defstr)) return retval def match(self, database, strategy, word): """Gets matches for a query. Arguments are database name, the strategy (see available ones in getstratdescs()), and the pattern/word to look for. Returns a list of Definition objects. If there is no match, an empty list is returned. Note: database may be '*' which means to search all databases, or '!' which means to return matches from the first database that has a match.""" self.getstratdescs() # Prime the cache self.getdbdescs() # Prime the cache if not strategy in self.getstratdescs().keys(): raise Exception, "Invalid strategy '%s'" % strategy if database != '*' and database != '!' and \ not database in self.getdbdescs().keys(): raise Exception, "Invalid database name '%s'" % database self.sendcommand("MATCH %s %s %s" % (enquote(database), enquote(strategy), enquote(word))) code = self.getresultcode()[0] if code == 552: # No Matches return [] if code != 152: raise Exception, "Unexpected code %d" % code retval = [] for matchline in self.get100block().split("\n"): matchdict, matchword = matchline.split(" ", 1) retval.append(Definition(self, self.getdbobj(matchdict), dequote(matchword))) if self.getresultcode()[0] != 250: raise Exception, "Unexpected end-of-list code %d" % code return retval class Database: """An object corresponding to a particular database in a server.""" def __init__(self, dictconn, dbname): """Initialize the object -- requires a Connection object and a database name.""" self.conn = dictconn self.name = dbname def getname(self): """Returns the short name for this database.""" return self.name def getdescription(self): if hasattr(self, 'description'): return self.description if self.getname() == '*': self.description = 'All Databases' elif self.getname() == '!': self.description = 'First matching database' else: self.description = self.conn.getdbdescs()[self.getname()] return self.description def getinfo(self): """Returns a string of info describing this database.""" if hasattr(self, 'info'): return self.info if self.getname() == '*': self.info = "This special database will search all databases on the system." elif self.getname() == '!': self.info = "This special database will return matches from the first matching database." else: self.conn.sendcommand("SHOW INFO " + self.name) self.info = "\n".join(self.conn.get100result()[1]) return self.info def define(self, word): """Get a definition from within this database. The argument, word, is the word to look up. The return value is the same as from Connection.define().""" return self.conn.define(self.getname(), word) def match(self, strategy, word): """Get a match from within this database. The argument, word, is the word to look up. The return value is the same as from Connection.define().""" return self.conn.match(self.getname(), strategy, word) class Definition: """An object corresponding to a single definition.""" def __init__(self, dictconn, db, word, defstr = None): """Instantiate the object. Requires: a Connection object, a Database object (NOT corresponding to '*' or '!' databases), a word. Optional: a definition string. If not supplied, it will be fetched if/when it is requested.""" self.conn = dictconn self.db = db self.word = word self.defstr = defstr def getdb(self): """Get the Database object corresponding to this definition.""" return self.db def getdefstr(self): """Get the definition string (the actual content) of this definition.""" if not self.defstr: self.defstr = self.conn.define(self.getdb().getname(), self.word)[0].getdefstr() return self.defstr def getword(self): """Get the word this object describes.""" return self.word dictclient-1.0.3.1+nmu2/COPYING0000644000000000000000000004311010230225146012564 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. dictclient-1.0.3.1+nmu2/dictclient.pyc0000644000000000000000000003310112700337312014372 0ustar ó f*aBc@smddlZddlZdZd„Zd„Zdd d„ƒYZdd d„ƒYZd d d „ƒYZdS(iÿÿÿÿNs1.0.2cCsgd}x*t|ƒr2|d|kr2|d}q Wx-t|ƒrb|d|krb|dd!}q6W|S(saWill remove single or double quotes from the start and end of a string and return the result.s'"iiiÿÿÿÿ(tlen(tstrt quotechars((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pytdequotes cCsd|jddƒdS(s”This function will put a string in double quotes, properly escaping any existing double quotes with a backslash. It will return the result.t"s\"(treplace(R((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pytenquote!st ConnectioncBs›eZdZddd„Zd„Zd„Zd„Zd„Zd„Zd „Z d „Z d „Z d „Z d „Z d„Zd„Zd„Zd„ZRS(sJThis class is used to establish a connection to a database server. You will usually use this as the first call into the dictclient library. Instantiating it takes two optional arguments: a hostname (a string) and a port (an int). The hostname defaults to localhost and the port to 2628, the port specified in RFC.t localhostiD cCsltjtjtjƒ|_|jj||fƒ|jjdƒ|_|jjddƒ|_|jƒdS(Ntrttwti( tsockettAF_INETt SOCK_STREAMtsocktconnecttmakefiletrfiletwfiletsaveconnectioninfo(tselfthostnametport((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyt__init__-s cCs=|jjƒjƒ}|jddƒ\}}t|ƒ|gS(sÈGeneric function to get a result code. It will return a list consisting of two items: the integer result code and the text following. You will not usually use this function directly.t i(Rtreadlinetstriptsplittint(Rtlinetcodettext((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyt getresultcode4scCsD|jƒ\}}|dks*|dkr:tdt‚n||gS(sjUsed when expecting a single line of text -- a 200-class result. Returns [intcode, remaindertext]iÈi,s)Got '%s' when 200-class response expected(R t ExceptionR(RRR((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyt get200result<s  cCsLg}x6|jjƒjƒ}|dkr.Pn|j|ƒq Wdj|ƒS(s‡Used when expecting multiple lines of text -- gets the block part only. Does not get any codes or anything! Returns a string.t.s (RRRtappendtjoin(RtdataR((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyt get100blockFs cCsl|jƒ\}}|dks*|dkr:td|‚n|jƒjdƒ}|jƒd}|||gS(sŸUsed when expecting multiple lines of text, terminated by a period and a 200 code. Returns: [initialcode, [bodytext_1lineperentry], finalcode]idiÈs)Got '%s' when 100-class response expecteds i(R R!R'RR"(RRRt bodylinestcode2((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyt get100resultQs cCsMi}x@|jƒdD].}|jddƒ\}}t|ƒ||/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyt get100dict_s cCsa|jƒ\}}|dks$t‚tjd|ƒjƒ\}}|jdƒ|_||_dS(skCalled by __init__ to handle the initial connection. Will save off the capabilities and messageid.iÜs<(.*)> (<.*>)$R#N(R"tAssertionErrortretsearchtgroupsRt capabilitiest messageid(RRtstringtcapstrtmsgid((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyRhs cCs|jS(s<Returns a list of the capabilities advertised by the server.(R3(R((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pytgetcapabilitiesqscCs|jS(s1Returns the message id, including angle brackets.(R4(R((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyt getmessageiduscCs9t|dƒr|jS|jdƒ|jƒ|_|jS(sœGets a dict of available databases. The key is the db name and the value is the db description. This command may generate network traffic!tdbdescssSHOW DB(thasattrR:t sendcommandR.(R((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyt getdbdescsys  cCs9t|dƒr|jS|jdƒ|jƒ|_|jS(s Gets a dict of available strategies. The key is the strat name and the value is the strat description. This call may generate network traffic!t stratdescss SHOW STRAT(R;R>R<R.(R((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyt getstratdescs„s  cCs–t|dƒsi|_n|jj|ƒr8|j|S|dkru|dkru||jjƒkrutd|‚nt||ƒ|j|<|j|S(sÇGets a Database object corresponding to the database name passed in. This function explicitly will *not* generate network traffic. If you have not yet run getdbdescs(), it will fail.tdbobjst*t!sInvalid database name '%s'(R;R@thas_keyR:tkeysR!tDatabase(Rtdbname((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pytgetdbobjs  cCs|jj|dƒdS(sQTakes a command, without a newline character, and sends it to the server.s N(Rtwrite(Rtcommand((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyR<£sc Cs'|jƒ|dkrD|dkrD||jƒkrDtd|‚n|jdt|ƒdt|ƒƒ|jƒd}g}|dkrgS|dkr«td |‚nxu|jƒ\}}|d krÐPntjd |ƒjƒ\}}|jƒ}|j t ||j |ƒ||ƒƒq®W|S( síReturns a list of Definition objects for each matching definition. Parameters are the database name and the word to look up. This is one of the main functions you will use to interact with the server. Returns a list of Definition objects. If there are no matches, an empty list is returned. Note: database may be '*' which means to search all databases, or '!' which means to return matches from the first database that has a match.RARBsInvalid database '%s' specifiedsDEFINE Rii(i–sUnknown code %di—s ^"(.+)" (\S+)( R=R!R<RR R0R1R2R'R$t DefinitionRG( RtdatabasetwordRtretvalRt resultwordtresultdbtdefstr((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pytdefine¨s( %    c Cst|jƒ|jƒ||jƒjƒkr<td|‚n|dkr||dkr|||jƒjƒkr|td|‚n|jdt|ƒt|ƒt|ƒfƒ|jƒd}|dkrÈgS|dkrätd |‚ng}x]|jƒjd ƒD]F}|jd d ƒ\}}|j t ||j |ƒt |ƒƒƒqW|jƒdd krptd|‚n|S(s¦Gets matches for a query. Arguments are database name, the strategy (see available ones in getstratdescs()), and the pattern/word to look for. Returns a list of Definition objects. If there is no match, an empty list is returned. Note: database may be '*' which means to search all databases, or '!' which means to return matches from the first database that has a match.sInvalid strategy '%s'RARBsInvalid database name '%s'sMATCH %s %s %sii(i˜sUnexpected code %ds RiiúsUnexpected end-of-list code %d( R?R=RDR!R<RR R'RR$RJRGR( RRKtstrategyRLRRMt matchlinet matchdictt matchword((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pytmatchÎs.     (t__name__t __module__t__doc__RR R"R'R*R.RR8R9R=R?RGR<RQRV(((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyR's        &REcBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(s=An object corresponding to a particular database in a server.cCs||_||_dS(sRInitialize the object -- requires a Connection object and a database name.N(tconntname(RtdictconnRF((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyRõs cCs|jS(s)Returns the short name for this database.(R[(R((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pytgetnameûscCsut|dƒr|jS|jƒdkr4d|_n:|jƒdkrRd|_n|jjƒ|jƒ|_|jS(Nt descriptionRAs All DatabasesRBsFirst matching database(R;R^R]RZR=(R((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pytgetdescriptionÿs  cCst|dƒr|jS|jƒdkr4d|_nT|jƒdkrRd|_n6|jjd|jƒdj|jjƒdƒ|_|jS( s2Returns a string of info describing this database.tinfoRAs>This special database will search all databases on the system.RBsKThis special database will return matches from the first matching database.s SHOW INFO s i(R;R`R]RZR<R[R%R*(R((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pytgetinfo s  cCs|jj|jƒ|ƒS(s¢Get a definition from within this database. The argument, word, is the word to look up. The return value is the same as from Connection.define().(RZRQR](RRL((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyRQscCs|jj|jƒ||ƒS(sGet a match from within this database. The argument, word, is the word to look up. The return value is the same as from Connection.define().(RZRVR](RRRRL((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyRVs( RWRXRYRR]R_RaRQRV(((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyREós    RJcBs5eZdZdd„Zd„Zd„Zd„ZRS(s/An object corresponding to a single definition.cCs(||_||_||_||_dS(sôInstantiate the object. Requires: a Connection object, a Database object (NOT corresponding to '*' or '!' databases), a word. Optional: a definition string. If not supplied, it will be fetched if/when it is requested.N(RZtdbRLRP(RR\RbRLRP((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyR&s   cCs|jS(s9Get the Database object corresponding to this definition.(Rb(R((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pytgetdb0scCsD|js=|jj|jƒjƒ|jƒdjƒ|_n|jS(sJGet the definition string (the actual content) of this definition.i(RPRZRQRcR]RLt getdefstr(R((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyRd4s 4cCs|jS(s#Get the word this object describes.(RL(R((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pytgetword;sN(RWRXRYtNoneRRcRdRe(((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyRJ$s   ((((R R0tversionRRRRERJ(((s>/build/dictclient-Vkb8kn/dictclient-1.0.3.1+nmu2/dictclient.pyts  Ì1