mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[1/3] Recognize .py.in
and .pyi.in
files as Python in VS Code (#95200)
Changes: - => this PR: #95200 1. Recognize `.py.in` and `.pyi.in` files as Python in VS Code for a better development experience. 2. Fix deep setting merge in `tools/vscode_settings.py`. - #95267 3. Use `Namedtuple` rather than `namedtuple + __annotations__` for `torch.nn.utils.rnn.PackedSequence_`: `namedtuple + __annotations__`: ```python PackedSequence_ = namedtuple('PackedSequence_', ['data', 'batch_sizes', 'sorted_indices', 'unsorted_indices']) # type annotation for PackedSequence_ to make it compatible with TorchScript PackedSequence_.__annotations__ = {'data': torch.Tensor, 'batch_sizes': torch.Tensor, 'sorted_indices': Optional[torch.Tensor], 'unsorted_indices': Optional[torch.Tensor]} ``` `Namedtuple`: Python 3.6+ ```python class PackedSequence_(NamedTuple): data: torch.Tensor batch_sizes: torch.Tensor sorted_indices: Optional[torch.Tensor] unsorted_indices: Optional[torch.Tensor] ``` - #95268 4. Sort import statements and remove unnecessary imports in `.pyi`, `.pyi.in` files. 5. Format `.pyi`, `.pyi.in` files and remove unnecessary ellipsis `...` in type stubs. Pull Request resolved: https://github.com/pytorch/pytorch/pull/95200 Approved by: https://github.com/janeyx99
This commit is contained in:
committed by
PyTorch MergeBot
parent
e096bca5f9
commit
a46e550d06
24
.vscode/settings_recommended.json
vendored
24
.vscode/settings_recommended.json
vendored
@ -1,12 +1,16 @@
|
||||
{
|
||||
"[python]": {
|
||||
"editor.tabSize": 4
|
||||
},
|
||||
"files.eol": "\n",
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"python.formatting.provider": "none",
|
||||
"python.linting.enabled": true,
|
||||
"python.linting.flake8Enabled": true
|
||||
"[python]": {
|
||||
"editor.tabSize": 4
|
||||
},
|
||||
"files.associations": {
|
||||
"*.py.in": "python",
|
||||
"*.pyi.in": "python"
|
||||
},
|
||||
"files.eol": "\n",
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"python.formatting.provider": "none",
|
||||
"python.linting.enabled": true,
|
||||
"python.linting.flake8Enabled": true
|
||||
}
|
||||
|
Reference in New Issue
Block a user