With ufmt in place https://github.com/pytorch/pytorch/pull/81157, we can now use it to gradually format all files. I'm breaking this down into multiple smaller batches to avoid too many merge conflicts later on.
This batch (as copied from the current BLACK linter config):
* `tools/**/*.py`
Upcoming batchs:
* `torchgen/**/*.py`
* `torch/package/**/*.py`
* `torch/onnx/**/*.py`
* `torch/_refs/**/*.py`
* `torch/_prims/**/*.py`
* `torch/_meta_registrations.py`
* `torch/_decomp/**/*.py`
* `test/onnx/**/*.py`
Once they are all formatted, BLACK linter will be removed.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81285
Approved by: https://github.com/suo
Summary:
`tempfile.TemporaryDirectory` is a generic only in python-3.9 and above
Workaround by wrapping type annotation in quotes
Fixes https://github.com/pytorch/pytorch/issues/64017
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64202
Reviewed By: janeyx99
Differential Revision: D30644215
Pulled By: malfet
fbshipit-source-id: 3c16240b9fa899bd4d572c1732a7d87d3dd0fbd5
Summary:
This PR greatly simplifies `mypy-strict.ini` by strictly typing everything in `.github` and `tools`, rather than picking and choosing only specific files in those two dirs. It also removes `warn_unused_ignores` from `mypy-strict.ini`, for reasons described in https://github.com/pytorch/pytorch/pull/56402#issuecomment-822743795: basically, that setting makes life more difficult depending on what libraries you have installed locally vs in CI (e.g. `ruamel`).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/59117
Test Plan:
```
flake8
mypy --config mypy-strict.ini
```
Reviewed By: malfet
Differential Revision: D28765386
Pulled By: samestep
fbshipit-source-id: 3e744e301c7a464f8a2a2428fcdbad534e231f2e
Summary:
Given that the minimal required Python version for using PyTorch is 3.6, the development tools should also be able to handle it. `./tools/nightly.py` currently uses the parameters `capture_output` and `text` of `subprocess.run` that were only added for [Python 3.7](https://docs.python.org/3/library/subprocess.html#subprocess.run).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55776
Reviewed By: ngimel
Differential Revision: D27709124
Pulled By: ezyang
fbshipit-source-id: aeea15a891ba792f3cd5fa602f0d7b746007e30c
Summary:
I am submitting this PR on behalf of Janne Hellsten(nurpax) from NVIDIA, for the convenience of CLA. Thanks Janne a lot for the contribution!
This fixes the bug when running `
./tools/nightly.py checkout -b my-nightly-branch` on windows. Before this fix, this command gets the following error on Windows.
```
ERROR:root:Fatal exception
Traceback (most recent call last):
File "./tools/nightly.py", line 166, in logging_manager
yield root_logger
File "./tools/nightly.py", line 644, in main
install(
File "./tools/nightly.py", line 552, in install
spdir = _site_packages(pytdir.name, platform)
File "./tools/nightly.py", line 325, in _site_packages
os.path.join(pytdir.name, "Lib", "site-packages")
NameError: name 'pytdir' is not defined
log file: d:\pytorch\nightly\log\2020-12-11_16h10m14s_6867a21e-3c0e-11eb-878e-04ed3363a33e\nightly.log
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49274
Reviewed By: H-Huang
Differential Revision: D25808156
Pulled By: malfet
fbshipit-source-id: 00778016366ab771fc3fb152710c7849210640fb