pytest_wdl/plugins.py
def plugin_factory_map(
    return_type: Type[T],
    group: Optional[str] = None,
    entry_points: Optional[Iterable[EntryPoint]] = None
) -> Dict[str, PluginFactory[T]]:
    """
    Creates a mapping of entry point name to `PluginFactory` for all discovered
    entry points in the specified group.

    Args:
        group: Entry point group name
        return_type: Expected return type
        entry_points:

    Returns:
        Dict mapping entry point name to `PluginFactory` instances
    """
    if entry_points is None:
        entry_points = iter_entry_points(group=group)

    entry_point_map = defaultdict(list)

    for entry_point in entry_points:
        entry_point_map[entry_point.name].append(entry_point)

    factory_map = {}

    for name, points in entry_point_map.items():
        if len(points) > 1:
            # Filter out built-ins
            points = list(filter(
                lambda point: not point.module_name.startswith("pytest_wdl"), points
            ))
            if len(points) > 1:
                raise RuntimeError(
                    f"Multiple third-party plugins found in group {group} with the "
                    f"same name: {name}"
                )

        ep = points[0]

        try:
            ep.require()
        except ResourceWarning as rerr:
            LOG.warning(
                "Plugin %s is not available because it is missing an extra "
                "dependency: %s", name, str(rerr)
            )
            continue
        except ResolutionError as rerr:
            LOG.warning(
                "Plugin %s is not available because it is missing an extra "
                "dependency: %s", name, str(rerr)
            )
            continue
        except PluginError as perr:
            LOG.warning(
                "Error while loading plugin %s: %s", name, str(perr)
            )
            continue

        factory_map[name] = PluginFactory(ep, return_type)

    return factory_map

    Creates a mapping of entry point name to `PluginFactory` for all discovered
    entry points in the specified group.

    Args:
        group: Entry point group name
        return_type: Expected return type
        entry_points:

    Returns:
        Dict mapping entry point name to `PluginFactory` instances
    
Creates a mapping of entry point name to `PluginFactory` for all discovered
entry points in the specified group.
Creates a mapping of entry point name to ` PluginFactory ` for all discovered entry points in the specified group .
def plugin_factory_map(
    return_type: Type[T],
    group: Optional[str] = None,
    entry_points: Optional[Iterable[EntryPoint]] = None
) -> Dict[str, PluginFactory[T]]:
    if entry_points is None:
        entry_points = iter_entry_points(group=group)
    entry_point_map = defaultdict(list)
    for entry_point in entry_points:
        entry_point_map[entry_point.name].append(entry_point)
    factory_map = {}
    for name, points in entry_point_map.items():
        if len(points) > 1:
            points = list(filter(
                lambda point: not point.module_name.startswith("pytest_wdl"), points
            ))
            if len(points) > 1:
                raise RuntimeError(
                    f"Multiple third-party plugins found in group {group} with the "
                    f"same name: {name}"
                )
        ep = points[0]
        try:
            ep.require()
        except ResourceWarning as rerr:
            LOG.warning(
                "Plugin %s is not available because it is missing an extra "
                "dependency: %s", name, str(rerr)
            )
            continue
        except ResolutionError as rerr:
            LOG.warning(
                "Plugin %s is not available because it is missing an extra "
                "dependency: %s", name, str(rerr)
            )
            continue
        except PluginError as perr:
            LOG.warning(
                "Error while loading plugin %s: %s", name, str(perr)
            )
            continue
        factory_map[name] = PluginFactory(ep, return_type)
    return factory_map
def plugin_factory_map ( return_type : Type [ T ] , group : Optional [ str ] = None , entry_points : Optional [ Iterable [ EntryPoint ] ] = None ) -> Dict [ str , PluginFactory [ T ] ] : if entry_points is None : entry_points = iter_entry_points ( group = group ) entry_point_map = defaultdict ( list ) for entry_point in entry_points : entry_point_map [ entry_point . name ] . append ( entry_point ) factory_map = { } for name , points in entry_point_map . items ( ) : if len ( points ) > 1 : points = list ( filter ( lambda point : not point . module_name . startswith ( "pytest_wdl" ) , points ) ) if len ( points ) > 1 : raise RuntimeError ( f"Multiple third-party plugins found in group {group} with the " f"same name: {name}" ) ep = points [ 0 ] try : ep . require ( ) except ResourceWarning as rerr : LOG . warning ( "Plugin %s is not available because it is missing an extra " "dependency: %s" , name , str ( rerr ) ) continue except ResolutionError as rerr : LOG . warning ( "Plugin %s is not available because it is missing an extra " "dependency: %s" , name , str ( rerr ) ) continue except PluginError as perr : LOG . warning ( "Error while loading plugin %s: %s" , name , str ( perr ) ) continue factory_map [ name ] = PluginFactory ( ep , return_type ) return factory_map
Creates a mapping of entry point name to `PluginFactory` for all discovered
entry points in the specified group.
Creates a mapping of entry point name to ` PluginFactory ` for all discovered entry points in the specified group .
"""
    Creates a mapping of entry point name to `PluginFactory` for all discovered
    entry points in the specified group.

    Args:
        group: Entry point group name
        return_type: Expected return type
        entry_points:

    Returns:
        Dict mapping entry point name to `PluginFactory` instances
    """ # Filter out built-ins
Dict mapping entry point name to `PluginFactory` instances
Dict mapping entry point name to ` PluginFactory ` instances
return_type
Type[T]
Expected return type
Expected return type
group
Optional[str]
Entry point group name
Entry point group name
entry_points
Optional[Iterable[EntryPoint]]
None