Skip to content

Commit

Permalink
allow class docstring
Browse files Browse the repository at this point in the history
Signed-off-by: chahatsagarmain <[email protected]>
  • Loading branch information
chahatsagarmain committed Jan 28, 2025
1 parent 2e5bcad commit 88a0e3d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sdk/python/kfp/cli/utils/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def get_param_descr(fn: Callable, param_name: str) -> str:
Returns:
str: The description of the parameter.
"""
docstring = fn.__doc__
if not isinstance(fn, type) and not callable(fn):
docstring = fn.__class__.__doc__
else:
docstring = fn.__doc__

if docstring is None:
raise ValueError(
Expand All @@ -43,10 +46,8 @@ def get_param_descr(fn: Callable, param_name: str) -> str:
raise ValueError(f'No Args section found in docstring of {fn}')

lines = lines[i + 1:]

# More lenient regex pattern
first_line_args_regex = rf'^\s*{param_name}\s*(?:\([^)]*\))?\s*:\s*'

first_already_found = False
return_lines = []
for line in lines:
Expand Down

0 comments on commit 88a0e3d

Please sign in to comment.