mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Fix flake8 E305 error
This commit is contained in:
parent
9727b4924e
commit
2072567242
|
@ -12,6 +12,7 @@ class Container(containers.DeclarativeContainer):
|
|||
|
||||
factory2 = providers.Factory(object)
|
||||
|
||||
|
||||
# Creating some objects:
|
||||
object1 = Container.factory1()
|
||||
object2 = Container.factory2()
|
||||
|
|
|
@ -71,6 +71,7 @@ class CsvApplication(containers.DeclarativeContainer):
|
|||
csv_file_path=settings.MOVIES_CSV_PATH,
|
||||
delimiter=',')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
DbApplication.init_db()
|
||||
DbApplication.main()
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user