info.py (2665:a124942bacb8) | info.py (2716:b9114064d77a) |
---|---|
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 --- 162 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'): | 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 --- 162 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'): |
179 result = self.source.data(self, self.bins, self.ticks) | 179 result = self.source.data(self, self.ticks) |
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 | 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 |
188 if attr in ('source', 'bins', 'ticks'): | 188 if attr in ('source', 'ticks'): |
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 | 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 | |
765 stat.__dict__['ticks'] = None 766 stat.__dict__.update(data.__dict__) 767 768 return stat 769 | 764 stat.__dict__['ticks'] = None 765 stat.__dict__.update(data.__dict__) 766 767 return stat 768 |