-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
102 additions
and
412 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
"""`Factory` providers example.""" | ||
|
||
import collections | ||
import dependency_injector.providers as providers | ||
|
||
|
||
class User(object): | ||
"""Example class User.""" | ||
User = collections.namedtuple('User', []) | ||
|
||
# Factory provider creates new instance of specified class on every call. | ||
users_factory = providers.Factory(User) | ||
|
||
# Creating several User objects: | ||
user1 = users_factory() | ||
user2 = users_factory() | ||
|
||
# Making some asserts: | ||
assert user1 is not user2 | ||
assert isinstance(user1, User) and isinstance(user2, User) | ||
user1 = users_factory() # Same as: user1 = User() | ||
user2 = users_factory() # Same as: user2 = User() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.