Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CLI application (movie lister) tutorial
- Loading branch information
Showing
6 changed files
with
46 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,26 @@ | ||
"""Main module.""" | ||
|
||
import sys | ||
|
||
from dependency_injector.wiring import inject, Provide | ||
from dependency_injector.wiring import Provide, inject | ||
|
||
from .listers import MovieLister | ||
from .containers import Container | ||
|
||
|
||
@inject | ||
def main(lister: MovieLister = Provide[Container.lister]) -> None: | ||
print('Francis Lawrence movies:') | ||
for movie in lister.movies_directed_by('Francis Lawrence'): | ||
print('\t-', movie) | ||
print("Francis Lawrence movies:") | ||
for movie in lister.movies_directed_by("Francis Lawrence"): | ||
print("\t-", movie) | ||
|
||
print('2016 movies:') | ||
print("2016 movies:") | ||
for movie in lister.movies_released_in(2016): | ||
print('\t-', movie) | ||
print("\t-", movie) | ||
|
||
|
||
if __name__ == '__main__': | ||
if __name__ == "__main__": | ||
container = Container() | ||
container.config.from_yaml('config.yml') | ||
container.config.finder.type.from_env('MOVIE_FINDER_TYPE') | ||
container.wire(modules=[sys.modules[__name__]]) | ||
container.config.from_yaml("config.yml") | ||
container.config.finder.type.from_env("MOVIE_FINDER_TYPE") | ||
container.wire(modules=[__name__]) | ||
|
||
main() |
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