Skip to content

Can access per argument type comments #667

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

Merged
merged 1 commit into from
May 14, 2019
Merged

Can access per argument type comments #667

merged 1 commit into from
May 14, 2019

Conversation

AWhetter
Copy link
Contributor

@AWhetter AWhetter commented May 1, 2019

Description

Adds a new type_comment_args attribute to Arguments nodes so that per argument type comments can be accessed:

>>> import astroid
>>> func = astroid.extract_node('''
... def sum(
...         a,  # type: int
...         b,  # type: int
... ):
...     # type: (...) -> int
...     return a + b
... ''')
>>> func.args.type_comment_args
[<Name.int l.1 at 0x7ff60a46fd30>, <Name.int l.1 at 0x7ff60a46fda0>]

Type of Changes

Type
✨ New feature

Related Issue

Closes #665

Copy link
Contributor

@PCManticore PCManticore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, thanks @AWhetter !

@PCManticore PCManticore merged commit 7bb86ab into master May 14, 2019
@PCManticore PCManticore deleted the fix_665 branch May 14, 2019 09:56
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.

Expose multi-line function argument type annotation comments
2 participants