pg.typing.get_outer_class¶
Accessible via pg.typing.get_outer_class.
- get_outer_class(cls, base_cls=None, immediate=False)[source]¶
Returns the outer class.
Example:
class A: pass class A1: class B: class C: ... pg.typing.outer_class(B) is A1 pg.typing.outer_class(C) is B pg.typing.outer_class(C, base_cls=A) is None pg.typing.outer_class(C, base_cls=A1) is None
- Return type:
- Parameters:
cls – The class to get the outer class for.
base_cls – The base class of the outer class. If provided, an outer class that is not a subclass of base_cls will be returned as None.
immediate – Whether to return the immediate outer class or a class in the nesting hierarchy that is a subclass of base_cls. Applicable when base_cls is not None.
- Returns:
- The outer class of cls. None if cannot find one or the outer class is
not a subclass of base_cls.