Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behaviour when defining conditional value for the function argument #286

Open
lnxpy opened this issue Jun 8, 2024 · 0 comments
Open
Labels

Comments

@lnxpy
Copy link

lnxpy commented Jun 8, 2024

Describe the bug
When you set a conditional value for the function argument, the default value shown in the doc is weirdly formatted!

Versions (please complete the following information):

  • autoDocstring Version: v0.6.1
  • Operating System: MacOS Sonoma 14.4.1
  • Vscode Version: 1.90.0

Issue:

def greeting(name: str = "John" if is_administrator else "Jamy") -> None:
    ...

After numpy doc generation:

def greeting(name: str = "John" if is_administrator else "Jamy") -> None:
    """_summary_

    Args:
        name (str, optional): _description_. Defaults to "John"ifis_administratorelse"Jamy".
    """                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...

Apparently, the rest of the string after the = symbol is considered as the default value for the parameter which is not true in some cases.

@lnxpy lnxpy added the bug label Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant