mordred/_base/calculator.py
def get_descriptors_in_module(mdl, submodule=True):
    r"""Get descriptors in module.

    Parameters:
        mdl(module): module to search
        submodule(bool): search recursively

    Returns:
        Iterator[Descriptor]

    """
    __all__ = getattr(mdl, "__all__", None)
    if __all__ is None:
        __all__ = dir(mdl)

    all_values = (getattr(mdl, name) for name in __all__ if name[:1] != "_")

    if submodule:
        for v in all_values:
            if is_descriptor_class(v):
                yield v
            if isinstance(v, ModuleType):
                for v in get_descriptors_in_module(v, submodule=True):
                    yield v

    else:
        for v in all_values:
            if is_descriptor_class(v):
                yield v
def get_descriptors_in_module(mdl, submodule=True):
    r"""Get descriptors in module.

    Parameters:
        mdl(module): module to search
        submodule(bool): search recursively

    Returns:
        Iterator[Descriptor]

    """
    __all__ = getattr(mdl, "__all__", None)
    if __all__ is None:
        __all__ = dir(mdl)

    all_values = (getattr(mdl, name) for name in __all__ if name[:1] != "_")

    if submodule:
        for v in all_values:
            if is_descriptor_class(v):
                yield v
            if isinstance(v, ModuleType):
                for v in get_descriptors_in_module(v, submodule=True):
                    yield v

    else:
        for v in all_values:
            if is_descriptor_class(v):
                yield v
r"""Get descriptors in module.

    Parameters:
        mdl(module): module to search
        submodule(bool): search recursively

    Returns:
        Iterator[Descriptor]