Deleted Added
sdiff udiff text old ( 3109:c3956807347f ) new ( 3179:c86dfc93984b )
full compact
1# Copyright (c) 2004-2006 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

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

28# Nathan Binkert
29
30#####################################################################
31#
32# Proxy object support.
33#
34#####################################################################
35
36class BaseProxy(object):
37 def __init__(self, search_self, search_up):
38 self._search_self = search_self
39 self._search_up = search_up
40 self._multiplier = None
41
42 def __str__(self):
43 if self._search_self and not self._search_up:

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

124 self._modifiers = []
125
126 def __getattr__(self, attr):
127 # python uses __bases__ internally for inheritance
128 if attr.startswith('_'):
129 return super(AttrProxy, self).__getattr__(self, attr)
130 if hasattr(self, '_pdesc'):
131 raise AttributeError, "Attribute reference on bound proxy"
132 self._modifiers.append(attr)
133 return self
134
135 # support indexing on proxies (e.g., Self.cpu[0])
136 def __getitem__(self, key):
137 if not isinstance(key, int):
138 raise TypeError, "Proxy object requires integer index"
139 self._modifiers.append(key)
140 return self
141
142 def find(self, obj):
143 try:
144 val = getattr(obj, self._attr)
145 except:
146 return None, False
147 while isproxy(val):
148 val = val.unproxy(obj)

--- 58 unchanged lines hidden ---