Skip to content

Commit f3cbd46

Browse files
authored
Updated docstrings in stub and exemplar to use Googel Style. (exercism#4161)
1 parent 1b30133 commit f3cbd46

2 files changed

Lines changed: 59 additions & 29 deletions

File tree

exercises/concept/locomotive-engineer/.meta/exemplar.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33

44
def get_list_of_wagons(*args):
5-
"""Return a list of wagons.
5+
"""Return a list of wagons, given an arbitrary amount of wagon numbers.
66
7-
:param *args: arbitrary number of wagons.
8-
:return: list - list of wagons.
7+
Parameters:
8+
*args: An arbitrary number of wagon numbers, unpacked.
9+
10+
Returns:
11+
list: A list of wagon numbers, assembled from *args..
912
"""
1013

1114
return list(args)
@@ -14,9 +17,12 @@ def get_list_of_wagons(*args):
1417
def fix_list_of_wagons(each_wagons_id, missing_wagons):
1518
"""Fix the list of wagons.
1619
17-
:param each_wagons_id: list - the list of wagons.
18-
:param missing_wagons: list - the list of missing wagons.
19-
:return: list - list of wagons.
20+
Parameters:
21+
each_wagons_id (list[int]): The list of wagons.
22+
missing_wagons (list[int]) The list of missing wagons.
23+
24+
Returns:
25+
list[int]: The corrected list of wagons.
2026
"""
2127

2228
first, second, locomotive, *rest = each_wagons_id
@@ -27,9 +33,12 @@ def fix_list_of_wagons(each_wagons_id, missing_wagons):
2733
def add_missing_stops(route, **kwargs):
2834
"""Add missing stops to route dict.
2935
30-
:param route: dict - the dict of routing information.
31-
:param **kwargs: arbitrary number of stops.
32-
:return: dict - updated route dictionary.
36+
Parameters:
37+
route (dict): The dict of routing information.
38+
**kwargs: arbitrary number of stops.
39+
40+
Returns:
41+
dict: The updated route dictionary.
3342
"""
3443

3544
return {**route, "stops": list(kwargs.values())}
@@ -38,9 +47,12 @@ def add_missing_stops(route, **kwargs):
3847
def extend_route_information(route, more_route_information):
3948
"""Extend route information with more_route_information.
4049
41-
:param route: dict - the route information.
42-
:param more_route_information: dict - extra route information.
43-
:return: dict - extended route information.
50+
Parameters:
51+
route (dict): The route information.
52+
more_route_information (dict): The extra route information.
53+
54+
Returns:
55+
dict: The extended route information.
4456
"""
4557

4658
return {**route, **more_route_information}
@@ -49,8 +61,11 @@ def extend_route_information(route, more_route_information):
4961
def fix_wagon_depot(wagons_rows):
5062
"""Fix the list of rows of wagons.
5163
52-
:param wagons_rows: list[tuple] - the list of rows of wagons.
53-
:return: list[tuple] - list of rows of wagons.
64+
Parameters:
65+
wagons_rows (list[tuple]) The list of rows of wagons.
66+
67+
Returns:
68+
list[tuple]: the list of rows of wagons.
5469
"""
5570

5671
[*row_one], [*row_two], [*row_three] = zip(*wagons_rows)

exercises/concept/locomotive-engineer/locomotive_engineer.py

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,63 @@
22

33

44
def get_list_of_wagons():
5-
"""Return a list of wagons.
5+
"""Return a list of wagons, given an arbitrary amount of wagon numbers.
66
7-
:param: arbitrary number of wagons.
8-
:return: list - list of wagons.
7+
Parameters:
8+
An arbitrary number of wagon numbers, unpacked.
9+
10+
Returns:
11+
list: A list of wagon numbers.
912
"""
1013
pass
1114

1215

1316
def fix_list_of_wagons(each_wagons_id, missing_wagons):
1417
"""Fix the list of wagons.
1518
16-
:param each_wagons_id: list - the list of wagons.
17-
:param missing_wagons: list - the list of missing wagons.
18-
:return: list - list of wagons.
19+
Parameters:
20+
each_wagons_id (list[int]): The list of wagons.
21+
missing_wagons (list[int]) The list of missing wagons.
22+
23+
Returns:
24+
list[int]: The corrected list of wagons.
1925
"""
2026
pass
2127

2228

23-
def add_missing_stops():
29+
def add_missing_stops(route):
2430
"""Add missing stops to route dict.
2531
26-
:param route: dict - the dict of routing information.
27-
:param: arbitrary number of stops.
28-
:return: dict - updated route dictionary.
32+
Parameters:
33+
route (dict): The dict of routing information.
34+
(dict): arbitrary number of stops.
35+
36+
Returns:
37+
dict: The updated route dictionary.
2938
"""
3039
pass
3140

3241

3342
def extend_route_information(route, more_route_information):
3443
"""Extend route information with more_route_information.
3544
36-
:param route: dict - the route information.
37-
:param more_route_information: dict - extra route information.
38-
:return: dict - extended route information.
45+
Parameters:
46+
route (dict): The route information.
47+
more_route_information (dict): The extra route information.
48+
49+
Returns:
50+
dict: The extended route information.
3951
"""
4052
pass
4153

4254

4355
def fix_wagon_depot(wagons_rows):
4456
"""Fix the list of rows of wagons.
4557
46-
:param wagons_rows: list[list[tuple]] - the list of rows of wagons.
47-
:return: list[list[tuple]] - list of rows of wagons.
58+
Parameters:
59+
wagons_rows (list[tuple]) The list of rows of wagons.
60+
61+
Returns:
62+
list[tuple]: the list of rows of wagons.
4863
"""
4964
pass

0 commit comments

Comments
 (0)