import pathlib
import typing


def _get_source_directories(
    root_directory: pathlib.Path,
    module_filters: typing.List[str],
) -> typing.List[pathlib.Path]:
    """
    List source directories to include in the run operation.

    These will be children of the root directory that match the list of module
    filters. If not filters are specified, all children directories will be included
    in the output.
    """
    return [
        p
        for p in root_directory.iterdir()
        if p.is_dir() and (not module_filters or p.name in module_filters)
    ]