dstanek/snake-guice — pull request #2 by rassilon (2013-03-02 05:11:01+00:00)
Title: Fixes for google issues 11, 14, and 16

Apologies for the messy commit history in the pull request.

I would have rebased but you're not supposed to do that for published history (i.e. google code).

You may notice I reverted the provider instance caching.
I don't think you can do that without verifying that the provider exists in the current binder's (or parent's) Singleton scope instance. (The fix for issue 11.)

The fix for issue 11 essentially means you need to register a scope to the binder by calling binder.bind_scope before you can bind something into the scope.

The binder.get_binding change revolved around the subtle and complex fix to multibinder.

The reason for the complexity is that all items in the multibinding have individual bindings in the binder (as well as a dynamic provider to inject the multibinder).

The key of the dynamic provider class is:

Key(<_MultiBinderSubClass>.multibinding_type(),
)

The key of each of the multibinder items is:

Key(,
), # the name
<_MultiBinderSubClass>.multibinding_type.__name__) # the type
instance>)

The core concept of these keys is _RealElement which is essentiallyt:

(,
, )

The new _ _ str _ _ method for Annotation is just as important since it becomes the name of _RealElement.

Thanks again for snake-guice,
Bill