David Stanek avatar David Stanek committed 500a40c

removed Injected since I think it was a bad idea

Comments (0)

Files changed (8)

examples/cherrypy/controller.py

-from snakeguice import inject, Injected
+from snakeguice import inject
 
 from providers import UserProvider, RequestDataProvider
 

snakeguice/__init__.py

 from snakeguice.decorators import inject, annotate, provides
 from snakeguice.errors import SnakeGuiceError, BindingError
 from snakeguice.interceptors import ParameterInterceptor
-
-
-# TODO: delete this; i don't really like this anymore; it will die soon
-Injected = object() # pylint: disable-msg=C0103

specs/inheritance_spec.py

 """Specification for how snake-guice handles inherited classes."""
 
 
-from snakeguice import Injector, inject, Injected, annotate
+from snakeguice import Injector, inject, annotate
 
 
 class Data(object): pass

specs/injecting_configuration_spec.py

 
 """Specification for how snake-guice handles injection."""
 
-from snakeguice import inject, annotate, Injected, Injector
+from snakeguice import inject, annotate, Injector
 from snakeguice.config import Config, ConfigParserLoader
 
 
 
         @inject(ipaddress=Config('config.ini:webservice:ipaddress'),
                 port=Config('config.ini:webservice:port'))
-        def __init__(self, ipaddress=Injected, port=Injected):
+        def __init__(self, ipaddress, port):
             self.ipaddress = ipaddress
             self.port = port
 

specs/injecting_spec.py

 """Specification for how snake-guice handles injection."""
 
 
-from snakeguice import Injector, inject, Injected, annotate
+from snakeguice import Injector, inject, annotate
 
 
 def describe_injecting_a_class():
     class DomainObject(object):
 
         @inject(class_=IClass)
-        def __init__(self, class_=Injected):
+        def __init__(self, class_):
             self.class_ = class_
 
     class Module(object):

tests/system/test_api.py

 #TODO: add a test proving call throughs work
 
 
-from snakeguice import inject, Injected, ParameterInterceptor, annotate
+from snakeguice import inject, ParameterInterceptor, annotate
 from snakeguice import Injector, provides
 
 from .. import cls_heirarchy as ch
     class DomainObject(object):
         @inject(person0=ch.Person, person1=ch.Person, person2=ch.Person)
         @annotate(person0='good', person1='evil')
-        def __init__(self, person0=Injected, person1=Injected,
-                person2=Injected):
+        def __init__(self, person0, person1, person2):
             self.person0 = person0
             self.person1 = person1
             self.person2 = person2
     class DomainObject(object):
         @inject(hero=ch.Person, villian=ch.Person, victim=ch.Person)
         @annotate(hero='good', villian='evil')
-        def __init__(self, hero=Injected, villian=Injected, victim=Injected):
+        def __init__(self, hero, villian, victim):
             self.hero = hero
             self.villian = villian
             self.victim = victim
     class DomainObject(object):
 
         @inject(logger=ch.Logger)
-        def __init__(self, logger=Injected):
+        def __init__(self, logger):
             assert isinstance(logger, ch.ConcreteLogger)
 
         @inject(person=ch.Person)
-        def do_something(self, person=Injected):
+        def do_something(self, person):
             assert isinstance(person, ch.EvilPerson)
 
         @inject(person=ch.Person, logger=ch.Logger)
-        def multipl(self, logger=Injected, person=Injected):
+        def multipl(self, logger, person):
             assert isinstance(person, ch.EvilPerson)
             assert isinstance(logger, ch.ConcreteLogger)
 
     def test_noargs(self):
         class DomainObject(object):
             @self.interceptor(person=ch.Person, annotation='evil')
-            def intercept_me(self, person=Injected):
+            def intercept_me(self, person):
                 assert isinstance(person, ch.EvilPerson)
 
         obj = self.injector.get_instance(DomainObject)
         class DomainObject(object):
             @self.interceptor(person=ch.Person, annotation='evil')
             def intercept_me(self, arg0,
-                    kwarg0=None, kwarg1=None, person=Injected):
+                    kwarg0=None, kwarg1=None, person=None):
                 assert arg0 == 0
                 assert kwarg0 == 1
                 assert kwarg1 is None
         class DomainObject(object):
             @self.interceptor(person0=ch.Person, annotation='good')
             @self.interceptor(person1=ch.Person, annotation='evil')
-            def intercept_me(self, person0=Injected, person1=Injected):
+            def intercept_me(self, person0, person1):
                 assert isinstance(person0, ch.GoodPerson)
                 assert isinstance(person1, ch.EvilPerson)
 

tests/test_injector.py

 
 from dingus import Dingus
 
-from snakeguice import create_injector, injector, Injected
-from snakeguice import binder
+from snakeguice import create_injector, injector, binder
 import cls_heirarchy as ch
 
 

tests/test_singletons.py

 Tests for the singleton scope.py
 """
 
-from snakeguice import inject, Injected, scopes, Injector, annotate
+from snakeguice import inject, scopes, Injector, annotate
 
 import cls_heirarchy as ch
 
     class DomainObject(object):
 
         @inject(logger_a=ch.Logger, logger_b=ch.Logger, logger_c=ch.Logger)
-        def set_loggers(self, logger_a=Injected, logger_b=Injected,
-                logger_c=Injected):
+        def set_loggers(self, logger_a, logger_b, logger_c):
             self.logger_a = logger_a
             self.logger_b = logger_b
             self.logger_c = logger_c
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.