isort->usort

Summary: Move from isort to usort now that usort supports sorting within lines.

Reviewed By: patricklabatut

Differential Revision: D35893280

fbshipit-source-id: 621c1cd285199d785408504430ee0bdf8683b21e
This commit is contained in:
Jeremy Reizenstein 2022-04-26 08:34:54 -07:00 committed by Facebook GitHub Bot
parent 9320100abc
commit 9f443ed26b
6 changed files with 13 additions and 8 deletions

View File

@ -46,7 +46,7 @@ outlined on that page and do not file a public issue.
## Coding Style
We follow these [python](http://google.github.io/styleguide/pyguide.html) and [C++](https://google.github.io/styleguide/cppguide.html) style guides.
For the linter to work, you will need to install `black`, `flake`, `isort` and `clang-format`, and
For the linter to work, you will need to install `black`, `flake`, `usort` and `clang-format`, and
they need to be fairly up to date.
## License

View File

@ -43,7 +43,7 @@ export CUB_HOME=$PWD/cub-1.10.0
For developing on top of PyTorch3D or contributing, you will need to run the linter and tests. If you want to run any of the notebook tutorials as `docs/tutorials` or the examples in `docs/examples` you will also need matplotlib and OpenCV.
- scikit-image
- black
- isort
- usort
- flake8
- matplotlib
- tdqm
@ -59,7 +59,7 @@ conda install jupyter
pip install scikit-image matplotlib imageio plotly opencv-python
# Tests/Linting
pip install black 'isort<5' flake8 flake8-bugbear flake8-comprehensions
pip install black usort flake8 flake8-bugbear flake8-comprehensions
```
## Installing prebuilt binaries for PyTorch3D

View File

@ -22,8 +22,14 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
DIR=$(dirname "${DIR}")
echo "Running isort..."
isort -y -sp "${DIR}"
if [[ -f "${DIR}/tests/TARGETS" ]]
then
pyfmt "${DIR}"
else
# run usort externally only
echo "Running usort..."
usort "${DIR}"
fi
echo "Running black..."
black "${DIR}"

View File

@ -2,9 +2,9 @@
# fmt: off
# flake8: noqa
'''Pytorch implementations of hyper-network modules.
isort:skip_file
'''
import functools
import torch
import torch.nn as nn

View File

@ -2,7 +2,6 @@
# fmt: off
# flake8: noqa
'''A number of custom pytorch modules with sane defaults that I find useful for model prototyping.
isort:skip_file
'''
import torch
import torch.nn as nn

View File

@ -144,7 +144,7 @@ setup(
install_requires=["fvcore", "iopath"],
extras_require={
"all": ["matplotlib", "tqdm>4.29.0", "imageio", "ipywidgets"],
"dev": ["flake8", "isort", "black==19.3b0"],
"dev": ["flake8", "usort", "black==19.3b0"],
"implicitron": ["hydra-core>=1.1", "visdom", "lpips", "matplotlib"],
},
entry_points={