mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-07 21:50:25 +00:00
langchain[patch]: set maxsplit when parse python function docstring (#14121)
Description when the desc of arg in python docstring contains ":", the `_parse_python_function_docstring` will raise **ValueError: too many values to unpack (expected 2)**. A sample desc would be: """ Args: error_arg: this is an arg with an additional ":" symbol """ So, set `maxsplit` parameter to fix it.
This commit is contained in:
parent
ae646701c4
commit
371bcb7580
@ -75,7 +75,7 @@ def _parse_python_function_docstring(function: Callable) -> Tuple[str, dict]:
|
|||||||
arg = None
|
arg = None
|
||||||
for line in args_block.split("\n")[1:]:
|
for line in args_block.split("\n")[1:]:
|
||||||
if ":" in line:
|
if ":" in line:
|
||||||
arg, desc = line.split(":")
|
arg, desc = line.split(":", maxsplit=1)
|
||||||
arg_descriptions[arg.strip()] = desc.strip()
|
arg_descriptions[arg.strip()] = desc.strip()
|
||||||
elif arg:
|
elif arg:
|
||||||
arg_descriptions[arg.strip()] += " " + line.strip()
|
arg_descriptions[arg.strip()] += " " + line.strip()
|
||||||
|
Loading…
Reference in New Issue
Block a user