diff --git a/examples/miniapps/movie_lister/_create_db.py b/examples/miniapps/movie_lister/_create_db.py index 7d16a336..5482afdc 100644 --- a/examples/miniapps/movie_lister/_create_db.py +++ b/examples/miniapps/movie_lister/_create_db.py @@ -1,4 +1,4 @@ -"""Small script for initializing movies data.""" +"""Script for initializing movie databases.""" import os import csv diff --git a/examples/miniapps/movie_lister/app_csv.py b/examples/miniapps/movie_lister/app_csv.py index a3ff0826..f56dec68 100644 --- a/examples/miniapps/movie_lister/app_csv.py +++ b/examples/miniapps/movie_lister/app_csv.py @@ -1,4 +1,4 @@ -"""A naive example of dependency injection in Python. +"""A naive example of dependency injection on Python. Example implementation of dependency injection in Python from Martin Fowler's article about dependency injection and inversion of control: diff --git a/examples/miniapps/movie_lister/app_db.py b/examples/miniapps/movie_lister/app_db.py index cdcd47c4..f9e614fc 100644 --- a/examples/miniapps/movie_lister/app_db.py +++ b/examples/miniapps/movie_lister/app_db.py @@ -1,4 +1,4 @@ -"""A naive example of dependency injection in Python. +"""A naive example of dependency injection on Python. Example implementation of dependency injection in Python from Martin Fowler's article about dependency injection and inversion of control: diff --git a/examples/miniapps/movie_lister/apps_db_csv.py b/examples/miniapps/movie_lister/app_db_csv.py similarity index 74% rename from examples/miniapps/movie_lister/apps_db_csv.py rename to examples/miniapps/movie_lister/app_db_csv.py index e6de7745..3608b97e 100644 --- a/examples/miniapps/movie_lister/apps_db_csv.py +++ b/examples/miniapps/movie_lister/app_db_csv.py @@ -1,4 +1,4 @@ -"""A naive example of dependency injection in Python. +"""A naive example of dependency injection on Python. Example implementation of dependency injection in Python from Martin Fowler's article about dependency injection and inversion of control: @@ -6,7 +6,7 @@ article about dependency injection and inversion of control: http://www.martinfowler.com/articles/injection.html This mini application uses ``movies`` library, that is configured to work with -csv file movies database. +sqlite movies database and csv file movies database. """ import sqlite3 @@ -55,21 +55,17 @@ def main(db_movie_lister, csv_movie_lister): This program prints info about all movies that were directed by different persons and then prints all movies that were released in 2015. - :param db_movie_lister: Database movie lister instance + :param db_movie_lister: Movie lister, configured to work with database :type db_movie_lister: movies.listers.MovieLister - :param csv_movie_lister: Database movie lister instance + :param csv_movie_lister: Movie lister, configured to work with csv file :type csv_movie_lister: movies.listers.MovieLister """ - print db_movie_lister.movies_directed_by('Francis Lawrence') - print db_movie_lister.movies_directed_by('Patricia Riggen') - print db_movie_lister.movies_directed_by('JJ Abrams') - print db_movie_lister.movies_released_in(2015) - - print csv_movie_lister.movies_directed_by('Francis Lawrence') - print csv_movie_lister.movies_directed_by('Patricia Riggen') - print csv_movie_lister.movies_directed_by('JJ Abrams') - print csv_movie_lister.movies_released_in(2015) + for movie_lister in (db_movie_lister, csv_movie_lister): + print movie_lister.movies_directed_by('Francis Lawrence') + print movie_lister.movies_directed_by('Patricia Riggen') + print movie_lister.movies_directed_by('JJ Abrams') + print movie_lister.movies_released_in(2015) if __name__ == '__main__': diff --git a/examples/miniapps/movie_lister/movies/finders.py b/examples/miniapps/movie_lister/movies/finders.py index 37cfb48d..9d3cbc27 100644 --- a/examples/miniapps/movie_lister/movies/finders.py +++ b/examples/miniapps/movie_lister/movies/finders.py @@ -17,7 +17,7 @@ class MovieFinder(object): """Initializer. :param movie_model: Movie model's factory - :type movie_model: (object) -> movies.models.Movie + :type movie_model: movies.models.Movie """ self._movie_model = movie_model @@ -37,7 +37,7 @@ class CsvMovieFinder(MovieFinder): """Initializer. :param movie_model: Movie model's factory - :type movie_model: (object) -> movies.models.Movie + :type movie_model: movies.models.Movie :param csv_file: Path to csv file with movies data :type csv_file: str