mro_lookup
Return the first node by MRO order that defines an attribute.
def mro_lookup(
cls: Any,
attr: string,
stop: Set[Any],
monkey_patched: Sequence
) - > Any
Return the first node by MRO order that defines an attribute.
Parameters
| Name | Type | Description |
|---|---|---|
| cls | Any | The child class to begin the Method Resolution Order (MRO) traversal from. |
| attr | string | The name of the attribute to locate within the class hierarchy. |
| stop | Set[Any] | A set of types that, if encountered during traversal, will terminate the search. |
| monkey_patched | Sequence | A list of module names used to validate attribute origins; if a stop class is reached and the attribute's module is not in this list, the stop class is returned to detect monkey-patched attributes. |
Returns
| Type | Description |
|---|---|
Any | The class node that defines the attribute, or None if the attribute is not found within the search constraints. |