MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / register_descriptor

Function register_descriptor

lib/sqlalchemy/orm/attributes.py:2646–2663  ·  view source on GitHub ↗
(
    class_: Type[Any],
    key: str,
    *,
    comparator: interfaces.PropComparator[_T],
    parententity: _InternalEntityType[Any],
    doc: Optional[str] = None,
)

Source from the content-addressed store, hash-verified

2644
2645
2646def register_descriptor(
2647 class_: Type[Any],
2648 key: str,
2649 *,
2650 comparator: interfaces.PropComparator[_T],
2651 parententity: _InternalEntityType[Any],
2652 doc: Optional[str] = None,
2653) -> InstrumentedAttribute[_T]:
2654 manager = manager_of_class(class_)
2655
2656 descriptor = InstrumentedAttribute(
2657 class_, key, comparator=comparator, parententity=parententity
2658 )
2659
2660 descriptor.__doc__ = doc # type: ignore
2661
2662 manager.instrument_attribute(key, descriptor)
2663 return descriptor
2664
2665
2666def unregister_attribute(class_: Type[Any], key: str) -> None:

Callers 1

register_attributeFunction · 0.85

Calls 3

manager_of_classFunction · 0.85
instrument_attributeMethod · 0.45

Tested by

no test coverage detected