SimObject.py (7493:81328f5e764a) | SimObject.py (7500:b543b8e5fcbc) |
---|---|
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 --- 513 unchanged lines hidden (view full) --- 522 523 def __getattr__(self, attr): 524 if self._ports.has_key(attr): 525 return self._get_port_ref(attr) 526 527 if self._values.has_key(attr): 528 return self._values[attr] 529 | 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 --- 513 unchanged lines hidden (view full) --- 522 523 def __getattr__(self, attr): 524 if self._ports.has_key(attr): 525 return self._get_port_ref(attr) 526 527 if self._values.has_key(attr): 528 return self._values[attr] 529 |
530 # If the attribute exists on the C++ object, transparently 531 # forward the reference there. This is typically used for 532 # SWIG-wrapped methods such as init(), regStats(), 533 # regFormulas(), resetStats(), and startup(). 534 if self._ccObject and hasattr(self._ccObject, attr): 535 return getattr(self._ccObject, attr) 536 |
|
530 raise AttributeError, "object '%s' has no attribute '%s'" \ 531 % (self.__class__.__name__, attr) 532 533 # Set attribute (called on foo.attr = value when foo is an 534 # instance of class cls). 535 def __setattr__(self, attr, value): 536 # normal processing for private attributes 537 if attr.startswith('_'): --- 361 unchanged lines hidden --- | 537 raise AttributeError, "object '%s' has no attribute '%s'" \ 538 % (self.__class__.__name__, attr) 539 540 # Set attribute (called on foo.attr = value when foo is an 541 # instance of class cls). 542 def __setattr__(self, attr, value): 543 # normal processing for private attributes 544 if attr.startswith('_'): --- 361 unchanged lines hidden --- |