/usr/share/pyshared/tables/nra/attributeaccess.py is in python-tables 2.3.1-2ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | import weakref
class AttributeAccess(object):
def __init__(self, container, accessor='__getattr__'):
mydict = self.__dict__
# XXXXXXXXXXXX WARNING XXXXXXXXXXXXXX
# The back reference to the container should be weak
# because if not, that would create a circular reference,
# and NestedRecArray ultimately inherits from
# numarray._ndarray._ndarray extension that have a dealloc
# and this is equivalent to a __del__ method, so the
# garbage collector does not work well in these situations
# XXXXXXXXXXXX WARNING XXXXXXXXXXXXXX
#mydict['__container'] = container
mydict['__container'] = weakref.ref(container)
mydict['__accessor'] = accessor
def __getattr__(self, name):
# XXXXXXXXXXXX WARNING XXXXXXXXXXXXXX
# The back reference to the container should be weak
# because if not, that would create a circular reference,
# and NestedRecArray ultimately inherits from
# numarray._ndarray._ndarray extension that have a dealloc
# and this is equivalent to a __del__ method, so the
# garbage collector does not work well in these situations
# XXXXXXXXXXXX WARNING XXXXXXXXXXXXXX
#container = self.__dict__['__container']
container = self.__dict__['__container']()
accessor = self.__dict__['__accessor']
return getattr(container, accessor)(name)
## Local Variables:
## mode: python
## py-indent-offset: 4
## tab-width: 4
## fill-column: 72
## End:
|