def infect(cls, graph, key, default_scope=None):
        """
        Forcibly convert an entry-point based factory to a ScopedFactory.

        Must be invoked before resolving the entry point.

        :raises AlreadyBoundError: for non entry-points; these should be declared with @scoped_binding

        """
        func = graph.factory_for(key)
        if isinstance(func, cls):
            func = func.func
        factory = cls(key, func, default_scope)
        graph._registry.factories[key] = factory
        return factory
def infect ( cls , graph , key , default_scope = None ) : func = graph . factory_for ( key ) if isinstance ( func , cls ) : func = func . func factory = cls ( key , func , default_scope ) graph . _registry . factories [ key ] = factory return factory
Forcibly convert an entry-point based factory to a ScopedFactory.

        Must be invoked before resolving the entry point.

        :raises AlreadyBoundError: for non entry-points; these should be declared with @scoped_binding