autoDocstring icon indicating copy to clipboard operation
autoDocstring copied to clipboard

add support for unicode arguments [ENH]

Open nikhil003 opened this issue 2 years ago • 0 comments

Describe the bug I use the extension autoDocstring quite extensively in generating templates when documenting the functions and classes. When doing so, I have noticed that it doesn't handle unicode type in the function arguments. I believe this is because the parser in the regex are not unicode aware. When writing some functions to compute a mathematical expression, it is much concise to use the unicode greek symbol (e.g., α) than writing a more verbose term (e.g., alpha).

I think this could be a simple enhancement by making the regex match unicode aware.

Below, I have shown a simple example where the unicode argument is ignored by the parser but it doesn't throw any error.

Versions (please complete the following information):

  • autoDocstring Version: 0.6.1
  • Operating System: ubuntu 20.04
  • Vscode Version: 1.67.1

Original Code (with line to generate on):

# generate on this line
from scipy.optimize import OptiimizeResult

def shannon_entropy(res: OptimizeResult, n: int, ɛ: float = 0.0) -> float:
    pass

Expected Result:

image

Actual Result:

image

nikhil003 avatar May 12 '22 20:05 nikhil003