MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _register_descriptor

Function _register_descriptor

lib/sqlalchemy/orm/attributes.py:2673–2690  ·  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

2671
2672
2673def _register_descriptor(
2674 class_: Type[Any],
2675 key: str,
2676 *,
2677 comparator: interfaces.PropComparator[_T],
2678 parententity: _InternalEntityType[Any],
2679 doc: Optional[str] = None,
2680) -> InstrumentedAttribute[_T]:
2681 manager = manager_of_class(class_)
2682
2683 descriptor = InstrumentedAttribute(
2684 class_, key, comparator=comparator, parententity=parententity
2685 )
2686
2687 descriptor.__doc__ = doc # type: ignore
2688
2689 manager.instrument_attribute(key, descriptor)
2690 return descriptor
2691
2692
2693def _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