state = instance_state(obj)
return manager.has_parent(state, key, optimistic)
-def register_class(class_, **kw):
- """Register class instrumentation.
-
- Returns the existing or newly created class manager.
- """
-
- manager = manager_of_class(class_)
- if manager is None:
- manager = _create_manager_for_cls(class_, **kw)
- return manager
-
-def unregister_class(class_):
- """Unregister class instrumentation."""
-
- instrumentation_registry.unregister(class_)
-
def register_attribute(class_, key, **kw):
- proxy_property = kw.pop('proxy_property', None)
-
comparator = kw.pop('comparator', None)
parententity = kw.pop('parententity', None)
doc = kw.pop('doc', None)
parententity=None, property_=None, doc=None):
manager = manager_of_class(class_)
- if proxy_property:
- proxy_type = proxied_attribute_factory(proxy_property)
- descriptor = proxy_type(key, proxy_property, comparator, parententity)
- else:
- descriptor = InstrumentedAttribute(class_, key, comparator=comparator,
- descriptor = InstrumentedAttribute(key, comparator=comparator,
++ descriptor = InstrumentedAttribute(class_, key, comparator=comparator,
parententity=parententity)
descriptor.__doc__ = doc