info.py (1987:256b113e2c2e) info.py (2015:fab23b1eb6f4)
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

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

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
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

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

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
30def unproxy(proxy):
31 if hasattr(proxy, '__unproxy__'):
32 return proxy.__unproxy__()
33
34 return proxy
35
36def scalar(stat):
37 stat = unproxy(stat)

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

331 return '%s[%s]' % (self.proxy, self.index)
332
333class AttrProxy(Proxy):
334 def __init__(self, proxy, attr):
335 self.proxy = proxy
336 self.attr = attr
337
338 def __unproxy__(self):
33def unproxy(proxy):
34 if hasattr(proxy, '__unproxy__'):
35 return proxy.__unproxy__()
36
37 return proxy
38
39def scalar(stat):
40 stat = unproxy(stat)

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

334 return '%s[%s]' % (self.proxy, self.index)
335
336class AttrProxy(Proxy):
337 def __init__(self, proxy, attr):
338 self.proxy = proxy
339 self.attr = attr
340
341 def __unproxy__(self):
339 return unproxy(getattr(unproxy(self.proxy), self.attr))
342 proxy = unproxy(self.proxy)
343 try:
344 attr = getattr(proxy, self.attr)
345 except AttributeError, e:
346 raise ProxyError, e
347 return unproxy(attr)
340
341 def __str__(self):
342 return '%s.%s' % (self.proxy, self.attr)
343
344class ProxyGroup(object):
345 def __init__(self, dict=None, **kwargs):
346 self.__dict__['dict'] = {}
347

--- 412 unchanged lines hidden ---
348
349 def __str__(self):
350 return '%s.%s' % (self.proxy, self.attr)
351
352class ProxyGroup(object):
353 def __init__(self, dict=None, **kwargs):
354 self.__dict__['dict'] = {}
355

--- 412 unchanged lines hidden ---