Skip to content

Commit 569fd13

Browse files
authored
Merge pull request #242 from realpython/weather-app-final-qa
Weather App: Final QA updates
2 parents 807664c + 17795ce commit 569fd13

File tree

7 files changed

+12
-18
lines changed

7 files changed

+12
-18
lines changed

weather-app/source_code_final/style.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import sys
2-
3-
41
PADDING = 20
52

63
RED = "\033[1;31m"
@@ -15,4 +12,4 @@
1512

1613

1714
def change_color(color):
18-
sys.stdout.write(color)
15+
print(color, end="")

weather-app/source_code_final/weather.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def read_user_cli_args():
2929
description="gets weather and temperature information for a city"
3030
)
3131
parser.add_argument(
32-
"City", metavar="city", nargs="+", type=str, help="enter the city name"
32+
"city", nargs="+", type=str, help="enter the city name"
3333
)
3434
parser.add_argument(
3535
"-i",
@@ -162,6 +162,6 @@ def _select_weather_display_params(weather_id):
162162

163163
if __name__ == "__main__":
164164
user_args = read_user_cli_args()
165-
query_url = build_weather_query(user_args.City, user_args.imperial)
165+
query_url = build_weather_query(user_args.city, user_args.imperial)
166166
weather_data = get_weather_data(query_url)
167167
display_weather_info(weather_data, user_args.imperial)

weather-app/source_code_step_3/weather.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def read_user_cli_args():
1212
description="gets weather and temperature information for a city"
1313
)
1414
parser.add_argument(
15-
"City", metavar="city", nargs="+", type=str, help="enter the city name"
15+
"city", nargs="+", type=str, help="enter the city name"
1616
)
1717
parser.add_argument(
1818
"-i",
@@ -38,4 +38,4 @@ def _get_api_key():
3838

3939
if __name__ == "__main__":
4040
user_args = read_user_cli_args()
41-
print(user_args.City, user_args.imperial)
41+
print(user_args.city, user_args.imperial)

weather-app/source_code_step_4/weather.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def read_user_cli_args():
1717
description="gets weather and temperature information for a city"
1818
)
1919
parser.add_argument(
20-
"City", metavar="city", nargs="+", type=str, help="enter the city name"
20+
"city", nargs="+", type=str, help="enter the city name"
2121
)
2222
parser.add_argument(
2323
"-i",
@@ -91,6 +91,6 @@ def get_weather_data(query_url):
9191

9292
if __name__ == "__main__":
9393
user_args = read_user_cli_args()
94-
query_url = build_weather_query(user_args.City, user_args.imperial)
94+
query_url = build_weather_query(user_args.city, user_args.imperial)
9595
weather_data = get_weather_data(query_url)
9696
print(weather_data)

weather-app/source_code_step_5/weather.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def read_user_cli_args():
1818
description="gets weather and temperature information for a city"
1919
)
2020
parser.add_argument(
21-
"City", metavar="city", nargs="+", type=str, help="enter the city name"
21+
"city", nargs="+", type=str, help="enter the city name"
2222
)
2323
parser.add_argument(
2424
"-i",
@@ -113,6 +113,6 @@ def display_weather_info(weather_data, imperial=False):
113113

114114
if __name__ == "__main__":
115115
user_args = read_user_cli_args()
116-
query_url = build_weather_query(user_args.City, user_args.imperial)
116+
query_url = build_weather_query(user_args.city, user_args.imperial)
117117
weather_data = get_weather_data(query_url)
118118
display_weather_info(weather_data, user_args.imperial)

weather-app/source_code_step_6/style.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import sys
2-
3-
41
PADDING = 20
52

63
RED = "\033[1;31m"
@@ -15,4 +12,4 @@
1512

1613

1714
def change_color(color):
18-
sys.stdout.write(color)
15+
print(color, end="")

weather-app/source_code_step_6/weather.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def read_user_cli_args():
2929
description="gets weather and temperature information for a city"
3030
)
3131
parser.add_argument(
32-
"City", metavar="city", nargs="+", type=str, help="enter the city name"
32+
"city", nargs="+", type=str, help="enter the city name"
3333
)
3434
parser.add_argument(
3535
"-i",
@@ -162,6 +162,6 @@ def _select_weather_display_params(weather_id):
162162

163163
if __name__ == "__main__":
164164
user_args = read_user_cli_args()
165-
query_url = build_weather_query(user_args.City, user_args.imperial)
165+
query_url = build_weather_query(user_args.city, user_args.imperial)
166166
weather_data = get_weather_data(query_url)
167167
display_weather_info(weather_data, user_args.imperial)

0 commit comments

Comments
 (0)