def __get__(self, inst, cls=None): if inst is None: # pragma: no cover (Not sure how we can get here) return getObjectSpecification(cls) provided = providedBy(getProxiedObject(inst)) # Use type rather than __class__ because inst is a proxy and # will return the proxied object's class. cls = type(inst) return ObjectSpecification(provided, cls)
def __get__(self, inst, cls=None): if inst is None: # pragma: no cover (Not sure how we can get here) return self proxied_object = getProxiedObject(inst) checker = getattr(proxied_object, '__Security_checker__', None) if checker is None: checker = selectChecker(proxied_object) wrapper_checker = selectChecker(inst) if wrapper_checker is None: # pragma: no cover return checker if checker is None: return wrapper_checker return CombinedChecker(wrapper_checker, checker)
def __get__(self, inst, cls=None): if inst is None: # pragma: no cover (Not sure how we can get here) return getObjectSpecification(cls) provided = providedBy(getProxiedObject(inst)) # Use type rather than __class__ because inst is a proxy and # will return the proxied object's class. cls = type(inst) implemented_by_cls = implementedBy(cls) for iface in list(provided): if implemented_by_cls.isOrExtends(iface): provided = provided - iface return Provides(cls, provided)
def __delete__(self, inst): # CPython can hit this, PyPy/PURE_PYTHON cannot inst = getProxiedObject(inst) del inst.__provides__
def __set__(self, inst, value): inst = getProxiedObject(inst) inst.__provides__ = value