Skip to content

Conversation

lennart-bader
Copy link

This commit modifies the _extract_signature_elements method in the DocString class to support nested type hints, e.g., as required when using typing.Callable.

Previously, this resulted in an Exception:
Exception: unexpected nested element after [ while reading param

Example method signature that causes the issue:

def method(self, callback: Callable[[str], None]):
    pass

Instead of tracking a single token (i.e., the [ in this case), the method now uses a stack to track nested tokens.

This pull request addresses #120

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