Skip to content

Commit f6eae2d

Browse files
committed
f-strings.
1 parent 8c9886c commit f6eae2d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

demo/movie_svc/views/api_views.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@api.route("/api/search/{keyword}")
1010
def search_keyword(req, resp, keyword: str):
1111
movies = db.search_keyword(keyword)
12-
print("Searching for {}, {} results".format(keyword, len(movies)))
12+
print(f"Searching for {keyword}, {len(movies)} results")
1313

1414
limited = len(movies) > response_count_max
1515
if limited:
@@ -26,7 +26,7 @@ def search_keyword(req, resp, keyword: str):
2626
@api.route("/api/director/{director_name}")
2727
def search_director(_, resp, director_name: str):
2828
movies = db.search_director(director_name)
29-
print("Searching for director {}, {} results".format(director_name, len(movies)))
29+
print(f"Searching for director {director_name}, {len(movies)} results")
3030

3131
limited = len(movies) > response_count_max
3232
if limited:
@@ -43,7 +43,7 @@ def search_director(_, resp, director_name: str):
4343
@api.route("/api/movie/genre/{genre}")
4444
def movies_by_genre(_, resp: Response, genre: str):
4545
hits = db.movies_by_genre(genre)
46-
print("Searching for movies by genre {}, {} results".format(genre, len(hits)))
46+
print(f"Searching for movies by genre {genre}, {len(hits)} results")
4747

4848
limited = len(hits) > response_count_max
4949
if limited:
@@ -60,7 +60,7 @@ def movies_by_genre(_, resp: Response, genre: str):
6060
@api.route("/api/movie/{imdb_number}")
6161
def search_imdb(_, resp, imdb_number: str):
6262
movie = db.find_by_imdb(imdb_number)
63-
print("Looking up movie by code: {}, found? {}".format(imdb_number, 'Yes' if movie else 'NO'))
63+
print(f"Looking up movie by code: {imdb_number}, found? {'Yes' if movie else 'NO'}")
6464

6565
resp.media = db.movie_to_dict(movie)
6666

@@ -78,7 +78,7 @@ def top_movies(_, resp: Response):
7878
for m in hits
7979
]
8080

81-
keyword = "top_{}".format(response_count_max)
81+
keyword = f"top_{response_count_max}"
8282

8383
resp.media = {'keyword': keyword, 'hits': hits_dicts, 'truncated_results': limited}
8484

0 commit comments

Comments
 (0)