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

Literal types produce incorrect docstring #212

Closed
dhalenok opened this issue Jan 13, 2022 · 0 comments · Fixed by #223
Closed

Literal types produce incorrect docstring #212

dhalenok opened this issue Jan 13, 2022 · 0 comments · Fixed by #223
Labels

Comments

@dhalenok
Copy link

Describe the bug
Argument which type is defined with typing.Literal produces incorrect docstring.

Versions (please complete the following information):

  • autoDocstring Version: v0.5.4
  • Operating System: macOS 12.0.1
  • Vscode Version: 1.63.2

Original Code (with line to generate on):

from typing import Literal

def foo(bar: Literal["baz"]) -> None:
# generate on this line
    pass

Expected Result:

from typing import Literal


def foo(bar: Literal["baz"]) -> None:
    """[summary]

    Args:
        bar (Literal["baz"]): [description]
    """
    pass

Actual Result:

from typing import Literal


def foo(bar: Literal["baz"]) -> None:
    """[summary]

    Args:
        bar (Literal[): [description]
    """
    pass
@dhalenok dhalenok added the bug label Jan 13, 2022
NilsJPWerner added a commit that referenced this issue Feb 16, 2022
* master: (29 commits)
  Merge publish and test workflows
  Handle nested square brackets in type hints (#185)
  Improve changelog format and add publish release action
  Only run publish workflow after successful test workflow
  Bump version to 0.6.1
  Remove one-line-sphinx-notypes and update changelog
  Add example documentation of docstring formats (#224)
  Rename oneline-rst to one-line-sphinx
  Bump version to 0.6.0
  Fixes #212: Parse Literal type hints in function definition (#223)
  Add debug log statements
  Update all dependencies (#222)
  Add more notypes docstring templates (#221)
  Fixes #94: Switch square brackets in placeholder to underscores (#220)
  Avoid extra newlines in templates (#203)
  Add oneline-rst docstring to menu and readme so its accessible (#195)
  Add PEP 604 style type hint support (#218)
  Fix yield underline in numpy template (#216)
  Update READEME
  Switch to github actions (#214)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant