Skip to content

Check Methods

_check_methods

Structural subtype checking for __subclasshook__ consumers.

check_methods(subclass: type, *method_names: str) -> bool

Return True when subclass has all the named callable attributes.

Source code in src/forging_blocks/foundation/ports/_check_methods.py
4
5
6
def check_methods(subclass: type, *method_names: str) -> bool:
    """Return ``True`` when *subclass* has all the named callable attributes."""
    return all(callable(getattr(subclass, name, None)) for name in method_names)