diff --git a/cybertools/brain/neuron.py b/cybertools/brain/neuron.py index d23084b..149fb75 100644 --- a/cybertools/brain/neuron.py +++ b/cybertools/brain/neuron.py @@ -1,38 +1,18 @@ -# -# Copyright (c) 2006 Helmut Merz helmutm@cy55.de -# -# 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 -# +# cybertools.brain.neuron -""" -A simple basic implementation of Neuron and Synapsis. - -$Id$ +""" A simple basic implementation of Neuron and Synapsis. """ -from zope.interface import implements +from zope.interface import implementer from cybertools.brain.interfaces import INeuron, ISynapsis from cybertools.brain.state import State, Transition +@implementer(ISynapsis) class Synapsis(object): """ A synapsis connects two neurons. """ - implements(ISynapsis) - def __init__(self, sender, receiver): self.sender = sender sender.receivers.append(self) @@ -46,10 +26,9 @@ class Synapsis(object): receiver.notify(session) +@implementer(INeuron) class Neuron(object): - implements(INeuron) - def __init__(self): self.senders = [] self.receivers = [] diff --git a/cybertools/brain/session.py b/cybertools/brain/session.py index 84225d1..f040147 100644 --- a/cybertools/brain/session.py +++ b/cybertools/brain/session.py @@ -1,35 +1,15 @@ -# -# Copyright (c) 2006 Helmut Merz helmutm@cy55.de -# -# 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 -# +# cybertools.brain.session -""" -Transaction management. - -$Id$ +""" Transaction management. """ -from zope.interface import implements +from zope.interface import implementer from cybertools.brain.interfaces import ISession +implementer(ISession) class Session(object): - implements(ISession) - def __init__(self): self.states = {} diff --git a/cybertools/brain/state.py b/cybertools/brain/state.py index 6caba5c..a4bf706 100644 --- a/cybertools/brain/state.py +++ b/cybertools/brain/state.py @@ -1,37 +1,17 @@ -# -# Copyright (c) 2006 Helmut Merz helmutm@cy55.de -# -# 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 -# +# cybertools.brain.state -""" -Base classes for state and state manipulations using a float-based state. - -$Id$ +""" Base classes for state and state manipulations using a float-based state. """ -from zope.interface import implements +from zope.interface import implementer from cybertools.brain.interfaces import IState, ITransition +@implementer(IState) class State(object): """ The state of a neuron. """ - implements(IState) - def __init__(self, value=0.0): self.value = value @@ -39,10 +19,9 @@ class State(object): return '' % self.value +@implementer(ITransition) class Transition(object): - implements(ITransition) - def __init__(self, synapsis, factor=1.0): self.synapsis = synapsis self.factor = factor diff --git a/cybertools/text/README.txt b/cybertools/text/README.txt index f1f4093..026da2b 100644 --- a/cybertools/text/README.txt +++ b/cybertools/text/README.txt @@ -2,8 +2,6 @@ Text Transformations, e.g. for Full-text Indexing ================================================= - ($Id$) - If a converter program needed is not available we want to put a warning into Zope's server log; in order to be able to test this we register a log handler for testing: diff --git a/cybertools/text/tests.py b/cybertools/text/tests.py index f96a338..79aa0b6 100755 --- a/cybertools/text/tests.py +++ b/cybertools/text/tests.py @@ -5,21 +5,22 @@ Tests for the 'cybertools.text' package. """ import sys #sys.path = [p for p in sys.path if p != ''] -sys.path = sys.path[2:] -print(sys.path) +sys.path = sys.path[2:] # avoid import cycle with bs4 when importing html +#print(sys.path) import unittest, doctest import warnings from cybertools.text import pdf from cybertools.text.html import htmlToText -warnings.filterwarnings('ignore', category=ResourceWarning) class Test(unittest.TestCase): "Basic tests for the text package." def testBasicStuff(self): + warnings.filterwarnings('ignore', category=ResourceWarning) + warnings.filterwarnings('ignore', category=DeprecationWarning) pass