(
class_: Type[Any],
key: str,
*,
comparator: interfaces.PropComparator[_T],
parententity: _InternalEntityType[Any],
doc: Optional[str] = None,
)
| 2644 | |
| 2645 | |
| 2646 | def 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 | |
| 2666 | def unregister_attribute(class_: Type[Any], key: str) -> None: |
no test coverage detected