summaryrefslogtreecommitdiff
path: root/interface.py
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 /interface.py
parent47df8cd6dff5c08b32966a7b59b5da75d23123de (diff)
downloadlogilab-common-aab929e273a41a188a244b5d2c8b3e53408172ab.tar.gz
improve doc for better epydoc generation.
Diffstat (limited to 'interface.py')
-rw-r--r--interface.py33
1 files changed, 11 insertions, 22 deletions
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.
"""