Skip to content

Commit 7d34ed5

Browse files
committed
Updated logs and parameter names in 'murfey.util.api'
1 parent 69afc1d commit 7d34ed5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/murfey/util/api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def load_route_manifest(
3434
def find_unique_index(
3535
pattern: str,
3636
candidates: list[str],
37-
partial: bool = True, # Allows partial matches
37+
exact: bool = False, # Allows partial matches
3838
) -> int:
3939
"""
4040
Finds the index of a unique entry in a list.
@@ -43,7 +43,7 @@ def find_unique_index(
4343
matches = []
4444
index = 0
4545
for i, candidate in enumerate(candidates):
46-
if (partial and pattern in candidate) or (not partial and pattern == candidate):
46+
if (not exact and pattern in candidate) or (exact and pattern == candidate):
4747
counter += 1
4848
matches.append(candidate)
4949
index = i
@@ -97,12 +97,12 @@ def url_path_for(
9797
# Load the routes in the desired router
9898
routers = list(route_manifest.keys())
9999
routes: list[dict[str, Any]] = route_manifest[
100-
routers[find_unique_index(router_name, routers, partial=True)]
100+
routers[find_unique_index(router_name, routers, exact=False)]
101101
]
102102

103103
# Search router for the function
104104
route_info = routes[
105-
find_unique_index(function_name, [r["function"] for r in routes], partial=False)
105+
find_unique_index(function_name, [r["function"] for r in routes], exact=True)
106106
]
107107

108108
# Unpack the dictionary
@@ -116,7 +116,7 @@ def url_path_for(
116116
param_type = path_param["type"]
117117
if param_name not in kwargs.keys():
118118
message = (
119-
f"Error validating parameters for {function_name}; "
119+
f"Error validating parameters for {function_name!r}; "
120120
f"path parameter {param_name!r} was not provided"
121121
)
122122
logger.error(message)
@@ -126,7 +126,7 @@ def url_path_for(
126126
continue
127127
elif type(kwargs[param_name]).__name__ not in param_type:
128128
message = (
129-
f"Error validating parameters for {function_name}; "
129+
f"Error validating parameters for {function_name!r}; "
130130
f"{param_name!r} must be {param_type!r}, "
131131
f"received {type(kwargs[param_name]).__name__!r}"
132132
)

0 commit comments

Comments
 (0)