# Path: snakeguice/injector.py
# def create_injector(modules):
#     """Factory for creating Injector instances."""
#     return Injector(modules)
# 
# Path: snakeguice/decorators.py
# def inject(**kwargs):
# 
#     scope = kwargs.get('scope')
#     if 'scope' in kwargs:
#         del kwargs['scope']
# 
#     def _inject(func):
#         class_locals = enclosing_frame().f_locals
# 
#         guice_data = GuiceData.from_class_dict(class_locals)
# 
#         annotations = getattr(func, '__guice_annotations__', {})
# 
#         gmethod = dict((k, GuiceArg(v, annotations.get(k)))
#                        for k, v in kwargs.items())
# 
#         _validate_func_args(func, kwargs)
#         if func.__name__ == '__init__':
#             guice_data.init = gmethod
#         else:
#             guice_data.methods[func.__name__] = gmethod
# 
#         return func
# 
#     return _inject
# 
# Path: snakeguice/interfaces.py
# class Injector(object):
#     """An interface automatically bound to the current Injector instance."""


from snakeguice import create_injector, inject
from snakeguice.interfaces import Injector


class ISomething(object):
    """An interface."""


class Something(object):
    """Something a little more concrete."""


class SomethingProvider(object):

    @inject(injector=Injector)
    def __init__(self, injector):
        self.injector = injector

    def get(self):
        return self.injector.get_instance(Something)


class Module(object):

    def configure(self, binder):
        binder.bind(ISomething, to_provider=SomethingProvider)


def test():

# Path: snakeguice/injector.py
# def create_injector(modules):
#     """Factory for creating Injector instances."""
#     return Injector(modules)
# 
# Path: snakeguice/decorators.py
# def inject(**kwargs):
# 
#     scope = kwargs.get('scope')
#     if 'scope' in kwargs:
#         del kwargs['scope']
# 
#     def _inject(func):
#         class_locals = enclosing_frame().f_locals
# 
#         guice_data = GuiceData.from_class_dict(class_locals)
# 
#         annotations = getattr(func, '__guice_annotations__', {})
# 
#         gmethod = dict((k, GuiceArg(v, annotations.get(k)))
#                        for k, v in kwargs.items())
# 
#         _validate_func_args(func, kwargs)
#         if func.__name__ == '__init__':
#             guice_data.init = gmethod
#         else:
#             guice_data.methods[func.__name__] = gmethod
# 
#         return func
# 
#     return _inject
# 
# Path: snakeguice/interfaces.py
# class Injector(object):
#     """An interface automatically bound to the current Injector instance."""


# Path: tests/system/test_injecting_the_injector.py
from snakeguice import create_injector, inject
from snakeguice.interfaces import Injector



class ISomething(object):
    """An interface."""


class Something(object):
    """Something a little more concrete."""


class SomethingProvider(object):

    @inject(injector=Injector)
    def __init__(self, injector):
        self.injector = injector

    def get(self):
        return self.injector.get_instance(Something)


class Module(object):

    def configure(self, binder):
        binder.bind(ISomething, to_provider=SomethingProvider)


def test():

    injector = create_injector([Module()])