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

[Python APIView] Support @overloads and fix issue with parameterized decorators #3044

Merged
merged 9 commits into from
Apr 11, 2022

Conversation

tjprescott
Copy link
Member

@tjprescott tjprescott commented Apr 1, 2022

Fixes Azure/azure-sdk-for-python#3028. This was a pretty simple bug in the logic to parse decorators.

Closes Azure/azure-sdk-for-python#3012, Azure/azure-sdk-for-python#3011, Azure/azure-sdk-for-python#3010. This was a much more involved fix because inspect cannot see overloads. Instead, I have to parse the source of the enclosing class and parse the decorators from the AST nodes, which is messy (and unfortunate!).

Here's the APIVIew for this. See "SomethingWithDecorators" and "SomethingWithOverloads":
https://apiviewstaging.azurewebsites.net/Assemblies/Review/b821d6b6f4c94d6a907be8773e8767ab

Note that the diagnostics will go away once Azure/azure-sdk-for-python#2933 is merged.

Test to verify this addresses recently reported issues:

@tjprescott tjprescott changed the base branch from main to api-stub-generator_v0.2.11 April 4, 2022 16:44
@check-enforcer-staging
Copy link

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

@tjprescott tjprescott changed the base branch from api-stub-generator_v0.2.11 to feature/api-stub-generator_v0.2.11 April 4, 2022 17:05
Copy link
Member

@mikeharder mikeharder left a comment

Choose a reason for hiding this comment

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

Is this PR supposed to targeting branch main or feature/api-stub-generator_v0.2.11?

@tjprescott
Copy link
Member Author

@mikeharder it's supposed to be targeting a feature branch until @praveenkuttappan tells me it's safe to target main.

@mikeharder
Copy link
Member

@tjprescott: It looks like this PR includes unrelated changes from main, in addition to your code changes. If we want to update the feature branch with the latest changes in main, I would do that in a separate commit (or PR) to the feature branch, so that this PR only contains your code changes.

@tjprescott tjprescott changed the base branch from feature/api-stub-generator_v0.2.11 to main April 7, 2022 20:52
@tjprescott tjprescott removed request for scbedd and qiaozha April 7, 2022 20:52
@tjprescott
Copy link
Member Author

@mikeharder I've retargeted it to main.

Copy link
Member

@mikeharder mikeharder left a comment

Choose a reason for hiding this comment

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

Thanks for targeting main, I can recuse myself from this PR now.

@mikeharder mikeharder self-requested a review April 7, 2022 21:18
@tjprescott tjprescott dismissed mikeharder’s stale review April 8, 2022 14:17

No longer targeting feature branch.

@tjprescott tjprescott removed the request for review from mikeharder April 8, 2022 14:18
@mikeharder mikeharder requested review from mikeharder and removed request for mikeharder April 8, 2022 18:38
@tjprescott tjprescott merged commit d2fef6b into main Apr 11, 2022
@tjprescott tjprescott deleted the python/Overloads branch April 11, 2022 19:28
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.

4 participants