Deleted Added
sdiff udiff text old ( 2343:a2b4a6ccee56 ) new ( 2665:a124942bacb8 )
full compact
1# Copyright (c) 2003-2004 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 9 unchanged lines hidden (view full) ---

18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27from __future__ import division
28import operator, re, types
29
30class ProxyError(Exception):
31 pass
32
33def unproxy(proxy):

--- 135 unchanged lines hidden (view full) ---

169 if isinstance(value, Value):
170 return value
171
172 raise AttributeError, 'Only values can be wrapped'
173
174class Statistic(object):
175 def __getattr__(self, attr):
176 if attr in ('data', 'x', 'y'):
177 result = self.source.data(self, self.ticks)
178 self.data = result.data
179 self.x = result.x
180 self.y = result.y
181 return super(Statistic, self).__getattribute__(attr)
182
183 def __setattr__(self, attr, value):
184 if attr == 'stat':
185 raise AttributeError, '%s is read only' % stat
186 if attr in ('source', 'ticks'):
187 if getattr(self, attr) != value:
188 if hasattr(self, 'data'):
189 delattr(self, 'data')
190
191 super(Statistic, self).__setattr__(attr, value)
192
193 def __str__(self):
194 return self.name

--- 559 unchanged lines hidden (view full) ---

754 elif data.type == 'VECTORDIST':
755 stat = VectorDist()
756 elif data.type == 'VECTOR2D':
757 stat = Vector2d()
758 elif data.type == 'FORMULA':
759 stat = Formula()
760
761 stat.__dict__['source'] = source
762 stat.__dict__['ticks'] = None
763 stat.__dict__.update(data.__dict__)
764
765 return stat
766