Add __all__ to torch/_C/_VariableFunctions.pyi #40499
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #40397
Summary
Inspired by ezyang's comment at #40397 (comment), this PR attempts to leverage using
__all__to explicitly export private functions from_VariableFunctions.pyiin order to makemypyaware of them after:The generation of the
__all__template variable excludes some items fromunsorted_function_hints, as it seems that those without hints end up not being explicitly included in the.pyifile: I leaned on the side of caution and opted for having__all__consistent with the definitions inside the file. Additionally, added some pretty-printing to avoid having an extremely long line.