File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ def load_route_manifest(
3434def find_unique_index (
3535 pattern : str ,
3636 candidates : list [str ],
37+ partial : bool = True , # Allows partial matches
3738) -> int :
3839 """
3940 Finds the index of a unique entry in a list.
@@ -42,7 +43,7 @@ def find_unique_index(
4243 matches = []
4344 index = 0
4445 for i , candidate in enumerate (candidates ):
45- if pattern in candidate :
46+ if ( partial and pattern in candidate ) or ( not partial and pattern == candidate ) :
4647 counter += 1
4748 matches .append (candidate )
4849 index = i
@@ -93,12 +94,12 @@ def url_path_for(
9394 # Load the routes in the desired router
9495 routers = list (route_manifest .keys ())
9596 routes : list [dict [str , Any ]] = route_manifest [
96- routers [find_unique_index (router_name , routers )]
97+ routers [find_unique_index (router_name , routers , partial = True )]
9798 ]
9899
99100 # Search router for the function
100101 route_info = routes [
101- find_unique_index (function_name , [r ["function" ] for r in routes ])
102+ find_unique_index (function_name , [r ["function" ] for r in routes ], partial = False )
102103 ]
103104
104105 # Unpack the dictionary
You can’t perform that action at this time.
0 commit comments