summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>2008-07-13 21:32:22 +0200
committerNicolas Chauvat <nicolas.chauvat@logilab.fr>2008-07-13 21:32:22 +0200
commitaab929e273a41a188a244b5d2c8b3e53408172ab (patch)
treebdbb169569082a3290de6dbdaf7ef7d68bc919c1
parent47df8cd6dff5c08b32966a7b59b5da75d23123de (diff)
downloadlogilab-common-aab929e273a41a188a244b5d2c8b3e53408172ab.tar.gz
improve doc for better epydoc generation.
-rw-r--r--__init__.py35
-rw-r--r--__pkginfo__.py23
-rw-r--r--adbh.py21
-rw-r--r--astutils.py25
-rw-r--r--bind.py25
-rw-r--r--cache.py24
-rw-r--r--changelog.py21
-rw-r--r--clcommands.py28
-rw-r--r--cli.py27
-rw-r--r--compat.py27
-rw-r--r--configuration.py21
-rw-r--r--corbautils.py8
-rw-r--r--daemon.py24
-rw-r--r--date.py24
-rw-r--r--db.py24
-rw-r--r--debugger.py7
-rw-r--r--decorators.py38
-rw-r--r--deprecation.py22
-rw-r--r--doc/makefile19
-rw-r--r--fileutils.py66
-rw-r--r--graph.py27
-rw-r--r--html.py24
-rw-r--r--interface.py33
-rw-r--r--logger.py27
-rw-r--r--logging_ext.py26
-rw-r--r--logservice.py12
-rw-r--r--modutils.py27
-rw-r--r--monclient.py8
-rw-r--r--monserver.py22
-rw-r--r--optik_ext.py23
-rw-r--r--optparser.py22
-rw-r--r--patricia.py25
-rw-r--r--pdf_ext.py28
-rw-r--r--pytest.py6
-rw-r--r--setup.py23
-rw-r--r--shellutils.py44
-rw-r--r--sqlgen.py62
-rw-r--r--table.py9
-rw-r--r--testlib.py32
-rw-r--r--textutils.py20
-rw-r--r--tree.py24
-rw-r--r--twisted_distutils.py20
-rw-r--r--umessage.py15
-rw-r--r--vcgutils.py33
-rw-r--r--visitor.py28
-rw-r--r--xmlrpcutils.py22
46 files changed, 389 insertions, 762 deletions
diff --git a/__init__.py b/__init__.py
index 006f92b..5367194 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,32 +1,21 @@
-# Copyright (c) 2003-2006 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
-"""Logilab common libraries:
-
-a set of common functionnalities shared among logilab projects
+"""Logilab common library.
+A set of common functionnalities shared by Logilab's projects.
:type STD_BLACKLIST: tuple
-:var STD_BLACKLIST:
- directories ignored by default by the functions in this package which have
- to recurse into directories
+:var STD_BLACKLIST: directories ignored by default by the functions in
+ this package which have to recurse into directories
:type IGNORED_EXTENSIONS: tuple
-:var IGNORED_EXTENSIONS:
- file extensions that may usually be ignored
+:var IGNORED_EXTENSIONS: file extensions that may usually be ignored
+
+:organization: Logilab
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
+from logilab.common.__pkginfo__ import version as __version__
STD_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build')
diff --git a/__pkginfo__.py b/__pkginfo__.py
index 8051323..b8da7db 100644
--- a/__pkginfo__.py
+++ b/__pkginfo__.py
@@ -1,19 +1,10 @@
-# Copyright (c) 2003-2008 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-
-# 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.
-"""logilab.common packaging information"""
+"""logilab.common packaging information.
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
+"""
+__docformat__ = "restructuredtext en"
distname = 'logilab-common'
modname = 'common'
diff --git a/adbh.py b/adbh.py
index 70f3b69..c772e8b 100644
--- a/adbh.py
+++ b/adbh.py
@@ -1,23 +1,10 @@
-# 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.
-"""This module contains helpers for DBMS specific (advanced or non standard)
-functionalities
+"""Helpers for DBMS specific (advanced or non standard) functionalities.
Helpers are provided for postgresql, mysql and sqlite.
-:author: Logilab
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
-:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
__docformat__ = "restructuredtext en"
diff --git a/astutils.py b/astutils.py
index a6e1c32..4c2b4b6 100644
--- a/astutils.py
+++ b/astutils.py
@@ -1,28 +1,17 @@
-# Copyright (c) 2003 Sylvain Thenault (thenault@nerim.net)
-# Copyright (c) 2003 Logilab
-#
-# 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.
-"""Some usefull functions to manipulate ast tuples
+"""functions to manipulate ast tuples.
+
+:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
+__author__ = u"Sylvain Thenault"
from warnings import warn
warn('this module has been moved into logilab.astng and will disappear from \
logilab.common in a future release',
DeprecationWarning, stacklevel=1)
-__author__ = u"Sylvain Thenault"
-
import symbol
import token
from types import TupleType
diff --git a/bind.py b/bind.py
index a130c5b..b5f99f8 100644
--- a/bind.py
+++ b/bind.py
@@ -1,29 +1,16 @@
-# 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.
+"""Optimize globals in certain functions by binding their names to values
+provided in a dictionnary.
-""" Copyright (c) 2002-2003 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
-
- This module provides a way to optimize globals in certain functions by binding
- their names to values provided in a dictionnary
+:copyright: 2002-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
from warnings import warn
warn('logilab.common.bind module is deprecated and will disappear in a near release',
DeprecationWarning, stacklevel=2)
-__revision__ = '$Id: bind.py,v 1.8 2005-11-22 13:12:59 syt Exp $'
-
# TODO: unit tests
# * this module provide a function bind(func,vars) which replaces every
# global variable 'm' by the value vars['m'] if such value exists in dict
diff --git a/cache.py b/cache.py
index 5a966e8..7ee697f 100644
--- a/cache.py
+++ b/cache.py
@@ -1,21 +1,11 @@
-# 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.
-""" Copyright (c) 2002-2003 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
+"""Cache module, with a least recently used algorithm for the management of the
+deletion of entries.
- Cache module, with a least recently used algorithm for the management of the
- deletion of entries.
+:copyright: 2002-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
from threading import Lock
@@ -24,7 +14,7 @@ from logilab.common.decorators import locked
_marker = object()
class Cache:
- """ a dictionnary like cache
+ """A dictionnary like cache.
inv:
len(self._usage) <= self.size
diff --git a/changelog.py b/changelog.py
index 25191b5..91b30da 100644
--- a/changelog.py
+++ b/changelog.py
@@ -1,16 +1,4 @@
-# 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.
-"""Manipulation of upstream change log files
+"""Manipulation of upstream change log files.
The upstream change log files format handled is simpler than the one
often used such as those generated by the default Emacs changelog mode.
@@ -39,10 +27,11 @@ release.
All the non empty lines before the first entry are considered as the change
log title.
-:author: Logilab
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
-:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
+:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
import sys
from stat import S_IWRITE
diff --git a/clcommands.py b/clcommands.py
index 57ea325..e68fa7f 100644
--- a/clcommands.py
+++ b/clcommands.py
@@ -1,24 +1,14 @@
-# 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.
-"""provides helper functions to handle a command line tool providing more than
-one command
+"""Helper functions to support command line tools providing more than
+one command.
+
e.g called as "tool command [options] args..." where <options> and <args> are
command'specific
-:author: Logilab
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
-:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
+:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
# XXX : merge with optparser ?
import sys
@@ -38,12 +28,12 @@ command. Available commands are :\n'''
class BadCommandUsage(Exception):
"""Raised when an unknown command is used or when a command is not
- correctly used
+ correctly used.
"""
class Command(Configuration):
- """base class for command line commands"""
+ """Base class for command line commands."""
arguments = ''
name = ''
# hidden from help ?
diff --git a/cli.py b/cli.py
index f71b5a3..cc7c373 100644
--- a/cli.py
+++ b/cli.py
@@ -1,22 +1,7 @@
-# Copyright (c) 2003-2008 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
"""Command line interface helper classes.
- It provides some default commands, a help system, a default readline
- configuration with completion and persistent history
+It provides some default commands, a help system, a default readline
+configuration with completion and persistent history
Exemple usage:
@@ -39,11 +24,11 @@ Exemple usage:
cl = BookShell()
-:author: Logilab
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
-:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
+:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
-
+__docformat__ = "restructuredtext en"
import __builtin__
if not hasattr(__builtin__, '_'):
diff --git a/compat.py b/compat.py
index fc2b231..5252ded 100644
--- a/compat.py
+++ b/compat.py
@@ -1,23 +1,14 @@
-# pylint: disable-msg=E0601,W0622,W0611
-#
-# Copyright (c) 2004-2006 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
-"""some wrapper around some builtins introduced in python 2.3, 2.4 and
+"""Wrappers around some builtins introduced in python 2.3, 2.4 and
2.5, making them available in for earlier versions of python.
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
+
+# pylint: disable-msg=E0601,W0622,W0611
+
from __future__ import generators
from warnings import warn
diff --git a/configuration.py b/configuration.py
index 70cbb69..5389952 100644
--- a/configuration.py
+++ b/configuration.py
@@ -1,15 +1,3 @@
-# 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.
"""Some classes used to handle advanced configuration in simple to
complex applications.
@@ -21,7 +9,7 @@ in the `optik_ext` module)
Quick start: simplest usage
-```````````````````````````
+---------------------------
import sys
from logilab.common.configuration import Configuration
@@ -62,10 +50,11 @@ print config['value']
config.generate_config()
-:author: Logilab
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
-:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
+:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
from __future__ import generators
diff --git a/corbautils.py b/corbautils.py
index 8e9eae5..53963f3 100644
--- a/corbautils.py
+++ b/corbautils.py
@@ -1,6 +1,10 @@
-"""A set of utility function to ease the use of OmniORBpy."""
+"""A set of utility function to ease the use of OmniORBpy.
-__revision__ = '$Id: corbautils.py,v 1.2 2005-11-22 13:13:00 syt Exp $'
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
+"""
+__docformat__ = "restructuredtext en"
from omniORB import CORBA, PortableServer
import CosNaming
diff --git a/daemon.py b/daemon.py
index 9d3d1cb..c548746 100644
--- a/daemon.py
+++ b/daemon.py
@@ -1,28 +1,16 @@
-# 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.
-""" Copyright (c) 2002-2003 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
+"""A daemon mix-in class.
-a daemon mix-in class
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
-
-__revision__ = '$Id: daemon.py,v 1.10 2005-11-22 13:13:01 syt Exp $'
+__docformat__ = "restructuredtext en"
import os, signal, sys, time
from logilab.common.logger import make_logger, LOG_ALERT, LOG_NOTICE
class DaemonMixIn:
- """ mixin to make a daemon from watchers/queriers
+ """Mixin to make a daemon from watchers/queriers.
"""
def __init__(self, configmod) :
diff --git a/date.py b/date.py
index d49b17d..a49b2db 100644
--- a/date.py
+++ b/date.py
@@ -1,20 +1,10 @@
-# Copyright (c) 2006-2006 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
-
-"""date manipulation helper functions"""
+"""Date manipulation helper functions.
+
+:copyright: 2006-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
+"""
+__docformat__ = "restructuredtext en"
import math
diff --git a/db.py b/db.py
index c4e3498..25e6df4 100644
--- a/db.py
+++ b/db.py
@@ -1,20 +1,5 @@
-# Copyright (c) 2002-2008 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
-"""This modules contains wrappers to get actually replaceable DBAPI2 compliant
-modules and database connection whatever the database and client lib used.
+"""Wrappers to get actually replaceable DBAPI2 compliant modules and
+database connection whatever the database and client lib used.
Currently support:
@@ -30,7 +15,12 @@ you can control which one you want to use using the
Additional helpers are also provided for advanced functionalities such
as listing existing users or databases, creating database... Get the
helper for your database using the `get_adv_func_helper` function.
+
+:copyright: 2002-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
import sys
import re
diff --git a/debugger.py b/debugger.py
index 96c930b..3b6e433 100644
--- a/debugger.py
+++ b/debugger.py
@@ -1,10 +1,15 @@
-"""customized version of pdb's default debugger.
+"""Customized version of pdb's default debugger.
- sets up a history file
- uses ipython if available to colorize lines of code
- overrides list command to search for current block instead
of using 5 lines of context
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
try:
import readline
diff --git a/decorators.py b/decorators.py
index 1a659c3..2c2834d 100644
--- a/decorators.py
+++ b/decorators.py
@@ -1,20 +1,8 @@
-# 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.
-"""this module contains some function/method decorators
-
-:author: Logilab
-:copyright: 2006-2008 LOGILAB S.A. (Paris, FRANCE)
-:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
+"""A few useful function/method decorators.
+
+:copyright: 2006-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
__docformat__ = "restructuredtext en"
@@ -24,7 +12,7 @@ from time import clock
# XXX rewrite so we can use the decorator syntax when keyarg has to be specified
def cached(callableobj, keyarg=None):
- """simple decorator to cache result of method call"""
+ """Simple decorator to cache result of method call."""
#print callableobj, keyarg, callableobj.func_code.co_argcount
if callableobj.func_code.co_argcount == 1 or keyarg == 0:
@@ -78,14 +66,14 @@ def cached(callableobj, keyarg=None):
return cache_wrapper3
def clear_cache(obj, funcname):
- """function to clear a cache handled by the cached decorator"""
+ """Function to clear a cache handled by the cached decorator."""
try:
del obj.__dict__['_%s_cache_' % funcname]
except KeyError:
pass
def copy_cache(obj, funcname, cacheobj):
- """copy cache for <funcname> from cacheobj to obj"""
+ """Copy cache for <funcname> from cacheobj to obj."""
cache = '_%s_cache_' % funcname
try:
setattr(obj, cache, cacheobj.__dict__[cache])
@@ -94,8 +82,8 @@ def copy_cache(obj, funcname, cacheobj):
class wproperty(object):
- """simple descriptor expecting to take a modifier function as first argument
- and looking for a _<function name> to retrieve the attribute
+ """Simple descriptor expecting to take a modifier function as first argument
+ and looking for a _<function name> to retrieve the attribute.
"""
def __init__(self, setfunc):
self.setfunc = setfunc
@@ -117,8 +105,8 @@ class classproperty(object):
class iclassmethod(object):
- '''descriptor for method which should be available as class method if called
- on the class or instance method if called on an instance
+ '''Descriptor for method which should be available as class method if called
+ on the class or instance method if called on an instance.
'''
def __init__(self, func):
self.func = func
@@ -141,7 +129,7 @@ def timed(f):
def locked(acquire, release):
- """decorator taking two methods to acquire/release a lock as argument,
+ """Decorator taking two methods to acquire/release a lock as argument,
returning a decorator function which will call the inner method after
having called acquire(self) et will call release(self) afterwards.
"""
diff --git a/deprecation.py b/deprecation.py
index 804aeb8..c7ffe59 100644
--- a/deprecation.py
+++ b/deprecation.py
@@ -1,20 +1,8 @@
-# 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.
-"""Deprecation utilities
-
-:author: Logilab
-:copyright: 2006-2008 LOGILAB S.A. (Paris, FRANCE)
-:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
+"""Deprecation utilities.
+
+:copyright: 2006-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
__docformat__ = "restructuredtext en"
diff --git a/doc/makefile b/doc/makefile
index 547aa13..8b7fddf 100644
--- a/doc/makefile
+++ b/doc/makefile
@@ -1,18 +1,7 @@
-#MKHTML=mkdoc
-#MKHTMLOPTS=--doctype book --param toc.section.depth=2 --target html --stylesheet single-file
-#SRC=.
+all: epydoc
-#TXTFILES:= $(wildcard *.txt)
-#TARGET := $(TXTFILES:.txt=.html)
-
-all: apydoc
-
-#%.html: %.txt
-# ${MKHTML} ${MKHTMLOPTS} $<
-
-apydoc:
- epydoc --html -v --graph all --no-private --exclude="__pkginfo__" --exclude="setup" -n "Logilab's common library" ../
+epydoc:
+ epydoc -o apidoc --html -v --graph all --no-private --exclude="__pkginfo__" --exclude="setup" -n "Logilab's common library" ../
clean:
- rm -f *.html
- rm -rf html
+ rm -rf apidoc
diff --git a/fileutils.py b/fileutils.py
index 9ede37a..6f441ec 100644
--- a/fileutils.py
+++ b/fileutils.py
@@ -1,27 +1,15 @@
-# Copyright (c) 2003-2006 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
-"""Some file / file path manipulation utilities.
+"""File and file-path manipulation utilities.
:group path manipulation: first_level_directory, relative_path, is_binary,\
get_by_ext, remove_dead_links
:group file manipulation: norm_read, norm_open, lines, stream_lines, lines,\
write_open_mode, ensure_fs_mode, export
:sort: path manipulation, file manipulation
-"""
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
+"""
__docformat__ = "restructuredtext en"
import sys
@@ -37,7 +25,7 @@ from logilab.common import STD_BLACKLIST as BASE_BLACKLIST, IGNORED_EXTENSIONS
from logilab.common.shellutils import find
def first_level_directory(path):
- """return the first level directory of a path
+ """Return the first level directory of a path.
>>> first_level_directory('home/syt/work')
'home'
@@ -62,7 +50,7 @@ def first_level_directory(path):
return head
def abspath_listdir(path):
- """lists path's content using absolute paths
+ """Lists path's content using absolute paths.
>>> os.listdir('/home')
['adim', 'alf', 'arthur', 'auc']
@@ -74,8 +62,8 @@ def abspath_listdir(path):
def is_binary(filename):
- """return true if filename may be a binary file, according to it's
- extension
+ """Return true if filename may be a binary file, according to it's
+ extension.
:type filename: str
:param filename: the name of the file
@@ -92,7 +80,7 @@ def is_binary(filename):
def write_open_mode(filename):
- """return the write mode that should used to open file
+ """Return the write mode that should used to open file.
:type filename: str
:param filename: the name of the file
@@ -106,8 +94,8 @@ def write_open_mode(filename):
def ensure_fs_mode(filepath, desired_mode=S_IWRITE):
- """check that the given file has the given mode(s) set, else try to
- set it
+ """Check that the given file has the given mode(s) set, else try to
+ set it.
:type filepath: str
:param filepath: path of the file
@@ -123,8 +111,8 @@ def ensure_fs_mode(filepath, desired_mode=S_IWRITE):
class ProtectedFile(file):
- """a special file-object class that automatically that automatically
- does a 'chmod +w' when needed
+ """A special file-object class that automatically that automatically
+ does a 'chmod +w' when needed.
XXX: for now, the way it is done allows 'normal file-objects' to be
created during the ProtectedFile object lifetime.
@@ -169,12 +157,12 @@ class ProtectedFile(file):
class UnresolvableError(Exception):
- """exception raised by relative path when it's unable to compute relative
- path between two paths
+ """Exception raised by relative path when it's unable to compute relative
+ path between two paths.
"""
def relative_path(from_file, to_file):
- """try to get a relative path from from `from_file` to `to_file`
+ """Try to get a relative path from from `from_file` to `to_file`
(path will be absolute if to_file is an absolute file). This function
is useful to create link in `from_file` to `to_file`. This typical use
case is used in this function description.
@@ -246,7 +234,7 @@ _HAS_UNIV_OPEN = version_info[:2] >= (2, 3)
del version_info
def norm_read(path):
- """return the content of the file with normalized line feeds
+ """Return the content of the file with normalized line feeds.
:type path: str
:param path: path to the file to read
@@ -260,7 +248,7 @@ def norm_read(path):
def norm_open(path):
- """return a stream for a file with content with normalized line feeds
+ """Return a stream for a file with content with normalized line feeds.
:type path: str
:param path: path to the file to open
@@ -274,7 +262,7 @@ def norm_open(path):
def lines(path, comments=None):
- """return a list of non empty lines in the file located at `path`
+ """Return a list of non empty lines in the file located at `path`.
:type path: str
:param path: path to the file
@@ -298,7 +286,7 @@ def lines(path, comments=None):
def stream_lines(stream, comments=None):
- """return a list of non empty lines in the given `stream`
+ """Return a list of non empty lines in the given `stream`.
:type stream: object implementing 'xreadlines' or 'readlines'
:param stream: file like object
@@ -330,9 +318,9 @@ def stream_lines(stream, comments=None):
def export(from_dir, to_dir,
blacklist=BASE_BLACKLIST, ignore_ext=IGNORED_EXTENSIONS,
verbose=0):
- """make a mirror of `from_dir` in `to_dir`, omitting directories and
+ """Make a mirror of `from_dir` in `to_dir`, omitting directories and
files listed in the black list or ending with one of the given
- extensions
+ extensions.
:type from_dir: str
:param from_dir: directory to export
@@ -387,7 +375,7 @@ def export(from_dir, to_dir,
def remove_dead_links(directory, verbose=0):
- """recursivly traverse directory and remove all dead links
+ """Recursivly traverse directory and remove all dead links.
:type directory: str
:param directory: directory to cleanup
@@ -412,7 +400,7 @@ from warnings import warn
def files_by_ext(directory, include_exts=None, exclude_exts=None,
exclude_dirs=BASE_BLACKLIST):
- """return a list of files in a directory matching (or not) some
+ """Return a list of files in a directory matching (or not) some
extensions: you should either give the `include_exts` argument (and
only files ending with one of the listed extensions will be
considered) or the `exclude_exts` argument (and only files not
@@ -442,7 +430,7 @@ def files_by_ext(directory, include_exts=None, exclude_exts=None,
return find(directory, exclude_exts, exclude=True, blacklist=exclude_dirs)
def include_files_by_ext(directory, include_exts, exclude_dirs=BASE_BLACKLIST):
- """return a list of files in a directory matching some extensions
+ """Return a list of files in a directory matching some extensions.
:type directory: str
:param directory: directory where files should be searched
@@ -461,7 +449,7 @@ def include_files_by_ext(directory, include_exts, exclude_dirs=BASE_BLACKLIST):
return find(directory, include_exts, blacklist=exclude_dirs)
def exclude_files_by_ext(directory, exclude_exts, exclude_dirs=BASE_BLACKLIST):
- """return a list of files in a directory not matching some extensions
+ """Return a list of files in a directory not matching some extensions.
:type directory: str
:param directory: directory where files should be searched
diff --git a/graph.py b/graph.py
index b539703..3333652 100644
--- a/graph.py
+++ b/graph.py
@@ -1,26 +1,26 @@
-"""some various graph manipuliation utilities
+"""Graph manipuliation utilities.
(dot generation adapted from pypy/translator/tool/make_dot.py)
-:organization: Logilab
-:copyright: 2003-2007 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
-
__docformat__ = "restructuredtext en"
+
__metaclass__ = type
import os.path as osp
import os
def escape(value):
- """make <value> usable in a dot file"""
+ """Make <value> usable in a dot file."""
lines = [line.replace('"', '\\"') for line in value.split('\n')]
data = '\\l'.join(lines)
return '\\n' + data
def target_info_from_filename(filename):
- """transforms /some/path/foo.png into ('/some/path', 'foo.png', 'png')"""
+ """Transforms /some/path/foo.png into ('/some/path', 'foo.png', 'png')."""
abspath = osp.abspath(filename)
basename = osp.basename(filename)
storedir = osp.dirname(abspath)
@@ -29,7 +29,7 @@ def target_info_from_filename(filename):
class DotBackend:
- """Dot File backend"""
+ """Dot File backend."""
def __init__(self, graphname, rankdir=None, size=None, ratio=None, charset='utf-8'):
self.graphname = graphname
self.lines = []
@@ -57,7 +57,8 @@ class DotBackend:
source = property(get_source)
def generate(self, outputfile=None, dotfile=None):
- """generates a graph file
+ """Generates a graph file.
+
:param target: output format ('png', 'ps', etc.). If None,
the raw dot source will be returned
:return: a path to the generated file
@@ -83,26 +84,26 @@ class DotBackend:
return outputfile
def emit(self, line):
- """adds <line> to final output"""
+ """Adds <line> to final output."""
self.lines.append(line)
def emit_edge(self, name1, name2, **props):
- """emits edge from <name1> to <name2>
+ """Emits edge from <name1> to <name2>.
- authorized props: see http://www.graphviz.org/doc/info/attrs.html
+ Authorized props: see http://www.graphviz.org/doc/info/attrs.html
"""
attrs = ['%s="%s"' % (prop, value) for prop, value in props.items()]
self.emit('edge [%s];' % ", ".join(attrs))
self.emit('%s -> %s' % (normalize_node_id(name1), normalize_node_id(name2)))
def emit_node(self, name, **props):
- """authorized props: see http://www.graphviz.org/doc/info/attrs.html
+ """Authorized props: see http://www.graphviz.org/doc/info/attrs.html
"""
attrs = ['%s="%s"' % (prop, value) for prop, value in props.items()]
self.emit('%s [%s];' % (normalize_node_id(name), ", ".join(attrs)))
def normalize_node_id(nid):
- """returns a suitable DOT node id for `nid`"""
+ """Returns a suitable DOT node id for `nid`."""
return '"%s"' % nid
class GraphGenerator:
diff --git a/html.py b/html.py
index 70a638d..cfb1942 100644
--- a/html.py
+++ b/html.py
@@ -1,25 +1,15 @@
-# 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.
-""" Copyright (c) 2002-2006 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
+"""Print traceback in HTML.
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
from warnings import warn
warn('html module is deprecated and will disappear in a near release',
DeprecationWarning, stacklevel=2)
-__revision__ = "$Id: html.py,v 1.5 2003-09-12 11:54:47 syt Exp $"
-
import traceback
from xml.sax.saxutils import escape
@@ -27,7 +17,7 @@ from xml.sax.saxutils import escape
def html_traceback(info, exception,
title='', encoding='ISO-8859-1', body=''):
- """ return an html formatted traceback from python exception infos.
+ """Return an html formatted traceback from python exception infos.
"""
#typ, value, tbck = info
stacktb = traceback.extract_tb(info[2]) #tbck)
diff --git a/interface.py b/interface.py
index 3589212..e75ec49 100644
--- a/interface.py
+++ b/interface.py
@@ -1,20 +1,4 @@
-# Copyright (c) 2002-2007 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
-"""
- bases class for interfaces to provide "light" interface handling.
+"""Bases class for interfaces to provide 'light' interface handling.
TODO:
_ implements a check method which check that an object implements the
@@ -22,20 +6,25 @@
_ Attribute objects
This module requires at least python 2.2
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
from types import ListType, TupleType
class Interface:
- """base class for interfaces"""
+ """Base class for interfaces."""
def is_implemented_by(cls, instance):
return implements(instance, cls)
is_implemented_by = classmethod(is_implemented_by)
def implements(obj, interface):
- """return true if the give object (maybe an instance or class) implements
- the interface
+ """Return true if the give object (maybe an instance or class) implements
+ the interface.
"""
kimplements = getattr(obj, '__implements__', ())
if not isinstance(kimplements, (list, tuple)):
@@ -47,9 +36,9 @@ def implements(obj, interface):
def extend(klass, interface, _recurs=False):
- """add interface to klass'__implements__ if not already implemented in.
+ """Add interface to klass'__implements__ if not already implemented in.
- if klass is subclassed, ensure subclasses __implements__ it as well.
+ If klass is subclassed, ensure subclasses __implements__ it as well.
NOTE: klass should be e new class.
"""
diff --git a/logger.py b/logger.py
index f5ea4bd..4247180 100644
--- a/logger.py
+++ b/logger.py
@@ -1,30 +1,19 @@
-# 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.
-""" Copyright (c) 2002-2003 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
-
-Define a logger interface and two concrete loggers : one which prints
+"""Define a logger interface and two concrete loggers: one which prints
everything on stdout, the other using syslog.
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
+
+# FIXME use logging from stdlib instead.
"""
+__docformat__ = "restructuredtext en"
from warnings import warn
warn('logilab.common.logger module is deprecated and will disappear in a future release. \
use logging module instead.',
DeprecationWarning, stacklevel=2)
-__revision__ = "$Id: logger.py,v 1.18 2006-02-03 14:17:42 adim Exp $"
-
-
import sys
import traceback
import time
diff --git a/logging_ext.py b/logging_ext.py
index 37a2168..0012f0b 100644
--- a/logging_ext.py
+++ b/logging_ext.py
@@ -1,24 +1,12 @@
-# -*- coding: iso-8859-1 -*-
-# Copyright (c) 2007 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
-""" Copyright (c) 2007 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
+# -*- coding: utf-8 -*-
-This module provides extensions to the logging module from the standard library.
+"""Extends the logging module from the standard library.
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
import logging
diff --git a/logservice.py b/logservice.py
index baefd0f..5a06a1d 100644
--- a/logservice.py
+++ b/logservice.py
@@ -1,16 +1,18 @@
-"""log utilities
+"""Log utilities.
-Copyright (c) 2003-2004 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
+
+# FIXME using logging instead
"""
+__docformat__ = "restructuredtext en"
from warnings import warn
warn('logservice module is deprecated and will disappear in a near release. \
use logging module instead.',
DeprecationWarning, stacklevel=2)
-__revision__ = "$Id: logservice.py,v 1.5 2006-03-05 16:13:28 syt Exp $"
-
from logilab.common.logger import make_logger, LOG_ERR, LOG_WARN, LOG_NOTICE, \
LOG_INFO, LOG_CRIT, LOG_DEBUG
diff --git a/modutils.py b/modutils.py
index 2b9449a..63b33a9 100644
--- a/modutils.py
+++ b/modutils.py
@@ -1,26 +1,10 @@
-# -*- coding: iso-8859-1 -*-
-# Copyright (c) 2003-2008 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
+# -*- coding: utf-8 -*-
"""Python modules manipulation utility functions.
-:author: Logilab
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
-:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
-
-
+:author: Logilab
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
:type PY_SOURCE_EXTS: tuple(str)
:var PY_SOURCE_EXTS: list of possible python source file extension
@@ -31,7 +15,6 @@
:type BUILTIN_MODULES: dict
:var BUILTIN_MODULES: dictionary with builtin module names has key
"""
-
__docformat__ = "restructuredtext en"
import sys
diff --git a/monclient.py b/monclient.py
index 19528dd..6de0d28 100644
--- a/monclient.py
+++ b/monclient.py
@@ -1,6 +1,10 @@
-"""Simple interpreter client for monserver
-provides a simple readline interface.
+"""Simple interpreter client for monserver provides a simple readline interface.
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
from warnings import warn
warn('this module is deprecated and will disappear in a near release',
diff --git a/monserver.py b/monserver.py
index f3c22b3..dc3f9d2 100644
--- a/monserver.py
+++ b/monserver.py
@@ -1,15 +1,18 @@
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
"""This module implements a TCP server in a separate thread that
allows *one* client to connect and provides a command line interpreter
-allowing the remote client to explore the process on the fly
+allowing the remote client to explore the process on the fly.
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
from warnings import warn
warn('this module is deprecated and will disappear in a near release',
DeprecationWarning, stacklevel=1)
-__revision__ = '$Id: monserver.py,v 1.2 2005-11-22 13:13:02 syt Exp $'
-
import threading
import SocketServer
import traceback
@@ -17,14 +20,13 @@ import code
import sys
import time
-
-# NOTES: ce module étant utilisé pour l'introspection, il peut
-# être utile de fournir dans les locales de l'interpreteur des
-# objets déjà initialisés (par exemple le module __main__ ou
-# bien __main__.*) ou encore des objets servant à l'introspection
+# NOTES: ce module étant utilisé pour l'introspection, il peut
+# être utile de fournir dans les locales de l'interpreteur des
+# objets déjà initialisés (par exemple le module __main__ ou
+# bien __main__.*) ou encore des objets servant à l'introspection
# comme on en trouve dans pymonitor (qui prend la liste des objets
# maintenus par le garbage collector) ou a des statistiques
-# pour faire des opérations du style:
+# pour faire des opérations du style:
# inspector.count_types( MyClass )
# inspector.list_types( MyClass ) etc...
diff --git a/optik_ext.py b/optik_ext.py
index 2f7704f..2970297 100644
--- a/optik_ext.py
+++ b/optik_ext.py
@@ -1,20 +1,6 @@
-# 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.
-""" Copyright (c) 2003-2006 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
-
-add an abstraction level to transparently import optik classes from optparse
+"""Add an abstraction level to transparently import optik classes from optparse
(python >= 2.3) or the optik package.
+
It also defines three new types for optik/optparse command line parser :
* regexp
@@ -26,7 +12,12 @@ It also defines three new types for optik/optparse command line parser :
* named
argument of this type are in the form <NAME>=<VALUE> or <NAME>:<VALUE>
+
+:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
import re
import sys
diff --git a/optparser.py b/optparser.py
index 3461ce5..0b10124 100644
--- a/optparser.py
+++ b/optparser.py
@@ -1,19 +1,4 @@
-# -*- coding: iso-8859-15 -*-
-# Copyright (c) 2006 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
+# -*- coding: utf-8 -*-
"""Extend OptionParser with commands.
Example:
@@ -26,7 +11,12 @@ Example:
>>> return run(options, args[1:])
With mymod.build that defines two functions run and add_options
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
# XXX merge with optik_ext ? merge with clcommands ?
diff --git a/patricia.py b/patricia.py
index 6b62feb..09e9d9d 100644
--- a/patricia.py
+++ b/patricia.py
@@ -1,20 +1,4 @@
-# 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.
-""" Copyright (c) 2002-2003 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
-
-
-a Python implementation of PATRICIA tree
+"""A Python implementation of PATRICIA tree.
PATRICIA - Practical Algorithm to Retrieve Information Coded in Alphanumeric
D.R.Morrison (1968).
@@ -24,14 +8,17 @@ want to know what's a PATRICIA tree...
TODO: _ advanced search
_ profile code
_ use mxTextTools ?
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
from warnings import warn
warn('logilab.common.patricia module is deprecated and will disappear in a near release',
DeprecationWarning, stacklevel=2)
-__revision__ = "$Id: patricia.py,v 1.5 2003-10-31 14:18:32 syt Exp $"
-
def prefix(prfx, string):
"""return the index of the first character from string which differs from
prefix
diff --git a/pdf_ext.py b/pdf_ext.py
index ed89808..1827261 100644
--- a/pdf_ext.py
+++ b/pdf_ext.py
@@ -1,28 +1,22 @@
-# 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.
-""" Copyright (c) 2003-2007 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
-
-manipulate pdf and fdf files. pdftk recommended.
+"""Manipulate pdf and fdf files (pdftk recommended).
Notes regarding pdftk, pdf forms and fdf files (form definition file)
fields names can be extracted with:
+
pdftk orig.pdf generate_fdf output truc.fdf
-to merge fdf and pdf:
+
+to merge fdf and pdf:
+
pdftk orig.pdf fill_form test.fdf output result.pdf [flatten]
+
without flatten, one could further edit the resulting form.
with flatten, everything is turned into text.
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
# XXX seems very unix specific
# TODO: check availability of pdftk at import
diff --git a/pytest.py b/pytest.py
index f59e4f7..df1007e 100644
--- a/pytest.py
+++ b/pytest.py
@@ -17,7 +17,6 @@ If you wish to customize the tester, you'll have to define a class named
defined in the pytest module. Take a look at the `PyTester` and `DjangoTester`
classes for more information about what can be done.
-
For instance, if you wish to add a custom -l option to specify a loglevel, you
could define the following ``pytestconf.py`` file ::
@@ -48,7 +47,12 @@ the ``optval`` method::
loglevel = self.optval('loglevel')
# ...
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
PYTEST_DOC = """%prog [OPTIONS] [testfile [testpattern]]
diff --git a/setup.py b/setup.py
index 7cac2a4..ab54566 100644
--- a/setup.py
+++ b/setup.py
@@ -1,21 +1,12 @@
#!/usr/bin/env python
# pylint: disable-msg=W0404,W0622,W0704,W0613,W0152
-# Copyright (c) 2003 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
-""" Generic Setup script, takes package info from __pkginfo__.py file """
+"""Generic Setup script, takes package info from __pkginfo__.py file.
+
+:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
+"""
+__docformat__ = "restructuredtext en"
import os
import sys
diff --git a/shellutils.py b/shellutils.py
index cad5b33..b8b2cda 100644
--- a/shellutils.py
+++ b/shellutils.py
@@ -1,22 +1,10 @@
-# 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.
-"""
-Some shell/term utilities, useful to write some python scripts instead of shell
-scripts
+"""shell/term utilities, useful to write some python scripts instead of shell
+scripts.
:author: Logilab
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
-:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
__docformat__ = "restructuredtext en"
@@ -32,7 +20,7 @@ from logilab.common import STD_BLACKLIST
def chown(path, login=None, group=None):
- """same as `os.chown` function but accepting user login or group name as
+ """Same as `os.chown` function but accepting user login or group name as
argument. If login or group is omitted, it's left unchanged.
Note: you must own the file to chown it (or be root). Otherwise OSError is raised.
@@ -57,7 +45,7 @@ def chown(path, login=None, group=None):
def mv(source, destination, _action=shutil.move):
- """a shell like mv, supporting wildcards
+ """A shell-like mv, supporting wildcards.
"""
sources = glob.glob(source)
if len(sources) > 1:
@@ -78,7 +66,7 @@ def mv(source, destination, _action=shutil.move):
source, destination, ex))
def rm(*files):
- """a shell like rm, supporting wildcards
+ """A shell-like rm, supporting wildcards.
"""
for wfile in files:
for filename in glob.glob(wfile):
@@ -90,13 +78,13 @@ def rm(*files):
os.remove(filename)
def cp(source, destination):
- """a shell like cp, supporting wildcards
+ """A shell-like cp, supporting wildcards.
"""
mv(source, destination, _action=shutil.copy)
def find(directory, exts, exclude=False, blacklist=STD_BLACKLIST):
- """recursivly find files ending with the given extensions from the directory
+ """Recursivly find files ending with the given extensions from the directory.
:type directory: str
:param directory:
@@ -155,7 +143,7 @@ def find(directory, exts, exclude=False, blacklist=STD_BLACKLIST):
class Execute:
"""This is a deadlock safe version of popen2 (no stdin), that returns
- an object with errorlevel, out and err
+ an object with errorlevel, out and err.
"""
def __init__(self, command):
@@ -170,7 +158,7 @@ class Execute:
def acquire_lock(lock_file, max_try=10, delay=10):
- """acquire a lock represented by a file on the file system"""
+ """Acquire a lock represented by a file on the file system."""
count = 0
while max_try <= 0 or count < max_try:
if not exists(lock_file):
@@ -184,12 +172,12 @@ def acquire_lock(lock_file, max_try=10, delay=10):
stream.close()
def release_lock(lock_file):
- """release a lock represented by a file on the file system"""
+ """Release a lock represented by a file on the file system."""
os.remove(lock_file)
class ProgressBar(object):
- """a simple text progression bar"""
+ """A simple text progression bar."""
def __init__(self, nbops, size=20, stream=sys.stdout):
self._fstr = '\r[%%-%ss]' % int(size)
@@ -200,7 +188,7 @@ class ProgressBar(object):
self._progress = 0
def update(self):
- """update the progression bar"""
+ """Update the progression bar."""
self._current += 1
progress = int((float(self._current)/float(self._total))*self._size)
if progress > self._progress:
@@ -208,6 +196,6 @@ class ProgressBar(object):
self.refresh()
def refresh(self):
- """refresh the progression bar display"""
+ """Refresh the progression bar display."""
self._stream.write(self._fstr % ('.' * min(self._progress, self._size)) )
self._stream.flush()
diff --git a/sqlgen.py b/sqlgen.py
index 1484511..db0e4cc 100644
--- a/sqlgen.py
+++ b/sqlgen.py
@@ -1,34 +1,22 @@
-# 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.
-"""Help to generate SQL string usable by the Python DB-API
-
-:author: Logilab
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
-:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
+"""Help to generate SQL strings usable by the Python DB-API.
+
+:author: Logilab
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
__docformat__ = "restructuredtext en"
-
# SQLGenerator ################################################################
class SQLGenerator :
"""
- Helper class to generate SQL strings to use with python's DB-API
+ Helper class to generate SQL strings to use with python's DB-API.
"""
def where(self, keys, addon=None) :
"""
- keys : list of keys
+ :param keys: list of keys
>>> s = SQLGenerator()
>>> s.where(['nom'])
@@ -45,7 +33,7 @@ class SQLGenerator :
def set(self, keys) :
"""
- keys : list of keys
+ :param keys: list of keys
>>> s = SQLGenerator()
>>> s.set(['nom'])
@@ -57,8 +45,8 @@ class SQLGenerator :
def insert(self, table, params) :
"""
- table : name of the table
- params : dictionnary that will be used as in cursor.execute(sql,params)
+ :param table: name of the table
+ :param params: dictionnary that will be used as in cursor.execute(sql,params)
>>> s = SQLGenerator()
>>> s.insert('test',{'nom':'dupont'})
@@ -73,8 +61,8 @@ class SQLGenerator :
def select(self, table, params) :
"""
- table : name of the table
- params : dictionnary that will be used as in cursor.execute(sql,params)
+ :param table: name of the table
+ :param params: dictionnary that will be used as in cursor.execute(sql,params)
>>> s = SQLGenerator()
>>> s.select('test',{})
@@ -92,11 +80,11 @@ class SQLGenerator :
def adv_select(self, model, tables, params, joins=None) :
"""
- model : list of columns to select
- tables : list of tables used in from
- params : dictionnary that will be used as in cursor.execute(sql, params)
- joins : optional list of restriction statements to insert in the where
- clause. Usually used to perform joins.
+ :param model: list of columns to select
+ :param tables: list of tables used in from
+ :param params: dictionnary that will be used as in cursor.execute(sql, params)
+ :param joins: optional list of restriction statements to insert in the
+ where clause. Usually used to perform joins.
>>> s = SQLGenerator()
>>> s.adv_select(['column'],[('test', 't')], {})
@@ -115,8 +103,8 @@ class SQLGenerator :
def delete(self, table, params) :
"""
- table : name of the table
- params : dictionnary that will be used as in cursor.execute(sql,params)
+ :param table: name of the table
+ :param params: dictionnary that will be used as in cursor.execute(sql,params)
>>> s = SQLGenerator()
>>> s.delete('test',{'nom':'dupont'})
@@ -130,8 +118,8 @@ class SQLGenerator :
def update(self, table, params, unique) :
"""
- table : name of the table
- params : dictionnary that will be used as in cursor.execute(sql,params)
+ :param table: name of the table
+ :param params: dictionnary that will be used as in cursor.execute(sql,params)
>>> s = SQLGenerator()
>>> s.update('test', {'id':'001','nom':'dupont'}, ['id'])
@@ -146,7 +134,7 @@ class SQLGenerator :
class BaseTable:
"""
- Another helper class to ease SQL table manipulation
+ Another helper class to ease SQL table manipulation.
"""
# table_name = "default"
# supported types are s/i/d
@@ -217,8 +205,8 @@ def name_fields(cursor, records) :
list of dictionnaries (one for each record) whose keys are column names and
values are records' values.
- cursor : cursor used to execute the query
- records : list returned by fetch*()
+ :param cursor: cursor used to execute the query
+ :param records: list returned by fetch*()
"""
result = []
for record in records :
diff --git a/table.py b/table.py
index 1bd4673..bc6c853 100644
--- a/table.py
+++ b/table.py
@@ -1,7 +1,10 @@
-"""Table management module
-"""
+"""Table management module.
-__revision__ = '$Id: table.py,v 1.18 2006-04-09 22:30:53 nico Exp $'
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
+"""
+__docformat__ = "restructuredtext en"
from warnings import warn
diff --git a/testlib.py b/testlib.py
index a5afc0e..d09b38f 100644
--- a/testlib.py
+++ b/testlib.py
@@ -1,29 +1,31 @@
-# modified copy of some functions from test/regrtest.py from PyXml
-# disable camel case warning
-# pylint: disable-msg=C0103
-"""Copyright (c) 2003-2006 LOGILAB S.A. (Paris, FRANCE).
-http://www.logilab.fr/ -- mailto:contact@logilab.fr
-
-Run tests.
+"""Run tests.
This will find all modules whose name match a given prefix in the test
-directory, and run them. Various command line options provide
+directory, and run them. Various command line options provide
additional facilities.
Command line options:
--v: verbose -- run tests in verbose mode with output to stdout
--q: quiet -- don't print anything except if a test fails
--t: testdir -- directory where the tests will be found
--x: exclude -- add a test to exclude
--p: profile -- profiled execution
--c: capture -- capture standard out/err during tests
--d: dbc -- enable design-by-contract
+ -v: verbose -- run tests in verbose mode with output to stdout
+ -q: quiet -- don't print anything except if a test fails
+ -t: testdir -- directory where the tests will be found
+ -x: exclude -- add a test to exclude
+ -p: profile -- profiled execution
+ -c: capture -- capture standard out/err during tests
+ -d: dbc -- enable design-by-contract
If no non-option arguments are present, prefixes used are 'test',
'regrtest', 'smoketest' and 'unittest'.
+:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
+# modified copy of some functions from test/regrtest.py from PyXml
+# disable camel case warning
+# pylint: disable-msg=C0103
+
import sys
import os, os.path as osp
import re
diff --git a/textutils.py b/textutils.py
index b48f8e9..2dfe319 100644
--- a/textutils.py
+++ b/textutils.py
@@ -1,28 +1,15 @@
-# 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.
"""Some text manipulation utility functions.
:author: Logilab
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
-:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
+:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
:group text formatting: normalize_text, normalize_paragraph, pretty_match,\
unquote, colorize_ansi
:group text manipulation: searchall, get_csv
:sort: text formatting, text manipulation
-
-
:type ANSI_STYLES: dict(str)
:var ANSI_STYLES: dictionary mapping style identifier to ANSI terminal code
@@ -41,7 +28,6 @@ unquote, colorize_ansi
:var ANSI_RESET:
ANSI terminal code reseting format defined by a previous ANSI escape sequence
"""
-
__docformat__ = "restructuredtext en"
import re
diff --git a/tree.py b/tree.py
index d8cfffe..9ceb106 100644
--- a/tree.py
+++ b/tree.py
@@ -1,21 +1,10 @@
-# Copyright (c) 2003-2006 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
-"""
- base class to represent tree structure
+"""Base class to represent a tree structure.
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
import sys
@@ -56,7 +45,6 @@ class Node(object):
s.append(child.__str__())
return '\n'.join(s)
-
def is_leaf(self):
return not self.children
diff --git a/twisted_distutils.py b/twisted_distutils.py
index 7673eea..72467e2 100644
--- a/twisted_distutils.py
+++ b/twisted_distutils.py
@@ -1,13 +1,10 @@
-""" Copyright (c) 2002-2003 LOGILAB S.A. (Paris, FRANCE).
-http://www.logilab.fr/ -- mailto:contact@logilab.fr
-
-Distutils extensions for twisted framework.
+"""Distutils extensions for twisted framework.
This module enables the installation of plugins.tml files using standard
distutils syntax. It adds the following commands to the standard
setup.py commands:
-* build_twisted_plugins: build (i.e. copy) plugins
-* install_twisted_plugins: install plugins
+ * build_twisted_plugins: build (i.e. copy) plugins
+ * install_twisted_plugins: install plugins
Additionally, the following commands have been modified to deal with
plugins files:
@@ -30,8 +27,13 @@ if __name__ == '__main__':
Note that you can use this to install files that are not twisted plugins in any
package directory of your application.
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
-#
+__docformat__ = "restructuredtext en"
+
# (c) 2002 Alexandre Fayolle <alexandre.fayolle@free.fr>
# This module is heavily based on code copied from the python distutils
# framework, especially distutils.command.build_script,
@@ -44,15 +46,11 @@ package directory of your application.
# to do so <wink>.
#
# Happy twisting!
-#
-
from warnings import warn
warn('this module is deprecated and will disappear in a near release',
DeprecationWarning, stacklevel=1)
-__revision__ = "$Id: twisted_distutils.py,v 1.4 2003-09-12 11:54:48 syt Exp $"
-
from distutils.core import Distribution, Command
from distutils.command.install import install
from distutils.command.build import build
diff --git a/umessage.py b/umessage.py
index 4129f00..f5b4db5 100644
--- a/umessage.py
+++ b/umessage.py
@@ -1,4 +1,10 @@
-"""unicode email support"""
+"""Unicode email support (extends email from stdlib).
+
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
+"""
+__docformat__ = "restructuredtext en"
import email
from encodings import search_function
@@ -32,7 +38,8 @@ def message_from_string(string):
return ''
class UMessage:
- """Encapsulates an email.Message instance and returns only unicode objects"""
+ """Encapsulates an email.Message instance and returns only unicode objects.
+ """
def __init__(self, message):
self.message = message
@@ -129,7 +136,3 @@ class UMessage:
elif not return_str:
return None
return value
-
-
-
-
diff --git a/vcgutils.py b/vcgutils.py
index f6875f4..d25cb35 100644
--- a/vcgutils.py
+++ b/vcgutils.py
@@ -1,30 +1,17 @@
-# Copyright (c) 2000-2002 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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.
-"""
-utilities functions to generate file readable with Georg Sander's vcg
+"""Functions to generate files readable with Georg Sander's vcg
(Visualization of Compiler Graphs).
You can download vcg at http://rw4.cs.uni-sb.de/~sander/html/gshome.html
Note that vcg exists as a debian package.
-See the documentation of vcg for explanation about the different value that
-maybe used for the functions parameters
-"""
+See vcg's documentation for explanation about the different values that
+maybe used for the functions parameters.
-__revision__ = "$Id: vcgutils.py,v 1.6 2003-12-10 08:15:09 syt Exp $"
+:copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
+"""
+__docformat__ = "restructuredtext en"
import string
@@ -125,7 +112,7 @@ EDGE_ATTRS = {
# Misc utilities ###############################################################
def latin_to_vcg(st):
- """convert latin characters using vcg escape sequence
+ """Convert latin characters using vcg escape sequence.
"""
for char in st:
if char not in string.ascii_letters:
@@ -139,7 +126,7 @@ def latin_to_vcg(st):
class VCGPrinter:
- """a vcg graph writer
+ """A vcg graph writer.
"""
def __init__(self, output_stream):
diff --git a/visitor.py b/visitor.py
index ca70b9f..10ae8c3 100644
--- a/visitor.py
+++ b/visitor.py
@@ -1,25 +1,14 @@
-# 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.
-""" Copyright (c) 2002-2003 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
-
-a generic visitor abstract implementation
+"""A generic visitor abstract implementation.
+
+:copyright: 2002-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
+__docformat__ = "restructuredtext en"
def no_filter(_):
return 1
-
# Iterators ###################################################################
class FilteredIterator(object):
@@ -35,7 +24,6 @@ class FilteredIterator(object):
except :
return None
-
# Base Visitor ################################################################
class Visitor(object):
@@ -77,8 +65,6 @@ class Visitor(object):
"""
return result
-
-
# standard visited mixin ######################################################
class VisitedMixIn(object):
"""
@@ -102,5 +88,3 @@ class VisitedMixIn(object):
def leave(self, visitor, *args, **kwargs):
func = getattr(visitor, 'leave_%s' % self.get_visit_name())
return func(self, *args, **kwargs)
-
-
diff --git a/xmlrpcutils.py b/xmlrpcutils.py
index 147d36d..b31d02f 100644
--- a/xmlrpcutils.py
+++ b/xmlrpcutils.py
@@ -1,22 +1,10 @@
-# 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.
-"""XML-RPC utilities
+"""XML-RPC utilities.
- Copyright (c) 2003-2004 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+:license: General Public License version 2 - http://www.gnu.org/licenses
"""
-
-__revision__ = "$Id: xmlrpcutils.py,v 1.3 2005-11-22 13:13:03 syt Exp $"
+__docformat__ = "restructuredtext en"
import xmlrpclib
from base64 import encodestring