/usr/share/pyshared/mvpa/misc/vproperty.py is in python-mvpa 0.4.8-3.
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 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
"""C++-like virtual properties"""
__docformat__ = 'restructuredtext'
class VProperty(object):
"""Provides "virtual" property: uses derived class's method
"""
def __init__(self, fget=None, fset=None, fdel=None, doc=''):
for attr in ('fget', 'fset'):
func = locals()[attr]
if callable(func):
setattr(self, attr, func.func_name)
setattr(self, '__doc__', doc)
def __get__(self, obj=None, type=None):
if not obj:
return 'property'
if self.fget:
return getattr(obj, self.fget)()
def __set__(self, obj, arg):
if self.fset:
return getattr(obj, self.fset)(arg)
|