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

Add fix for commas appearing within keyword arg str #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timlod
Copy link

@timlod timlod commented Nov 30, 2021

It's possible for string keyword arguments to contain defaults that have commas, for example:

def fun(a: str = ",")
    pass

Currently, this would create an extra argument because of the comma within the string.
This commit adds a bypass for commas single- or double-quoted strings within keyword arguments much the same way that it ignores commas within the square brackets of type hints.

Example input + call:

(let ((s "(a: str = ',', b: int = 1)"))
  (sphinx-doc-split-args s))

Output previous:

("(a: str = '" "'" " b: int = 1)")

Output new:

("(a: str = ','" " b: int = 1)")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant