Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/4.19.0' into master
- Loading branch information
Showing
14 changed files
with
2,971 additions
and
2,681 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""`Singleton` provider full resetting example.""" | ||
|
||
from dependency_injector import containers, providers | ||
|
||
|
||
class Database: | ||
... | ||
|
||
|
||
class UserService: | ||
def __init__(self, db: Database): | ||
self.db = db | ||
|
||
|
||
class Container(containers.DeclarativeContainer): | ||
|
||
database = providers.Singleton(Database) | ||
|
||
user_service = providers.Singleton(UserService, db=database) | ||
|
||
|
||
if __name__ == '__main__': | ||
container = Container() | ||
|
||
user_service1 = container.user_service() | ||
|
||
container.user_service.full_reset() | ||
|
||
user_service2 = container.user_service() | ||
assert user_service2 is not user_service1 | ||
assert user_service2.db is not user_service1.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
"""Top-level package.""" | ||
|
||
__version__ = '4.18.0' | ||
__version__ = '4.19.0' | ||
"""Version number. | ||
:type: str | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.