If a method (of a class) returns a value, then the else part in the following lines from docstring.py:
|
if class_name is None: |
|
params_section = re.findall( |
|
r"(?<=Parameters)(.*)(?=Returns)", docstring, re.DOTALL |
|
)[0] |
|
else: |
|
params_section = re.findall(r"(?<=Parameters)(.*)", docstring, re.DOTALL)[0] |
|
|
|
args = re.findall(r"(\w+)\s+\:", params_section) |
captures that output variable name from its docstring and includes it in the args. This issue was initially exposed when a class with method __call__ was added in PR #1118. One suggestion provided in this comment was:
Given that this is an extreme case, it almost feels like it merits its on elif condition that specifically handles the specific _call_ case?
I think the real question we should ask ourselves is: "Should we treat methods like regular functions, meaning they can return value?
I understand that all methods of all classes in STUMPY main branch currently return nothing ("None"). However, I think it is not unreasonable to assume that, in future, a class might be added that has a method that returns a value. So, maybe we should revise the else part in the code above ??
If a method (of a class) returns a value, then the
elsepart in the following lines from docstring.py:stumpy/docstring.py
Lines 26 to 33 in ce05903
captures that output variable name from its docstring and includes it in the
args. This issue was initially exposed when a class with method__call__was added in PR #1118. One suggestion provided in this comment was:I think the real question we should ask ourselves is: "Should we treat methods like regular functions, meaning they can return value?
I understand that all methods of all classes in STUMPY
mainbranch currently return nothing ("None"). However, I think it is not unreasonable to assume that, in future, a class might be added that has a method that returns a value. So, maybe we should revise theelsepart in the code above ??