# # Shared type definitions # # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # # $Id$ # class Parameter: """ Typed value wrapper. Use in accepts and returns to document method parameters. Set the optional and default attributes for sub-parameters (i.e., dict fields). """ def __init__(self, type, doc = "", optional = True, default = None): (self.type, self.doc, self.optional, self.default) = \ (type, doc, optional, default) def __repr__(self): return repr(self.type) class Mixed(tuple): """ A list (technically, a tuple) of types. Use in accepts and returns to document method parameters that may return mixed types. """ def __new__(cls, *types): return tuple.__new__(cls, types)