[Synopsis-changes] Synopsis/Synopsis/Synopsis Processor.py,1.2,1.3
Stefan Seefeld stefan at synopsis.fresco.orgTue Nov 11 18:17:55 UTC 2003
- Previous message: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatters ASCII.py,1.32,1.33 BoostBook.py,1.1,1.2 ClassTree.py,1.6,1.7 DUMP.py,1.17,1.18 Dia.py,1.12,1.13 DocBook.py,1.10,1.11 Dump.py,1.3,1.4 HTML_Simple.py,1.14,1.15 TOC.py,1.3,1.4 TexInfo.py,1.5,1.6
- Next message: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatters ClassTree.py,1.7,1.8 TOC.py,1.4,1.5
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /cvs/synopsis/Synopsis/Synopsis
In directory frida:/tmp/cvs-serv28670/Synopsis
Modified Files:
Processor.py
Log Message:
factor out Parametrized so it can be used for things other than Processors
Index: Processor.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Processor.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -d -r1.2 -r1.3
--- Processor.py 11 Nov 2003 06:05:03 -0000 1.2
+++ Processor.py 11 Nov 2003 18:17:17 -0000 1.3
@@ -28,8 +28,8 @@ class Type(type):
setattr(cls, i, dict[i].value)
setattr(cls, '_parameters', parameters)
-class Processor(object):
- """Processor documentation..."""
+class Parametrized(object):
+ """Parametrized implements handling of Parameter attributes."""
__metaclass__ = Type
@@ -37,9 +37,9 @@ class Processor(object):
"""merge all parameter catalogs for easy access to documentation,
then use keyword arguments to override default values."""
instance = object.__new__(cls)
- # iterate over all base classes, starting at the 'Processor' base class
+ # iterate over all base classes, starting at the 'Parametrized' base class
# i.e. remove mixin classes
- hierarchy = list(filter(lambda i:isinstance(i, Processor), cls.__mro__))
+ hierarchy = list(filter(lambda i:isinstance(i, Parametrized), cls.__mro__))
hierarchy.reverse()
parameters = {}
for c in hierarchy:
@@ -54,13 +54,27 @@ class Processor(object):
return instance
- verbose = Parameter(False, "operate verbosely")
-
def get_parameters(self):
return self._parameters
def set_parameters(self, kwds):
"""Sets the given parameters to override the default values."""
+ for i in kwds:
+ if i in self._parameters:
+ setattr(self, i, kwds[i])
+ else:
+ raise TypeError, "No parameter '%s' in 'Parametrized'"%(i)
+
+
+class Processor(Parametrized):
+ """Processor documentation..."""
+
+ verbose = Parameter(False, "operate verbosely")
+
+ def set_parameters(self, kwds):
+ """Sets the given parameters to override the default values.
+ Override the Parametrized version so we can handle 'input' and 'output'
+ which are not in the _parameters' catalog."""
for i in kwds:
if i in self._parameters:
setattr(self, i, kwds[i])
- Previous message: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatters ASCII.py,1.32,1.33 BoostBook.py,1.1,1.2 ClassTree.py,1.6,1.7 DUMP.py,1.17,1.18 Dia.py,1.12,1.13 DocBook.py,1.10,1.11 Dump.py,1.3,1.4 HTML_Simple.py,1.14,1.15 TOC.py,1.3,1.4 TexInfo.py,1.5,1.6
- Next message: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatters ClassTree.py,1.7,1.8 TOC.py,1.4,1.5
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Synopsis-changes mailing list