Skip to content

Commit d296b2c

Browse files
bshethmetafacebook-github-bot
authored andcommitted
Prevent reordering of imports by auto formatter to avoid crashes (facebookresearch#3826)
Summary: Pull Request resolved: facebookresearch#3826 Apparently this is the generally accepted way to do this. https://usort.readthedocs.io/en/stable/guide.html#import-blocks What do you think? Reviewed By: kuarora, mengdilin Differential Revision: D62147522 fbshipit-source-id: b9cf034ff6119595956a3c46e7094a2a8b0cb2cc
1 parent 501a8be commit d296b2c

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

tests/torch_test_contrib.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6-
import torch
7-
import unittest
8-
import numpy as np
9-
import faiss
10-
import faiss.contrib.torch_utils
6+
import torch # usort: skip
7+
import unittest # usort: skip
8+
import numpy as np # usort: skip
9+
10+
import faiss # usort: skip
11+
import faiss.contrib.torch_utils # usort: skip
1112

1213
class TestTorchUtilsCPU(unittest.TestCase):
1314
# tests add, search

tests/torch_test_neural_net.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6-
import torch
7-
from torch import nn
8-
import unittest
9-
import numpy as np
10-
import faiss
11-
12-
from faiss.contrib import datasets
13-
from faiss.contrib.inspect_tools import get_additive_quantizer_codebooks
6+
import torch # usort: skip
7+
from torch import nn # usort: skip
8+
import unittest # usort: skip
9+
import numpy as np # usort: skip
10+
11+
import faiss # usort: skip
12+
13+
from faiss.contrib import datasets # usort: skip
14+
from faiss.contrib.inspect_tools import get_additive_quantizer_codebooks # usort: skip
1415

1516

1617
class TestLayer(unittest.TestCase):

0 commit comments

Comments
 (0)