Package fuzzy :: Package complement :: Module Base
[hide private]
[frames] | no frames]

Source Code for Module fuzzy.complement.Base

 1  # -*- coding: utf-8 -*- 
 2  # 
 3  # Copyright (C) 2009  Rene Liebscher 
 4  # 
 5  # This program is free software; you can redistribute it and/or modify it under 
 6  # the terms of the GNU Lesser General Public License as published by the Free  
 7  # Software Foundation; either version 3 of the License, or (at your option) any 
 8  # later version. 
 9  # 
10  # This program is distributed in the hope that it will be useful, but WITHOUT  
11  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
12  # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 
13  # details. 
14  #  
15  # You should have received a copy of the GNU Lesser General Public License 
16  # along with this program; if not, see <http://www.gnu.org/licenses/>.  
17  # 
18  """Base class for all complement methods""" 
19  __revision__ = "$Id: Base.py,v 1.7 2010-10-29 19:24:41 rliebscher Exp $" 
20   
21  import fuzzy.Exception 
22   
23 -class ComplementException(fuzzy.Exception.FuzzyException):
24 """An own exception type for complements.""" 25 pass
26 27
28 -class Base(object): # pylint: disable=R0903
29 """Base class for all complement methods""" 30
31 - def __init__(self, *args, **keywords):
32 """Initialize the complement instance""" 33 super(Base, self).__init__(*args, **keywords)
34
35 - def __call__(self, value):
36 """Calculate the complement of the value. 37 @param value: the value to complement 38 @type value: float 39 @return: the complemented value 40 @rtype: float 41 """ 42 raise NotImplementedError("don't use the abstract base class") # pragma: no coverage
43
44 - def __repr__(self):
45 """Return representation of instance. 46 47 @return: representation of instance 48 @rtype: string 49 """ 50 return "%s.%s()" % (self.__class__.__module__, self.__class__.__name__)
51