stubgen: Allow aliases below the top level#14388
Conversation
6e2a9f7 to
42af1f1
Compare
|
@hauntsaninja do you mind giving this a review? |
42af1f1 to
8ca84eb
Compare
|
Anyone have a minute for this PR? |
hauntsaninja
left a comment
There was a problem hiding this comment.
Thanks, this looks reasonable.
Can we just make this the default and not have it be configurable? Could you also add some assignment statements inside methods in the test case to prove that they don't get included.
I was inclined to do that, but I don't know why it was specifically limited to module aliases in the first place. I can't see the scenario where that's preferable. I'm happy to delegate that decision to you or anyone else in the mypy crew.
sure. |
|
Let's make it the default |
8ca84eb to
274cbc1
Compare
|
I backed out the commit that added the cli arg, and added a function level alias to the test. waiting for CI tests to pass. |
|
ready to go! |
(Explain how this PR changes mypy.)
stubgen currently allows a variable to be an alias to another, but only at the module level.
For example:
produces:
At the class level, these aliased variables are marked as
Incomplete.In my experience, enabling aliases below the top level produces better stubs.
I'm not sure what the original reservations were around use of these aliases. If the concerns about class-level aliases are still valid, I can add an option to enable them.