ParentLookup¶
- class parent_lookup.lookup.ParentLookup(parent_type: type[TParent])¶
Bases:
GenericDescriptor that resolves a parent instance for a child object.
The descriptor is intended for declaration on child classes to avoid repeating explicit
find_parentmethods. It delegates lookup resolution tolookup_registryand returnsNonewhen no parent is found.- Parameters:
parent_type (type[TParent])
- __init__(parent_type: type[TParent]) None¶
Configure the parent type that this descriptor resolves.
- Parameters:
parent_type (type[TParent]) – The class of parent objects to look up.
- Return type:
None
Methods
__init__(parent_type)Configure the parent type that this descriptor resolves.