diff --git a/README.rst b/README.rst index a0186a95..21aabde7 100644 --- a/README.rst +++ b/README.rst @@ -71,7 +71,6 @@ Examples class ObjectA(object): - """Example class ObjectA, that has dependency on database.""" def __init__(self, db): @@ -80,7 +79,6 @@ Examples class ObjectB(object): - """Example class ObjectB, that has dependencies on ObjectA and database.""" def __init__(self, a, db): @@ -90,7 +88,6 @@ Examples class Catalog(di.AbstractCatalog): - """Catalog of providers.""" database = di.Singleton(sqlite3.Connection, diff --git a/dependency_injector/catalog.py b/dependency_injector/catalog.py index 8f302320..5d995317 100644 --- a/dependency_injector/catalog.py +++ b/dependency_injector/catalog.py @@ -9,7 +9,6 @@ from .utils import is_catalog class CatalogMetaClass(type): - """Providers catalog meta class.""" def __new__(mcs, class_name, bases, attributes): @@ -35,7 +34,6 @@ class CatalogMetaClass(type): @six.add_metaclass(CatalogMetaClass) class AbstractCatalog(object): - """Abstract providers catalog. :type providers: dict[str, dependency_injector.Provider] diff --git a/dependency_injector/errors.py b/dependency_injector/errors.py index b5cc1414..0140fa82 100644 --- a/dependency_injector/errors.py +++ b/dependency_injector/errors.py @@ -2,5 +2,4 @@ class Error(Exception): - """Base error.""" diff --git a/dependency_injector/injections.py b/dependency_injector/injections.py index fde45105..bc0cf797 100644 --- a/dependency_injector/injections.py +++ b/dependency_injector/injections.py @@ -18,7 +18,6 @@ else: # pragma: no cover class Injection(object): - """Base injection class.""" __IS_INJECTION__ = True @@ -38,21 +37,18 @@ class Injection(object): class KwArg(Injection): - """Keyword argument injection.""" __IS_KWARG_INJECTION__ = True class Attribute(Injection): - """Attribute injection.""" __IS_ATTRIBUTE_INJECTION__ = True class Method(Injection): - """Method injection.""" __IS_METHOD_INJECTION__ = True diff --git a/dependency_injector/providers.py b/dependency_injector/providers.py index 98dbde5d..69351cbb 100644 --- a/dependency_injector/providers.py +++ b/dependency_injector/providers.py @@ -15,7 +15,6 @@ from .errors import Error class Provider(object): - """Base provider class.""" __IS_PROVIDER__ = True @@ -76,7 +75,6 @@ class Provider(object): class Delegate(Provider): - """Provider's delegate.""" __slots__ = ('delegated',) @@ -95,7 +93,6 @@ class Delegate(Provider): class Factory(Provider): - """Factory provider. Factory provider creates new instance of specified class on every call. @@ -142,7 +139,6 @@ class Factory(Provider): class Singleton(Provider): - """Singleton provider. Singleton provider will create instance once and return it on every call. @@ -169,7 +165,6 @@ class Singleton(Provider): class ExternalDependency(Provider): - """External dependency provider. Those provider is used when dependency obviously have to be overridden by @@ -205,7 +200,6 @@ class ExternalDependency(Provider): class StaticProvider(Provider): - """Static provider. Static provider is base implementation that provides exactly the same as @@ -225,27 +219,22 @@ class StaticProvider(Provider): class Class(StaticProvider): - """Class provider provides class.""" class Object(StaticProvider): - """Object provider provides object.""" class Function(StaticProvider): - """Function provider provides function.""" class Value(StaticProvider): - """Value provider provides value.""" class Callable(Provider): - """Callable provider. Callable provider provides callable that is called on every provider call @@ -270,7 +259,6 @@ class Callable(Provider): class Config(Provider): - """Config provider. Config provider provides dict values. Also config provider creates @@ -309,7 +297,6 @@ class Config(Provider): class ChildConfig(Provider): - """Child config provider. Child config provide an value from the root config object according to diff --git a/examples/advanced_usage/config_provider.py b/examples/advanced_usage/config_provider.py index 054d7519..6ecbf453 100644 --- a/examples/advanced_usage/config_provider.py +++ b/examples/advanced_usage/config_provider.py @@ -7,7 +7,6 @@ from dependency_injector.injections import KwArg class ObjectA(object): - """Example class ObjectA, that has dependencies on some setting values.""" def __init__(self, fee, price, timezone): @@ -18,7 +17,6 @@ class ObjectA(object): class Catalog(AbstractCatalog): - """Catalog of dependency_injector providers.""" config = Config() diff --git a/examples/advanced_usage/inject_flask_class_based.py b/examples/advanced_usage/inject_flask_class_based.py index 09086417..3908ef41 100644 --- a/examples/advanced_usage/inject_flask_class_based.py +++ b/examples/advanced_usage/inject_flask_class_based.py @@ -18,7 +18,6 @@ app = flask.Flask(__name__) @di.inject(database=database) @di.inject(some_setting=777) class HelloView(flask.views.View): - """Example flask class-based view.""" def __init__(self, database, some_setting): diff --git a/examples/catalogs/operating_with_providers.py b/examples/catalogs/operating_with_providers.py index d3246168..070f82df 100644 --- a/examples/catalogs/operating_with_providers.py +++ b/examples/catalogs/operating_with_providers.py @@ -4,7 +4,6 @@ import dependency_injector as di class CatalogA(di.AbstractCatalog): - """Example catalog A.""" provider1 = di.Factory(object) @@ -12,7 +11,6 @@ class CatalogA(di.AbstractCatalog): class CatalogB(CatalogA): - """Example catalog B.""" provider2 = di.Singleton(object) diff --git a/examples/catalogs/override.py b/examples/catalogs/override.py index 07bb8f0f..60f58a39 100644 --- a/examples/catalogs/override.py +++ b/examples/catalogs/override.py @@ -11,7 +11,6 @@ ExtendedObject2 = collections.namedtuple('ExtendedObject2', []) class Catalog(di.AbstractCatalog): - """Providers catalog.""" object1_factory = di.Factory(Object1, @@ -25,7 +24,6 @@ class Catalog(di.AbstractCatalog): class AnotherCatalog(di.AbstractCatalog): - """Another providers catalog.""" object2_factory = di.Factory(ExtendedObject2) diff --git a/examples/catalogs/override_decorator.py b/examples/catalogs/override_decorator.py index 0f53d244..189b76ea 100644 --- a/examples/catalogs/override_decorator.py +++ b/examples/catalogs/override_decorator.py @@ -11,7 +11,6 @@ ExtendedObject2 = collections.namedtuple('ExtendedObject2', []) class Catalog(di.AbstractCatalog): - """Providers catalog.""" object1_factory = di.Factory(Object1, @@ -27,7 +26,6 @@ class Catalog(di.AbstractCatalog): # Overriding `Catalog` with `AnotherCatalog`: @di.override(Catalog) class AnotherCatalog(di.AbstractCatalog): - """Another providers catalog.""" object2_factory = di.Factory(ExtendedObject2) diff --git a/examples/catalogs/simple.py b/examples/catalogs/simple.py index 19ab853d..1d63eafa 100644 --- a/examples/catalogs/simple.py +++ b/examples/catalogs/simple.py @@ -10,7 +10,6 @@ Object2 = collections.namedtuple('Object2', ['object1']) class Catalog(di.AbstractCatalog): - """Providers catalog.""" object1_factory = di.Factory(Object1, diff --git a/examples/concept.py b/examples/concept.py index 0e79dd42..6617c7ca 100644 --- a/examples/concept.py +++ b/examples/concept.py @@ -5,7 +5,6 @@ import dependency_injector as di class ObjectA(object): - """Example class ObjectA, that has dependency on database.""" def __init__(self, db): @@ -14,7 +13,6 @@ class ObjectA(object): class ObjectB(object): - """Example class ObjectB, that has dependencies on ObjectA and database.""" def __init__(self, a, db): @@ -24,7 +22,6 @@ class ObjectB(object): class Catalog(di.AbstractCatalog): - """Catalog of providers.""" database = di.Singleton(sqlite3.Connection, diff --git a/examples/providers/custom_factory.py b/examples/providers/custom_factory.py index d1e6cbf1..2264c736 100644 --- a/examples/providers/custom_factory.py +++ b/examples/providers/custom_factory.py @@ -4,12 +4,10 @@ import dependency_injector as di class User(object): - """Example class User.""" class UsersFactory(di.Provider): - """Example users factory.""" __slots__ = ('_factory',) diff --git a/examples/providers/external_dependency.py b/examples/providers/external_dependency.py index 8408e183..683c265c 100644 --- a/examples/providers/external_dependency.py +++ b/examples/providers/external_dependency.py @@ -6,7 +6,6 @@ import dependency_injector as di class UserService(object): - """Example class UserService. UserService has dependency on DBAPI 2.0 database connection. diff --git a/examples/providers/factory.py b/examples/providers/factory.py index 63103b5e..c38ea954 100644 --- a/examples/providers/factory.py +++ b/examples/providers/factory.py @@ -4,7 +4,6 @@ import dependency_injector as di class User(object): - """Example class User.""" # Factory provider creates new instance of specified class on every call. diff --git a/examples/providers/factory_attribute_injections.py b/examples/providers/factory_attribute_injections.py index 96792194..ef46c3bb 100644 --- a/examples/providers/factory_attribute_injections.py +++ b/examples/providers/factory_attribute_injections.py @@ -4,7 +4,6 @@ import dependency_injector as di class User(object): - """Example class User.""" def __init__(self): @@ -14,12 +13,10 @@ class User(object): class Photo(object): - """Example class Photo.""" class CreditCard(object): - """Example class CreditCard.""" # User, Photo and CreditCard factories: diff --git a/examples/providers/factory_delegation.py b/examples/providers/factory_delegation.py index f878f6f0..5e9b12bc 100644 --- a/examples/providers/factory_delegation.py +++ b/examples/providers/factory_delegation.py @@ -4,7 +4,6 @@ import dependency_injector as di class User(object): - """Example class User.""" def __init__(self, photos_factory): @@ -25,7 +24,6 @@ class User(object): class Photo(object): - """Example class Photo.""" # User and Photo factories: diff --git a/examples/providers/factory_init_injections.py b/examples/providers/factory_init_injections.py index cc45751e..1649c9ec 100644 --- a/examples/providers/factory_init_injections.py +++ b/examples/providers/factory_init_injections.py @@ -4,7 +4,6 @@ import dependency_injector as di class User(object): - """Example class User.""" def __init__(self, main_photo): @@ -14,7 +13,6 @@ class User(object): class Photo(object): - """Example class Photo.""" # User and Photo factories: diff --git a/examples/providers/factory_init_injections_and_contexts.py b/examples/providers/factory_init_injections_and_contexts.py index da82d0b3..6bc196d3 100644 --- a/examples/providers/factory_init_injections_and_contexts.py +++ b/examples/providers/factory_init_injections_and_contexts.py @@ -4,7 +4,6 @@ import dependency_injector as di class User(object): - """Example class User. Class User has to be provided with user id. @@ -24,12 +23,10 @@ class User(object): class Photo(object): - """Example class Photo.""" class CreditCard(object): - """Example class CreditCard.""" # User, Photo and CreditCard factories: diff --git a/examples/providers/factory_method_injections.py b/examples/providers/factory_method_injections.py index 0e54d305..53c0d6e6 100644 --- a/examples/providers/factory_method_injections.py +++ b/examples/providers/factory_method_injections.py @@ -4,7 +4,6 @@ import dependency_injector as di class User(object): - """Example class User.""" def __init__(self): @@ -22,12 +21,10 @@ class User(object): class Photo(object): - """Example class Photo.""" class CreditCard(object): - """Example class CreditCard.""" # User, Photo and CreditCard factories: diff --git a/examples/providers/overriding_simple.py b/examples/providers/overriding_simple.py index d325acdb..f99d0b64 100644 --- a/examples/providers/overriding_simple.py +++ b/examples/providers/overriding_simple.py @@ -4,7 +4,6 @@ import dependency_injector as di class User(object): - """Example class User.""" # Users factory: @@ -21,7 +20,6 @@ assert isinstance(user1, User) and isinstance(user2, User) # Extending User: class SuperUser(User): - """Example class SuperUser.""" # Overriding users factory: diff --git a/examples/providers/overriding_users_model.py b/examples/providers/overriding_users_model.py index 688b259f..e3db9be2 100644 --- a/examples/providers/overriding_users_model.py +++ b/examples/providers/overriding_users_model.py @@ -4,7 +4,6 @@ import dependency_injector as di class User(object): - """Example class User.""" def __init__(self, id, password): @@ -15,7 +14,6 @@ class User(object): class UserService(object): - """Example class UserService.""" def __init__(self, user_cls): @@ -50,7 +48,6 @@ assert user1 is not user2 class ExtendedUser(User): - """Example class ExtendedUser.""" def __init__(self, id, password, first_name=None, last_name=None, @@ -63,7 +60,6 @@ class ExtendedUser(User): class ExtendedUserService(UserService): - """Example class ExtendedUserService.""" def get_by_id(self, id): diff --git a/examples/providers/singleton.py b/examples/providers/singleton.py index 0697e218..963d6c14 100644 --- a/examples/providers/singleton.py +++ b/examples/providers/singleton.py @@ -4,7 +4,6 @@ import dependency_injector as di class UserService(object): - """Example class UserService.""" # Singleton provider creates new instance of specified class on first call and diff --git a/examples/providers/singleton_reseting.py b/examples/providers/singleton_reseting.py index 8495dd6c..cdc9e078 100644 --- a/examples/providers/singleton_reseting.py +++ b/examples/providers/singleton_reseting.py @@ -4,7 +4,6 @@ import dependency_injector as di class UserService(object): - """Example class UserService.""" # Users service singleton provider: diff --git a/tests/test_catalog.py b/tests/test_catalog.py index f1829222..fd3946f1 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -5,25 +5,21 @@ import dependency_injector as di class CatalogsInheritanceTests(unittest.TestCase): - """Catalogs inheritance tests.""" class CatalogA(di.AbstractCatalog): - """Test catalog A.""" p11 = di.Provider() p12 = di.Provider() class CatalogB(CatalogA): - """Test catalog B.""" p21 = di.Provider() p22 = di.Provider() class CatalogC(CatalogB): - """Test catalog C.""" p31 = di.Provider() @@ -73,11 +69,9 @@ class CatalogsInheritanceTests(unittest.TestCase): class CatalogTests(unittest.TestCase): - """Catalog test cases.""" class Catalog(di.AbstractCatalog): - """Test catalog.""" obj = di.Object(object()) @@ -100,11 +94,9 @@ class CatalogTests(unittest.TestCase): class OverrideTests(unittest.TestCase): - """Override decorator test cases.""" class Catalog(di.AbstractCatalog): - """Test catalog.""" obj = di.Object(object()) @@ -114,7 +106,6 @@ class OverrideTests(unittest.TestCase): """Test catalog overriding with another catalog.""" @di.override(self.Catalog) class OverridingCatalog(self.Catalog): - """Overriding catalog.""" obj = di.Value(1) diff --git a/tests/test_injections.py b/tests/test_injections.py index a3bb0903..f84ad280 100644 --- a/tests/test_injections.py +++ b/tests/test_injections.py @@ -5,7 +5,6 @@ import dependency_injector as di class InjectionTests(unittest.TestCase): - """Injection test cases.""" def test_init(self): @@ -26,7 +25,6 @@ class InjectionTests(unittest.TestCase): class KwArgTests(unittest.TestCase): - """Keyword arg injection test cases.""" def test_init(self): @@ -37,7 +35,6 @@ class KwArgTests(unittest.TestCase): class AttributeTests(unittest.TestCase): - """Attribute injection test cases.""" def test_init(self): @@ -48,7 +45,6 @@ class AttributeTests(unittest.TestCase): class MethodTests(unittest.TestCase): - """Method injection test cases.""" def test_init(self): @@ -59,7 +55,6 @@ class MethodTests(unittest.TestCase): class InjectTests(unittest.TestCase): - """Inject decorator test cases.""" def test_decorated(self): @@ -155,7 +150,6 @@ class InjectTests(unittest.TestCase): def test_decorate_class_method(self): """Test `inject()` decorator with class method.""" class Test(object): - """Test class.""" @di.inject(arg1=123) @@ -175,7 +169,6 @@ class InjectTests(unittest.TestCase): @di.inject(arg1=123) @di.inject(arg2=456) class Test(object): - """Test class.""" def __init__(self, arg1, arg2): @@ -193,5 +186,4 @@ class InjectTests(unittest.TestCase): with self.assertRaises(di.Error): @di.inject(arg1=123) class Test(object): - """Test class.""" diff --git a/tests/test_providers.py b/tests/test_providers.py index 1c0dd80e..35ced2f9 100644 --- a/tests/test_providers.py +++ b/tests/test_providers.py @@ -5,7 +5,6 @@ import dependency_injector as di class ProviderTests(unittest.TestCase): - """Provider test cases.""" def setUp(self): @@ -106,7 +105,6 @@ class ProviderTests(unittest.TestCase): class DelegateTests(unittest.TestCase): - """Delegate test cases.""" def setUp(self): @@ -132,11 +130,9 @@ class DelegateTests(unittest.TestCase): class FactoryTests(unittest.TestCase): - """Factory test cases.""" class Example(object): - """Example class for Factory provider tests.""" def __init__(self, init_arg1=None, init_arg2=None): @@ -317,7 +313,6 @@ class FactoryTests(unittest.TestCase): class SingletonTests(unittest.TestCase): - """Singleton test cases.""" def test_call(self): @@ -347,7 +342,6 @@ class SingletonTests(unittest.TestCase): class ExternalDependencyTests(unittest.TestCase): - """ExternalDependency test cases.""" def setUp(self): @@ -378,7 +372,6 @@ class ExternalDependencyTests(unittest.TestCase): class StaticProvidersTests(unittest.TestCase): - """Static providers test cases.""" def test_is_provider(self): @@ -433,7 +426,6 @@ class StaticProvidersTests(unittest.TestCase): class CallableTests(unittest.TestCase): - """Callable test cases.""" def example(self, arg1, arg2, arg3): @@ -485,7 +477,6 @@ class CallableTests(unittest.TestCase): class ConfigTests(unittest.TestCase): - """Config test cases.""" def setUp(self): diff --git a/tox.ini b/tox.ini index cd3004ca..eb231416 100644 --- a/tox.ini +++ b/tox.ini @@ -48,6 +48,7 @@ deps= pep257 commands= pep257 dependency_injector/ + pep257 examples/ [testenv:py26] basepython=python2.6