info.py (2343:a2b4a6ccee56) info.py (2665:a124942bacb8)
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.
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#
27# Authors: Nathan Binkert
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'):
28
29from __future__ import division
30import operator, re, types
31
32class ProxyError(Exception):
33 pass
34
35def unproxy(proxy):

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

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

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

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