mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-21 13:04:18 +02:00
perf: optimize string operations in OpenAPI parameter processing (#1342)
This commit is contained in:
parent
85d04a2880
commit
5ee159a4b3
1 changed files with 3 additions and 7 deletions
|
|
@ -82,13 +82,9 @@ def format_array_parameter(
|
|||
return values
|
||||
else:
|
||||
# For path parameters, fallback to string representation without Python syntax
|
||||
str_value = (
|
||||
str(values)
|
||||
.replace("[", "")
|
||||
.replace("]", "")
|
||||
.replace("'", "")
|
||||
.replace('"', "")
|
||||
)
|
||||
# Use str.translate() for efficient character removal
|
||||
translation_table = str.maketrans("", "", "[]'\"")
|
||||
str_value = str(values).translate(translation_table)
|
||||
return str_value
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue