Fix flake8 E305 error

This commit is contained in:
Roman Mogilatov 2016-11-15 14:26:40 +02:00
parent 9727b4924e
commit 2072567242
4 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,7 @@ class Container(containers.DeclarativeContainer):
factory2 = providers.Factory(object)
# Creating some objects:
object1 = Container.factory1()
object2 = Container.factory2()

View File

@ -71,6 +71,7 @@ class CsvApplication(containers.DeclarativeContainer):
csv_file_path=settings.MOVIES_CSV_PATH,
delimiter=',')
if __name__ == '__main__':
DbApplication.init_db()
DbApplication.main()

View File

@ -6,6 +6,7 @@ import dependency_injector.providers as providers
class User(object):
"""Example class User."""
# Users factory:
users_factory = providers.Factory(User)
@ -22,6 +23,7 @@ assert isinstance(user1, User) and isinstance(user2, User)
class SuperUser(User):
"""Example class SuperUser."""
# Overriding users factory:
users_factory.override(providers.Factory(SuperUser))

View File

@ -25,6 +25,7 @@ class UsersService(object):
"""Find user by his id and return user model."""
return self.user_cls(id=id, password='secret' + str(id))
# Users factory and UsersService provider:
users_service = providers.Factory(UsersService, user_cls=User)
@ -69,6 +70,7 @@ class ExtendedUsersService(UsersService):
user.gender = 'male'
return user
# Overriding users_service provider:
extended_users_service = providers.Factory(ExtendedUsersService,
user_cls=ExtendedUser)