Skip to content

Commit 55e71d8

Browse files
committed
Updated function documentation
1 parent 6629a12 commit 55e71d8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/murfey/util/api.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def find_unique_index(
3333
candidates: list[str],
3434
) -> int:
3535
"""
36-
Finds the index of a unique entry in a list
36+
Finds the index of a unique entry in a list.
3737
"""
3838
counter = 0
3939
matches = []
@@ -52,8 +52,8 @@ def find_unique_index(
5252

5353
def render_path(path_template: str, kwargs: dict) -> str:
5454
"""
55-
Replace all FastAPI-style {param[:converter]} path parameters
56-
with corresponding values from kwargs.
55+
Replace all FastAPI-style {param[:converter]} path parameters with corresponding
56+
values from kwargs.
5757
"""
5858

5959
pattern = re.compile(r"{([^}]+)}") # Look for all path params
@@ -73,6 +73,11 @@ def url_path_for(
7373
function_name: str, # With logic for partial matches
7474
**kwargs, # Takes any path param and matches it against curly bracket contents
7575
):
76+
"""
77+
Utility function that takes the function name and API router name, along with all
78+
necessary path parameters, retrieves the matching URL path template from the route
79+
manifest, and returns a correctly populated instance of the URL path.
80+
"""
7681
# Use 'Any' first and slowly reveal types as it is unpacked
7782
route_manifest: dict[str, list[Any]] = load_route_manifest()
7883

0 commit comments

Comments
 (0)